Query service: Difference between revisions
Jump to navigation
Jump to search
TrMendenhall (talk | contribs) No edit summary |
TrMendenhall (talk | contribs) (Added another query example) |
||
Line 11: | Line 11: | ||
** Get the labels for all library locations in the Hyacinth Locations vocabulary | ** Get the labels for all library locations in the Hyacinth Locations vocabulary | ||
*** <nowiki>SELECT ?label WHERE { ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P1> <http://cul-dlc-test.wiki.opencura.com/entity/Q3> ; <http://www.w3.org/2000/01/rdf-schema#label> ?label .}</nowiki> | *** <nowiki>SELECT ?label WHERE { ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P1> <http://cul-dlc-test.wiki.opencura.com/entity/Q3> ; <http://www.w3.org/2000/01/rdf-schema#label> ?label .}</nowiki> | ||
** Get labels, local Hyacinth URIs, LCNAF IDs, and MarcOrg codes for Hyacinth Locations vocabulary | |||
*** <nowiki> SELECT ?label ?HyacinthURI ?LCNAFID ?MarcOrgCode | |||
*** <nowiki> WHERE { ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P1> <http://cul-dlc-test.wiki.opencura.com/entity/Q3> ; | |||
*** <nowiki> <http://www.w3.org/2000/01/rdf-schema#label> ?label . | |||
*** <nowiki> OPTIONAL | |||
*** <nowiki> {?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P2> ?HyacinthURI . | |||
*** <nowiki> ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P4> ?LCNAFID . | |||
*** <nowiki> ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P5> ?MarcOrgCode .} | |||
*** <nowiki> } | |||
*** <nowiki> ORDER BY ?label |
Revision as of 19:26, 26 May 2021
Using the query service
- Query service lives here
- Documentation on WbStack's query service (general)
- 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: <http://cul-dlc-test.wiki.opencura.com/prop/direct/P#>
- Item: <http://cul-dlc-test.wiki.opencura.com/entity/Q#>
- Example queries
- Get the URIs for all library locations in the Hyacinth Locations vocabulary (Q-numbers only)
- SELECT * WHERE { ?libraryQnumber <http://cul-dlc-test.wiki.opencura.com/prop/direct/P1> <http://cul-dlc-test.wiki.opencura.com/entity/Q3> . }
- Get the labels for all library locations in the Hyacinth Locations vocabulary
- SELECT ?label WHERE { ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P1> <http://cul-dlc-test.wiki.opencura.com/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
- <nowiki> SELECT ?label ?HyacinthURI ?LCNAFID ?MarcOrgCode
- <nowiki> WHERE { ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P1> <http://cul-dlc-test.wiki.opencura.com/entity/Q3> ;
- <nowiki> <http://www.w3.org/2000/01/rdf-schema#label> ?label .
- <nowiki> OPTIONAL
- <nowiki> {?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P2> ?HyacinthURI .
- <nowiki> ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P4> ?LCNAFID .
- <nowiki> ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P5> ?MarcOrgCode .}
- <nowiki> }
- <nowiki> ORDER BY ?label
- Get the URIs for all library locations in the Hyacinth Locations vocabulary (Q-numbers only)