DS Catalog:SPARQL Query Service/example queries: Difference between revisions

Line 786: Line 786:
This query generates a list of authority records in the Wikibase by authority value type (i.e., all items which are an ''instance of'' a particular Authority Type).
This query generates a list of authority records in the Wikibase by authority value type (i.e., all items which are an ''instance of'' a particular Authority Type).


===Languages, Materials, Places===
===Materials, Places, Terms (Genres and Subjects)===
<syntaxhighlight lang="SPARQL">
PREFIX wd: <https://catalog.digital-scriptorium.org/entity/>
PREFIX wds: <https://catalog.digital-scriptorium.org/entity/statement/>
PREFIX wdv: <https://catalog.digital-scriptorium.org/value/>
PREFIX wdt: <https://catalog.digital-scriptorium.org/prop/direct/>
PREFIX p: <https://catalog.digital-scriptorium.org/prop/>
PREFIX ps: <https://catalog.digital-scriptorium.org/prop/statement/>
PREFIX pq: <https://catalog.digital-scriptorium.org/prop/qualifier/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
 
SELECT ?authorityValue ?authorityValueLabel ?authorityTypeLabel ?externalID
 
WHERE {
 
# specify authority values to be generated by type by uncommenting
 
#BIND (wd:Q16 as ?authorityType) # place authority
#BIND (wd:Q17 as ?authorityType) # material authority
#BIND (wd:Q11 as ?authorityType) # term authority (genre and subject terms)
 
?authorityValue wdt:P16 ?authorityType .
    # find authority records by authority type specified above
OPTIONAL { ?authorityValue wdt:P44|wdt:P42 ?externalID . }
    # find external IDs matched to authority value
 
    SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
      # allows English language labels to be returned for Wikibase items
  }
}
ORDER BY ASC (?authorityValueLabel)


===Personal Names and Corporate Names===
===Personal Names and Corporate Names===
Bots, Bureaucrats, emailconfirmed, Administrators
30,567

edits