query-2e183902946312d1bb40441bc1f42e30

rq turtle/ttl

TODO

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 distinct ?item ?itemLabel ?university_beLabel ?university_be2Label ?university_caLabel ?university_ca2Label where
{
   {
  SELECT ?item ?university_be ?university_be2 ?university_ca ?university_ca2
WHERE 
{
  ?item wdt:P69 ?university_ca.
  ?item wdt:P69 ?university_be.
  ?university_be wdt:P17 wd:Q31 .
  ?university_ca wdt:P17 wd:Q16 .

 optional { ?item wdt:P69 ?university_be2 . 
            ?university_be2 wdt:P17 wd:Q31 .   
            ?university_be2 wdt:P31/wdt:P279* wd:Q3918 .
            filter(str(?university_be2) > str(?university_be)) }
 optional { ?item wdt:P69 ?university_ca2 .
             ?university_ca2 wdt:P17 wd:Q16 . 
             ?university_ca2 wdt:P31/wdt:P279* wd:Q3918 .
             filter(str(?university_ca2) > str(?university_ca)) }
} }  filter not exists { ?item wdt:P69 ?university_bez . ?university_bez wdt:P17 wd:Q31 . filter(str(?university_bez) < str(?university_be)) }
  filter not exists { ?item wdt:P69 ?university_caz . ?university_caz wdt:P17 wd:Q16 . filter(str(?university_caz) < str(?university_ca)) }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?university_be wdt:P31/wdt:P279* wd:Q3918 .
  ?university_ca wdt:P31/wdt:P279* wd:Q3918 .
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?item"):::projected v5("?university_be") v7("?university_be2") v4("?university_bez") v2("?university_ca") v6("?university_ca2") v1("?university_caz") a1((" ")) a2((" ")) a3((" ")) a4((" ")) c3(["wd:Q16"]):::iri c9(["bd:serviceParam"]):::iri c4(["wd:Q31"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal c7(["wd:Q3918"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0f0[["str(?university_caz) < str(?university_ca)"]] e0f0 --> e0v1 e0f0 --> e0v2 e0v3 --"wdt:P69"--> e0v1 e0v1 --"wdt:P17"--> e0c3 e0v3("?item"):::projected e0v2("?university_ca"):::projected e0v1("?university_caz"):::projected e0c3(["wd:Q16"]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> v2 f0 --> v3 f0 --> c1 f0 --> c2 f0 --> c3 f1[["str(?university_caz) < str(?university_ca)"]] f1 --> v1 f1 --> v2 v3 --"wdt:P69"--> v1 v1 --"wdt:P17"--> c3 f2[["not "]] subgraph f2e1["Exists Clause"] e1f0[["str(?university_bez) < str(?university_be)"]] e1f0 --> e1v1 e1f0 --> e1v2 e1v3 --"wdt:P69"--> e1v1 e1v1 --"wdt:P17"--> e1c3 e1v3("?item"):::projected e1v2("?university_be"):::projected e1v1("?university_bez"):::projected e1c3(["wd:Q31"]):::iri end f2--EXISTS--> f2e1 f2 --> v4 f2 --> v5 f2 --> v3 f2 --> c1 f2 --> c2 f2 --> c4 f3[["str(?university_bez) < str(?university_be)"]] f3 --> v4 f3 --> v5 v3 --"wdt:P69"--> v4 v4 --"wdt:P17"--> c4 v3 --"wdt:P69"--> v2 v3 --"wdt:P69"--> v5 v5 --"wdt:P17"--> c4 v2 --"wdt:P17"--> c3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P69".-> v7 v7 --"wdt:P17"--> c4 v7 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P69".-> v6 v6 --"wdt:P17"--> c3 v6 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end v5 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c7 v2 --"wdt:P31"--> a4 a4 --"wdt:P279"--> c7