query-60f2736f35245f9aa93fbe9f36b6b3b9
20:30, 6 January 2019 (UTC)) talk (Andrew Gray: Here you go! The two types of thing (P144 or P1877) are in seperate UNION queries, and the * element means that they also go down the chain - so items based on a work X which is itself based on a work by Austen. (This adds one thing, which is a film based on a parody novel). 2le2im-bdc@09:59, 7 January 2019 (UTC)) talk (2le2im-bdc:.--Andrew GrayGreat! Thanks a lot @
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?itemDescription
WHERE
{
?item wdt:P31 wd:Q11424 .
{ ?item wdt:P144*/wdt:P50 wd:Q36322 }
union { ?item wdt:P1877 wd:Q36322 }
UNION { ?item wdt:P58 wd:Q36322 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?itemDescription
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?item"):::projected
v1("?itemDescription"):::projected
a1((" "))
c5(["wd:Q36322"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c2(["wd:Q11424"]):::iri
v2 --"wdt:P31"--> c2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P58"--> c5
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P1877"--> c5
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P144"--> a1
a1 --"wdt:P50"--> c5
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end