query-cbf3c0ada1cf865995601eb51a79f8ff

rq turtle/ttl

I would like that the first query return me the items located (or any of its subproperties) in Anoia, and in any of the items located (or any of its subproperties) there too (for instance, those in the second query pasted). In other words, I would like to make the query become 'recursive'. How could I do this? Thanks a lot. 16:05, 11 January 2018 (UTC)) talk (Marcmiquel-- Remembering that I have not got a clue what I'm doing, does this get you anywhere? Clearly it does not find everything ... I'm hoping that the * in P131* gives us a recursive sort of located in, and the result set lends some support to this, but...:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel WHERE {
  {?item wdt:P131* wd:Q15352 .} #places
  UNION
 {?item wdt:P19 ?pob.           #people
  ?pob wdt:P131* wd:Q15352 .} 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v2("?pob") c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;"]):::literal c2(["wd:Q15352"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P19"--> v2 v2 --"wdt:P131"--> c2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P131"--> c2 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end