query-842f180ae30c8013ab4c2240a7c3a3fa
. Q145This query gets a list of all admin regions 2 levels deep (maxIterations) for Wikidata item
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX gas: <http://www.bigdata.com/rdf/gas#>
SELECT ?item ?itemLabel (substr(str(?link),31,500) as ?link) ?itemAltLabel ?itemDescription ?linkTo (GROUP_CONCAT(?instanceOfLabel; separator='; ') as ?instanceOf) ?depth WHERE
{
SERVICE gas:service {
gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.SSSP" ;
gas:in wd:Q145 ;
gas:traversalDirection "Reverse" ;
gas:out ?item ;
gas:out1 ?depth ;
gas:out2 ?linkTo ;
gas:maxIterations 2 ;
gas:linkType wdt:P131 .
}
FILTER EXISTS { ?item wdt:P31/wdt:P279* wd:Q56061 }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
?instanceOf rdfs:label ?instanceOfLabel .
?item rdfs:label ?itemLabel ;
skos:altLabel ?itemAltLabel ;
schema:description ?itemDescription .
}
OPTIONAL { ?item wdt:P31 ?instanceOf . }
OPTIONAL {
?link schema:about ?item .
?link schema:isPartOf <https://en.wikipedia.org/> .
}
}
GROUP BY ?item ?itemLabel ?itemAltLabel ?itemDescription ?linkTo ?depth ?link
ORDER BY ?depth