query-cf15b6f4ee3f9002d5c396abc22dbb7c
Anti-pattern 2This is where a subclass C has two superclasses A and B that are related to one another by an instance of relationship. Wikidata:WikiProject Ontology/Problems/pattern 2 indirect superclasses case 2 Wikidata:WikiProject Ontology/Problems/pattern 2 indirect superclasses case 1 Wikidata:WikiProject Ontology/Problems/pattern 2 direct superclassesThe general form for this query (which again times out) is:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?classA ?classALabel (count(*) as ?count) WHERE {
?classC wdt:P279+ ?classA ;
wdt:P279+ ?classB .
?classB wdt:P31 ?classA .
service wikibase:label {
bd:serviceParam wikibase:language "en" .
}
} group by ?classA ?classALabel order by desc(?count)
Query found at
- https://www.wikidata.org/wiki/Wikidata:WikiProject_Ontology/Problems
- https://www.wikidata.org/wiki/Wikidata:WikiProject_Ontology/Problems/Anti-pattern_2
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?classA"):::projected
v4("?classB")
v2("?classC")
v5("?count")
c4(["bd:serviceParam"]):::iri
c6(["en"]):::literal
v2 --"wdt:P279"--> v3
v2 --"wdt:P279"--> v4
v4 --"wdt:P31"--> v3
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end
bind1[/"count(*)"/]
bind1 --as--o v5