query-6b0534482ddb28b3caba11dc5826cda3

rq turtle/ttl

]reply[09:34, 6 June 2020 (UTC)) talk (Dipsacus fullonumAn obvious optimization is to remove the OPTIONAL keywords. You need results from the OPTIONAL clauses to get values for ?brand and ?item, so the aren't really optional. That being said I don't think it will be possible to avoid timeout because there are far too many results. My counting gave 171,070 companies, 11,760 products and over a million items. You will need to limit the query to get a smaller result by adding more restrictive criteria. An general search for all types of products at once is impossible in 60 seconds. --:: Thank you very much. In fact, I removed the OPTIONAL KeyWord. But I still faced a problem of redundancy. In the following Query, the field ?ProductsItemName contains redundant data and when i used Distinct KeyWord, the query generates an Exception. Help me in eliminating the redundancy.Dipsacus fullonum, Dipsacus fullonum@

Use at

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#>
select  ?brand ?brandLabel (GROUP_CONCAT(?itemName; SEPARATOR=", ") AS ?ProductsItemName) 
where {

    ?CompanyID wdt:P31   wd:Q4830453.
    ?CompanyID wdt:P1056 ?MaterialProduced.
     ?item      wdt:P279*  ?MaterialProduced.
    ?item      wdt:P1716 ?brand.

  SERVICE wikibase:label{
            bd:serviceParam wikibase:language "en".
            ?item rdfs:label ?itemName.
           ?brand rdfs:label ?brandLabel.
        }
}
GROUP BY ?brand ?brandLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?CompanyID") v2("?MaterialProduced") v7("?ProductsItemName") v4("?brand"):::projected v6("?brandLabel"):::projected v3("?item") v5("?itemName"):::projected c7(["bd:serviceParam"]):::iri c2(["wd:Q4830453"]):::iri c9(["en"]):::literal v1 --"wdt:P31"--> c2 v1 --"wdt:P1056"--> v2 v3 --"wdt:P279"--> v2 v3 --"wdt:P1716"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 v3 --"rdfs:label"--> v5 v4 --"rdfs:label"--> v6 end bind1[/"?itemName"/] v5 --o bind1 bind1 --as--o v7