Query service

From Columbia Wikibase Test
Revision as of 19:50, 21 December 2022 by TrMendenhall (talk | contribs) (Fixed an error in one of the SPARQL queries)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Using the query service

  • Query service lives here
  • General documentation on WbStack's query service has not been migrated to wikibase.cloud
  • Queries are made in SPARQL
  • Note that you cannot use the standard Wikidata prefixes when constructing your query. Instead, fill in the P# and Q# in the following:
    • Property: <https://cul-dlc-test.wikibase.cloud/prop/direct/P#>
    • Item: <https://cul-dlc-test.wikibase.cloud/entity/Q#>
  • Example queries
    • Get the URIs for all library locations in the Hyacinth Locations vocabulary (Q-numbers only)
      • SELECT * WHERE { ?libraryQnumber <https://cul-dlc-test.wikibase.cloud/prop/direct/P1> <https://cul-dlc-test.wikibase.cloud/entity/Q3> . }
    • Get the labels for all library locations in the Hyacinth Locations vocabulary
      • SELECT ?label WHERE { ?b <https://cul-dlc-test.wikibase.cloud/prop/direct/P1> <https://cul-dlc-test.wikibase.cloud/entity/Q3> ; <http://www.w3.org/2000/01/rdf-schema#label> ?label .}
    • Get labels, local Hyacinth URIs, LCNAF IDs, and MarcOrg codes for Hyacinth Locations vocabulary
      • SELECT ?label ?HyacinthURI ?LCNAFID ?MarcOrgCode

WHERE { ?b <https://cul-dlc-test.wikibase.cloud/prop/direct/P1> <https://cul-dlc-test.wikibase.cloud/entity/Q3> ;
<http://www.w3.org/2000/01/rdf-schema#label> ?label .
OPTIONAL {?b <https://cul-dlc-test.wikibase.cloud/prop/direct/P2> ?HyacinthURI .}
OPTIONAL {?b <https://cul-dlc-test.wikibase.cloud/prop/direct/P4> ?LCNAFID .}
OPTIONAL {?b <https://cul-dlc-test.wikibase.cloud/prop/direct/P5> ?MarcOrgCode .}
}
ORDER BY ?label