query-5f3eb13bb5a7e205ce5d72bcba5a797e

rq turtle/ttl

Grouping result by entity, not by propertyHi everyone, I'm dealing with the following query which gathers every painting with one or more depict properties. But when a painting has more than one depict, the results appear with one line by depict. My query: } } ."[AUTO_LANGUAGE],fr,en" language:wikibase serviceParam:bd { label:wikibase SERVICE .?depict P180:wdt ?item .?image P18:wdt ?item .Q4502142:wd *P279:wdt/P31:wdt ?item { WHERE ?depict ?image ?itemLabel ?item SELECTWhat I get : wd:Q235113 commons:Andrey Rublev - Архангел Михаил. Из Деисусного чина ("Звенигородский") - Google Art Project.jpg Saint Michel archange wd:Q18683117 wd:Q45581 commons:Andrey Rublev - Архангел Михаил. Из Деисусного чина ("Звенигородский") - Google Art Project.jpg Saint Michel archange wd:Q18683117 depict image itemLabel item Légende What I would like : wd:Q235113, wd:Q45581 commons:Andrey Rublev - Архангел Михаил. Из Деисусного чина ("Звенигородский") - Google Art Project.jpg Saint Michel archange wd:Q18683117 depicts image itemLabel item Légende 15:23, 28 February 2018 (UTC)) talk (GordibachIs there any way to get this kind of result? And other question: is there a way to query by the same way the paintings without depict, meaning make depicts optionnal? Thanks! Try this. However, I had to limit the number of results.

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 ?image (GROUP_CONCAT(distinct ?depict ;separator=", ") as ?depecited) WHERE {

    ?item wdt:P31/wdt:P279* wd:Q4502142;
          wdt:P18 ?image;
          wdt:P180 ?depict.

    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,en". }

}
GROUP BY ?item ?itemLabel ?image 
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?depecited") v3("?depict"):::projected v2("?image"):::projected v1("?item"):::projected a1((" ")) c7(["bd:serviceParam"]):::iri c3(["wd:Q4502142"]):::iri c9(["#91;AUTO_LANGUAGE#93;,fr,en"]):::literal v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P18"--> v2 v1 --"wdt:P180"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind1[/"?depict"/] v3 --o bind1 bind1 --as--o v4