Query service: Difference between revisions

From Columbia Wikibase Test
Jump to navigation Jump to search
m (Fixed typos in query added in previous edit)
(Fixed an error in one of the SPARQL queries)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== Using the query service ===
=== Using the query service ===
* Query service lives [https://cul-dlc-test.wiki.opencura.com/query/ here]
* Query service lives [https://cul-dlc-test.wikibase.cloud/query/ here]
* [https://wiki.wbstack.com/wiki/Query_Service Documentation] on WbStack's query service (general)
* General documentation on WbStack's query service has not been migrated to wikibase.cloud
* Queries are made in SPARQL
* 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:
* Note that you cannot use the standard Wikidata prefixes when constructing your query.  Instead, fill in the P# and Q# in the following:
** Property: <nowiki><http://cul-dlc-test.wiki.opencura.com/prop/direct/P#></nowiki>
** Property: <nowiki><https://cul-dlc-test.wikibase.cloud/prop/direct/P#></nowiki>
** Item: <nowiki><http://cul-dlc-test.wiki.opencura.com/entity/Q#></nowiki>
** Item: <nowiki><https://cul-dlc-test.wikibase.cloud/entity/Q#></nowiki>
* Example queries
* Example queries
** Get the URIs for all library locations in the Hyacinth Locations vocabulary (Q-numbers only)
** Get the URIs for all library locations in the Hyacinth Locations vocabulary (Q-numbers only)
*** <nowiki>SELECT * WHERE { ?libraryQnumber <http://cul-dlc-test.wiki.opencura.com/prop/direct/P1> <http://cul-dlc-test.wiki.opencura.com/entity/Q3> . }</nowiki>
*** <nowiki>SELECT * WHERE { ?libraryQnumber <https://cul-dlc-test.wikibase.cloud/prop/direct/P1> <https://cul-dlc-test.wikibase.cloud/entity/Q3> . }</nowiki>
** 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 <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 .}</nowiki>
** Get labels, local Hyacinth URIs, LCNAF IDs, and MarcOrg codes for Hyacinth Locations vocabulary
** Get labels, local Hyacinth URIs, LCNAF IDs, and MarcOrg codes for Hyacinth Locations vocabulary
*** <nowiki> SELECT ?label ?HyacinthURI ?LCNAFID ?MarcOrgCode</nowiki><br>
*** <nowiki> SELECT ?label ?HyacinthURI ?LCNAFID ?MarcOrgCode</nowiki><br>
<nowiki> WHERE { ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P1> <http://cul-dlc-test.wiki.opencura.com/entity/Q3> ;</nowiki><br>
<nowiki> WHERE { ?b <https://cul-dlc-test.wikibase.cloud/prop/direct/P1> <https://cul-dlc-test.wikibase.cloud/entity/Q3> ;</nowiki><br>
<nowiki> <http://www.w3.org/2000/01/rdf-schema#label> ?label .</nowiki><br>
<nowiki> <http://www.w3.org/2000/01/rdf-schema#label> ?label .</nowiki><br>
<nowiki> OPTIONAL</nowiki><br>
<nowiki> OPTIONAL {?b <https://cul-dlc-test.wikibase.cloud/prop/direct/P2> ?HyacinthURI .}</nowiki><br>
<nowiki> {?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P2> ?HyacinthURI .</nowiki><br>
<nowiki> OPTIONAL {?b <https://cul-dlc-test.wikibase.cloud/prop/direct/P4> ?LCNAFID .}</nowiki><br>
<nowiki> ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P4> ?LCNAFID .</nowiki><br>
<nowiki> OPTIONAL {?b <https://cul-dlc-test.wikibase.cloud/prop/direct/P5> ?MarcOrgCode .}</nowiki><br>
<nowiki> ?b <http://cul-dlc-test.wiki.opencura.com/prop/direct/P5> ?MarcOrgCode .}</nowiki><br>
<nowiki> }</nowiki><br>
<nowiki> }</nowiki><br>
<nowiki> ORDER BY ?label</nowiki><br>
<nowiki> ORDER BY ?label</nowiki><br>

Latest revision as of 19:50, 21 December 2022

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