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

Jump to navigation Jump to search
Line 115: Line 115:
==Unenriched Strings Generator==
==Unenriched Strings Generator==
This query generates a list of string values of a particular type of ''as recorded'' data occurring in a DS Record which have not be qualified by an authority value (i.e., reconciled to its linked data equivalent in a Linked Open Vocabulary or Authority).
This query generates a list of string values of a particular type of ''as recorded'' data occurring in a DS Record which have not be qualified by an authority value (i.e., reconciled to its linked data equivalent in a Linked Open Vocabulary or Authority).
<syntaxhighlight lang="SPARQL">
SELECT ?record ?recordLabel ?string ?authority ?authorityLabel #?roleLabel # (un-comment roleLabel variable when querying name data to get role information)
# declared variables give a link to a record, the label of the record, a link to the authority record, and a label for the the authority record
WHERE {
  ?record p:P14 ?stringStatement .
# identifies records with statements with corresponding property (change P-value for as recorded value to be queried)
  ?stringStatement ps:P14 ?string .
# identifies statements that have strings with corresponding property (change P-value for as recorded value to be queried)
  #FILTER NOT EXISTS { ?stringStatement pq:P17 ?authority . }
# identifies those statements which have not been enriched with authority values (change P-value for authority file value to be queried)
  OPTIONAL { ?stringStatement pq:P15 ?role . }
# only used for name data, un-comment optional clause when querying name data
 
    SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
ORDER BY ASC (?string)
# this sorts the results alphabetically by string values
<syntaxhighlight>
Bots, Bureaucrats, emailconfirmed, Administrators
30,537

edits

Navigation menu