PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?Greek_deityItem ?Greek_deity ?father ?fatherItem ?mother ?motherItem ?image
WHERE {
# Get deities that have exactly one solution set
{
SELECT ?Greek_deityItem
WHERE {
?Greek_deityItem wdt:P31 wd:Q22989102.
OPTIONAL { ?Greek_deityItem wdt:P22 ?fatherItem. }
OPTIONAL { ?Greek_deityItem wdt:P25 ?motherItem. }
OPTIONAL { ?Greek_deityItem wdt:P18 ?image. }
}
GROUP BY ?Greek_deityItem
HAVING (COUNT(*) = 1)
}
# Get the details for these single-solution deities
?Greek_deityItem rdfs:label ?Greek_deity;
wdt:P22 ?fatherItem;
wdt:P25 ?motherItem;
wdt:P18 ?image.
?fatherItem rdfs:label ?father.
?motherItem rdfs:label ?mother.
FILTER (LANG(?Greek_deity) = "en")
FILTER (LANG(?father) = "en")
FILTER (LANG(?mother) = "en")
}
ORDER BY ?Greek_deity