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

Line 856: Line 856:


===Personal Names and Corporate Names===
===Personal Names and Corporate Names===
<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 ?DSID ?externalID
WHERE {
# specify authority values to be generated by type by uncommenting
#BIND (wd:Q8 as ?authorityType) # personal name authority
#BIND (wd:Q9 as ?authorityType) # corporate name authority
?authorityValue wdt:P16 ?authorityType .
    # find authority records by authority type specified above
OPTIONAL { ?authorityValue wdt:P42 ?QID . }
    # find Wikidata QIDs matched to authority value
OPTIONAL { ?authorityValue wdt:P1 ?DSID . }
    # return DSID for names
 
BIND(CONCAT("https://wikidata.org/entity/",?QID) AS ?externalID)
    # render QIDs as URLs
 
    SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
      # allows English language labels to be returned for Wikibase items
  }
}
ORDER BY ASC (?authorityValueLabel)
</syntaxhighlight>


===Standard Titles===
===Standard Titles===
Bots, Bureaucrats, emailconfirmed, Administrators
30,567

edits