sul-dlss-deprecated / rialto-derivatives

Listens to SNS messages and moves data from Neptune to Solr and Postgres to power the RIALTO webapp
0 stars 1 forks source link

Orgs without subtypes omitted #117

Closed justinlittman closed 6 years ago

justinlittman commented 6 years ago

This includes non-Stanford orgs, which don't have subtypes.

Existing query:

SELECT ?id ?type ?subtype ?name ?altLabel ?abbreviation ?parent
            WHERE {
              ?id a <http://xmlns.com/foaf/0.1/Organization> .
                ?id a ?type .
                ?id <http://www.w3.org/2004/02/skos/core#prefLabel>|<http://www.w3.org/2000/01/rdf-schema#label> ?name .
                FILTER ( ?id = <http://sul.stanford.edu/rialto/agents/orgs/038081b4b80720eed3e56e5743dda098> )
              FILTER ( ?subtype NOT IN (<http://xmlns.com/foaf/0.1/Organization>, <http://xmlns.com/foaf/0.1/Agent>))
                FILTER ( ?type = <http://xmlns.com/foaf/0.1/Organization>)
              OPTIONAL {
                ?id <http://www.w3.org/2004/02/skos/core#altLabel> ?altLabel .
                    ?id <http://vivoweb.org/ontology/core#abbreviation> ?abbreviation .
                    ?id <http://purl.obolibrary.org/obo/BFO_0000050> ?parent .
              }
            }

screen shot 2018-10-18 at 3 48 35 pm

with subtype made optional:

SELECT ?id ?type ?subtype ?name ?altLabel ?abbreviation ?parent
            WHERE {
              ?id a <http://xmlns.com/foaf/0.1/Organization> .
                ?id a ?type .
                ?id <http://www.w3.org/2004/02/skos/core#prefLabel> ?name .
              FILTER ( ?id = <http://sul.stanford.edu/rialto/agents/orgs/038081b4b80720eed3e56e5743dda098> )
              FILTER ( ! bound(?subtype) || ?subtype NOT IN (<http://xmlns.com/foaf/0.1/Organization>, <http://xmlns.com/foaf/0.1/Agent>))
                FILTER ( ?type = <http://xmlns.com/foaf/0.1/Organization>)
              OPTIONAL {
                      ?id a ?subtype .
                    ?id <http://www.w3.org/2004/02/skos/core#altLabel> ?altLabel .
                    ?id <http://vivoweb.org/ontology/core#abbreviation> ?abbreviation .
                    ?id <http://purl.obolibrary.org/obo/BFO_0000050> ?parent .
              }
            }

returns: screen shot 2018-10-18 at 3 46 09 pm