Project:SPARQL/examples: Difference between revisions

From KBTestWikibase
Jump to navigation Jump to search
No edit summary
No edit summary
Line 58: Line 58:
LIMIT 35
LIMIT 35
</sparql>
</sparql>


=== Wikidata-equivalenten van properties in deze Wikibase  ===
=== Wikidata-equivalenten van properties in deze Wikibase  ===

Revision as of 17:28, 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')))

Try it!

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')))

Try it!

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

Try it!

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

Try it!


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')))

Try it!