query-14bb2164e09301eaf22fa8d08e28f4b5

rq turtle/ttl

Usage|P31}}Multiple statements{{Fragment to select items with several P31 statements { select distinct ?item { ?item p:P31 ?itemP31stmt1, ?itemP31stmt2 filter(?itemP31stmt1 != ?itemP31stmt2) . ?itemP31stmt1 a wikibase:BestRank . ?itemP31stmt1 a wikibase:BestRank . } limit 10 } }} } }}10=limit|?multipleclass|instance of|multiple statements|tlp{{select distinct ?multipleclass where { =query|SPARQL{{Items with several instance of statements

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
select ?multipleclass where { 

   {
     select distinct ?multipleclass {
       ?multipleclass p:P31  ?multipleclassinstance_ofstmt1, ?multipleclassinstance_ofstmt2
                        filter(?multipleclassinstance_ofstmt1 != ?multipleclassinstance_ofstmt2) .
       ?multipleclassinstance_ofstmt1 a wikibase:BestRank .
              ?multipleclassinstance_ofstmt1 a wikibase:BestRank .
     } limit 10
   } 
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?multipleclass"):::projected v1("?multipleclassinstance_ofstmt1") v2("?multipleclassinstance_ofstmt2") c3(["wikibase:BestRank"]):::iri f0[["?multipleclassinstance_ofstmt1 != ?multipleclassinstance_ofstmt2"]] f0 --> v1 f0 --> v2 v3 --"p:P31"--> v1 v3 --"p:P31"--> v2 v1 --"a"--> c3 v1 --"a"--> c3