query-431fcfe98d7ed5adb9d8b769d2347d34

rq turtle/ttl

Query with multiple itemsHello. How to eliminate massive amount of copy&paste here? I want to query about 7k items in the same way.

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 ?Type ?Mouth ?MouthLabel
WHERE
{
    {
        BIND (wd:Q1497 AS ?Item)
        ?Item wdt:P31 ?Type .
        ?Item wdt:P403 ?Mouth
    }
    UNION
    {
        BIND (wd:Q626 AS ?Item)
        ?Item wdt:P31 ?Type .
        ?Item wdt:P403 ?Mouth
    }
    UNION
    {        
        BIND (wd:Q973 AS ?Item)
        ?Item wdt:P31 ?Type .
        ?Item wdt:P403 ?Mouth
    }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "ru" }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?Item"):::projected v3("?Mouth"):::projected v2("?Type"):::projected c4(["bd:serviceParam"]):::iri c6(["ru"]):::literal 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; bind0[/"'wd:Q973'"/] bind0 --as--o v4 v4 --"wdt:P31"--> v2 v4 --"wdt:P403"--> v3 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; bind1[/"'wd:Q626'"/] bind1 --as--o v4 v4 --"wdt:P31"--> v2 v4 --"wdt:P403"--> v3 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; bind2[/"'wd:Q1497'"/] bind2 --as--o v4 v4 --"wdt:P31"--> v2 v4 --"wdt:P403"--> v3 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 end