query-314c50d040b55679a35392e2174d36bf
Greek mythological characters SELECT ?item ?itemLabel ?gender ?genderLabel ?father ?fatherLabel ?mother ?motherLabel (GROUP_CONCAT(?childLabel; separator=", ") as ?children) WHERE { { ?item wdt:P31 ?instance . values ?instance { wd:Q22988604} } UNION { ?item wdt:P31 ?instance . ?instance wdt:P279 wd:Q22988604 . } ?item wdt:P21 ?gender . ?item wdt:P22 ?father . ?item wdt:P25 ?mother . ?item wdt:P40 ?child . ?child rdfs:label ?childLabel FILTER(lang(?childLabel)="en")
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
} GROUP BY ?item ?itemLabel ?gender ?genderLabel ?father ?fatherLabel ?mother ?motherLabel
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Greek mythological characters
SELECT ?item ?itemLabel ?gender ?genderLabel ?father ?fatherLabel
?mother ?motherLabel (GROUP_CONCAT(?childLabel; separator=", ") as ?children)
WHERE {
{ ?item wdt:P31 ?instance .
values ?instance { wd:Q22988604}
}
UNION
{ ?item wdt:P31 ?instance .
?instance wdt:P279 wd:Q22988604 .
}
?item wdt:P21 ?gender .
?item wdt:P22 ?father .
?item wdt:P25 ?mother .
?item wdt:P40 ?child .
?child rdfs:label ?childLabel FILTER(lang(?childLabel)="en")
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
GROUP BY ?item ?itemLabel ?gender ?genderLabel ?father ?fatherLabel ?mother ?motherLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?child")
v1("?childLabel"):::projected
v8("?children")
v5("?father"):::projected
v4("?gender"):::projected
v4("?instance")
v2("?item"):::projected
v6("?mother"):::projected
c11(["bd:serviceParam"]):::iri
c1(["en"]):::literal
c4(["wd:Q22988604"]):::iri
f0[["?childLabel = 'en'"]]
f0 --> v1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> v4
v4 --"wdt:P279"--> c4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> v4
bind1[/VALUES ?instance/]
bind1-->v4
bind10(["wd:Q22988604"])
bind10 --> bind1
end
union0r <== or ==> union0l
end
v2 --"wdt:P21"--> v4
v2 --"wdt:P22"--> v5
v2 --"wdt:P25"--> v6
v2 --"wdt:P40"--> v7
v7 --"rdfs:label"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c1
end
bind3[/"?childLabel"/]
v1 --o bind3
bind3 --as--o v8