Project:SPARQL/examples: Difference between revisions
Jump to navigation
Jump to search
OlafJanssen (talk | contribs) No edit summary |
OlafJanssen (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
==Examples== | ==Examples== | ||
=== | |||
===Alle Ps in deze Wikibase=== | |||
<sparql tryit="1"> | |||
#All properties with descriptions and aliases and types | |||
PREFIX wikibase: <http://wikiba.se/ontology#> | |||
SELECT ?property ?propertyType ?propertyLabel ?propertyDescription ?propertyAltLabel WHERE { | |||
?property wikibase:propertyType ?propertyType . | |||
# or: ?property rdf:type wikibase:Property | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} | |||
ORDER BY ASC(xsd:integer(STRAFTER(STR(?property), 'P'))) | |||
</sparql> | |||
=== Alle Qs in deze Wikibase=== | |||
<sparql tryit="1"> | |||
# All Qnumbers in this Wikibase | |||
PREFIX wikibase: <http://wikiba.se/ontology#> | |||
SELECT ?identifier ?identifierLabel ?identifierDescription ?identifierAltLabel | |||
WHERE | |||
{ | |||
?identifier wikibase:identifiers ?b | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". } | |||
} | |||
ORDER BY ASC(xsd:integer(STRAFTER(STR(?identifier), 'Q'))) | |||
</sparql> | |||
===Alle Ps en Qs samen=== | |||
<sparql tryit="1"> | |||
# All Ps and Qs in this Wikibase | |||
PREFIX wikibase: <http://wikiba.se/ontology#> | |||
SELECT ?statement ?statementLabel ?statementDescription ?statementAltLabel | |||
WHERE | |||
{ | |||
?statement wikibase:statements ?b | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". } | |||
} | |||
ORDER BY ?statement | |||
</sparql> | |||
===Claim ids (GUID) for Qnumbers in this Wikibase=== | |||
<sparql tryit="1"> | |||
# Find claim ids (GUID) for Qnumbers in this Wikibase | |||
# https://kbtestwikibase.wikibase.cloud/w/api.php?action=help&modules=wbgetclaims | |||
PREFIX wikibase: <http://wikiba.se/ontology#> | |||
PREFIX p: <https://kbtestwikibase.wikibase.cloud/prop/> | |||
PREFIX ps: <https://kbtestwikibase.wikibase.cloud/prop/statement/> | |||
SELECT ?item ?itemLabel ?itemDescription ?claim ?IsEenLabel | |||
WHERE | |||
{ | |||
?item wikibase:identifiers ?b. | |||
?item p:P3 ?claim. | |||
?claim ps:P3 ?IsEen. | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". } | |||
} | |||
ORDER BY ASC(xsd:integer(STRAFTER(STR(?item), 'Q'))) | |||
LIMIT 35 | |||
</sparql> | |||
=== Wikidata-equivalenten van properties in deze Wikibase === | |||
<sparql tryit="1"> | <sparql tryit="1"> | ||
PREFIX bd: <http://www.bigdata.com/rdf#> | PREFIX bd: <http://www.bigdata.com/rdf#> |
Revision as of 17:27, 29 June 2022
Examples
Alle Ps in deze Wikibase
#All properties with descriptions and aliases and types
PREFIX wikibase: <http://wikiba.se/ontology#>
SELECT ?property ?propertyType ?propertyLabel ?propertyDescription ?propertyAltLabel WHERE {
?property wikibase:propertyType ?propertyType .
# or: ?property rdf:type wikibase:Property
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ASC(xsd:integer(STRAFTER(STR(?property), 'P')))
Alle Qs in deze Wikibase
# All Qnumbers in this Wikibase
PREFIX wikibase: <http://wikiba.se/ontology#>
SELECT ?identifier ?identifierLabel ?identifierDescription ?identifierAltLabel
WHERE
{
?identifier wikibase:identifiers ?b
SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". }
}
ORDER BY ASC(xsd:integer(STRAFTER(STR(?identifier), 'Q')))
Alle Ps en Qs samen
# All Ps and Qs in this Wikibase
PREFIX wikibase: <http://wikiba.se/ontology#>
SELECT ?statement ?statementLabel ?statementDescription ?statementAltLabel
WHERE
{
?statement wikibase:statements ?b
SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". }
}
ORDER BY ?statement
Claim ids (GUID) for Qnumbers in this Wikibase
# Find claim ids (GUID) for Qnumbers in this Wikibase
# https://kbtestwikibase.wikibase.cloud/w/api.php?action=help&modules=wbgetclaims
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <https://kbtestwikibase.wikibase.cloud/prop/>
PREFIX ps: <https://kbtestwikibase.wikibase.cloud/prop/statement/>
SELECT ?item ?itemLabel ?itemDescription ?claim ?IsEenLabel
WHERE
{
?item wikibase:identifiers ?b.
?item p:P3 ?claim.
?claim ps:P3 ?IsEen.
SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". }
}
ORDER BY ASC(xsd:integer(STRAFTER(STR(?item), 'Q')))
LIMIT 35
Wikidata-equivalenten van properties in deze Wikibase
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <https://kbtestwikibase.wikibase.cloud/prop/direct/>
PREFIX p: <https://kbtestwikibase.wikibase.cloud/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?p ?pLabel ?pDescription ?pAltLabel ?w WHERE {
?p rdf:type wikibase:Property.
OPTIONAL{?p wdt:P1 ?w.}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ASC(xsd:integer(STRAFTER(STR(?p), 'P')))