query-57be0f73cf446c3e0f58b34eee823a2e

rq turtle/ttl

Avoiding duplicates), and I want to see their occupation(s), and their dates of birth and death when they have one, but how can I make people with more than one occupation appear only once? I've tried with GROUP_CONCAT, GROUP BY etc. but it says "bad aggregate" p:P1982I've made this query to get all women whose occupation is either "director" or "film director" or "television director" or "anime director" and have an Anime News Network identifier (

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 ?occupationLabel ?dateofbirth ?dateofdeath (URI(CONCAT("https://www.animenewsnetwork.com/encyclopedia/people.php?id=",?ANNid)) AS ?ANN)
WHERE {
  ?item wdt:P31 wd:Q5 .
  ?item wdt:P21 wd:Q6581072 .
  ?item wdt:P1982 ?ANNid .
  { ?item wdt:P106 wd:Q3455803 } UNION { ?item wdt:P106 wd:Q2059704 } UNION { ?item wdt:P106 wd:Q11284414 } UNION { ?item wdt:P106 wd:Q2526255 }
  ?item wdt:P106 ?occupation
  OPTIONAL { ?item wdt:P569 ?dateofbirth . }
  OPTIONAL { ?item wdt:P570 ?dateofdeath . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ja" }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?ANN") v2("?ANNid"):::projected v4("?dateofbirth"):::projected v5("?dateofdeath"):::projected v1("?item"):::projected v3("?occupation") c4(["wd:Q6581072"]):::iri c14(["bd:serviceParam"]):::iri c8(["wd:Q2059704"]):::iri c10(["wd:Q2526255"]):::iri c2(["wd:Q5"]):::iri c16(["en,ja"]):::literal c7(["wd:Q3455803"]):::iri c9(["wd:Q11284414"]):::iri v1 --"wdt:P31"--> c2 v1 --"wdt:P21"--> c4 v1 --"wdt:P1982"--> v2 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; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P106"--> c10 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P106"--> c9 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P106"--> c8 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P106"--> c7 end union0r <== or ==> union0l end v1 --"wdt:P106"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P569".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P570".-> v5 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 end bind0[/"concat('https://www.animenewsnetwork.com/encyclopedia/people.php?id=',?ANNid)"/] v2 --o bind0 bind0 --as--o v6