query-318429762a98b8fe63f0e1d56953e9bd

rq turtle/ttl

title: Shows items that are either an instance of manga series or anime television series but have more than one instance of statement.

NOTE: The total # of instance of statements is wrong in some cases but is always guaranteed to be > 1.

SELECT DISTINCT ?item (COUNT(?instanceOf) AS ?total) WHERE { { ?item (wdt:P31/(wdt:P279)) wd:Q21198342. } UNION { ?item (wdt:P31/(wdt:P279)) wd:Q63952888. } ?item wdt:P31 ?instanceOf. } GROUP BY ?item HAVING (?total > 1 ) ORDER BY DESC (?total)

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
#title: Shows items that are either an instance of manga series or anime television series but have more than one instance of statement.
# NOTE: The total # of instance of statements is wrong in some cases but is always guaranteed to be > 1.
SELECT DISTINCT ?item (COUNT(?instanceOf) AS ?total) WHERE {
  { ?item (wdt:P31/(wdt:P279*)) wd:Q21198342. }
  UNION
  { ?item (wdt:P31/(wdt:P279*)) wd:Q63952888. }
  ?item wdt:P31 ?instanceOf.
}
GROUP BY ?item
HAVING (?total > 1 )
ORDER BY DESC (?total)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?instanceOf"):::projected v2("?item"):::projected v4("?total") a1((" ")) a2((" ")) c5(["wd:Q63952888"]):::iri c4(["wd:Q21198342"]):::iri f0[["?total > '1^^xsd:integer'"]] f0 --> v4 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c4 end union0r <== or ==> union0l end v2 --"wdt:P31"--> v3 bind2[/"count(?instanceOf)"/] v3 --o bind2 bind2 --as--o v4