query-bc5bb81ea7f552509d831f61265e27fa
Cats SELECT distinct ?item ?itemLabel ?item2 ?item2Label WHERE { ?item wdt:P106 wd:Q10833314. ?item2 wdt:P106 wd:Q10833314. ?item wdt:P3373|^wdt:P3373 ?item2 .
filter (str(?item) < str(?item2)) #remove if you wish
?item rdfs:label ?itemLabel . filter(lang(?itemLabel)="en") ?item2 rdfs:label ?item2Label . filter(lang(?item2Label)="en")
bind(strafter(?itemLabel, " ") as ?index) bind(strbefore(?itemLabel, " ") as ?index2)
} order by ?index ?index2
Use at
- https://query.wikidata.org/sparql
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#>
#Cats
SELECT distinct ?item ?itemLabel ?item2 ?item2Label
WHERE
{
?item wdt:P106 wd:Q10833314.
?item2 wdt:P106 wd:Q10833314.
?item wdt:P3373|^wdt:P3373 ?item2 .
filter (str(?item) < str(?item2)) #remove if you wish
?item rdfs:label ?itemLabel . filter(lang(?itemLabel)="en")
?item2 rdfs:label ?item2Label . filter(lang(?item2Label)="en")
bind(strafter(?itemLabel, " ") as ?index)
bind(strbefore(?itemLabel, " ") as ?index2)
} order by ?index ?index2
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?index")
v7("?index2")
v5("?item"):::projected
v6("?item2"):::projected
v3("?item2Label"):::projected
v4("?itemLabel"):::projected
c3(["wd:Q10833314"]):::iri
f0[["?item2Label = 'en'"]]
f0 --> v3
f1[["?itemLabel = 'en'"]]
f1 --> v4
f2[["str(?item) < str(?item2)"]]
f2 --> v5
f2 --> v6
v5 --"wdt:P106"--> c3
v6 --"wdt:P106"--> c3
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P3373"--> v5
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P3373"--> v6
end
union0r <== or ==> union0l
end
v5 --"rdfs:label"--> v4
v6 --"rdfs:label"--> v3
bind3[/"substring-after(?itemLabel,' ')"/]
v4 --o bind3
bind3 --as--o v7
bind4[/"substring-before(?itemLabel,' ')"/]
v4 --o bind4
bind4 --as--o v7