query-4e93d0d5ef2b8d26a16bdfafbeaba87c

rq turtle/ttl

Infectious diseases, related drugs, filtered co-occurrence

PREFIX ss: http://sciencesource.wmflabs.org/entity/ PREFIX sst: http://sciencesource.wmflabs.org/prop/direct/

SELECT ?item1 ?item2 ?str1 ?str2 WHERE {

?item1 wdt:P31 wd:Q12136; wdt:P1995 ?medspec. ?medspec wdt:P361* wd:Q788926 . ?item2 wdt:P31 wd:Q12140; wdt:P2175 ?condition. ?condition wdt:P1995 wd:Q788926. MINUS {?item2 wdt:P2175 ?item1}. BIND(substr(str(?item1),32) AS ?str1) . BIND(substr(str(?item2),32) AS ?str2) .

SERVICE http://sciencesource-query.wmflabs.org/proxy/wdqs/bigdata/namespace/wdq/sparql {?annotation1 sst:P16 "infectiousdiseases"; sst:P2 ?str1; sst:P3 ss:Q5. ?annotation2 sst:P16 "infectiousdiseasesdrugs"; sst:P2 ?str2; sst:P3 ss:Q5. ?annotation1 sst:P19 ?anchor1. ?annotation2 sst:P19 ?anchor2. ?anchor1 sst:P12 ?article; sst:P3 ss:Q2. ?anchor2 sst:P12 ?article; sst:P3 ss:Q2. ?article sst:P3 ss:Q4. ?anchor1 sst:P10 ?charnumber1. ?anchor2 sst:P10 ?charnumber2. FILTER (?charnumber2 - ?charnumber1 = 100) }

} LIMIT 10

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
#Infectious diseases, related drugs, filtered co-occurrence

PREFIX ss: <http://sciencesource.wmflabs.org/entity/>
PREFIX sst: <http://sciencesource.wmflabs.org/prop/direct/>       

SELECT ?item1 ?item2 ?str1 ?str2 
WHERE {

  ?item1 wdt:P31 wd:Q12136;
        wdt:P1995 ?medspec.
  ?medspec wdt:P361* wd:Q788926 .
  ?item2 wdt:P31 wd:Q12140;
         wdt:P2175 ?condition.
  ?condition wdt:P1995 wd:Q788926.
  MINUS {?item2 wdt:P2175 ?item1}.
  BIND(substr(str(?item1),32) AS ?str1) .
  BIND(substr(str(?item2),32) AS ?str2) .

  SERVICE <http://sciencesource-query.wmflabs.org/proxy/wdqs/bigdata/namespace/wdq/sparql>
       {?annotation1 sst:P16 "infectiousdiseases";
                     sst:P2 ?str1;
                     sst:P3 ss:Q5.
        ?annotation2 sst:P16 "infectiousdiseasesdrugs";
                     sst:P2 ?str2;
                     sst:P3 ss:Q5.
       ?annotation1 sst:P19 ?anchor1.
        ?annotation2 sst:P19 ?anchor2.
        ?anchor1 sst:P12 ?article;
                 sst:P3 ss:Q2.
        ?anchor2 sst:P12 ?article;
                 sst:P3 ss:Q2.
        ?article sst:P3 ss:Q4.
        ?anchor1 sst:P10 ?charnumber1.
        ?anchor2 sst:P10 ?charnumber2.
        FILTER (?charnumber2 - ?charnumber1 = 100)
       }

  }
LIMIT 10

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v11("?anchor1") v12("?anchor2") v9("?annotation1") v10("?annotation2") v13("?article") v8("?charnumber1") v7("?charnumber2") v4("?condition") v1("?item1"):::projected v3("?item2"):::projected v2("?medspec") v5("?str1"):::projected v6("?str2"):::projected c11(["infectiousdiseases"]):::literal c5(["wd:Q788926"]):::iri c15(["infectiousdiseasesdrugs"]):::literal c19([http://sciencesource.wmflabs.org/entity/Q4]):::iri c18([http://sciencesource.wmflabs.org/entity/Q2]):::iri c14([http://sciencesource.wmflabs.org/entity/Q5]):::iri c6(["wd:Q12140"]):::iri c2(["wd:Q12136"]):::iri v1 --"wdt:P31"--> c2 v1 --"wdt:P1995"--> v2 v2 --"wdt:P361"--> c5 v3 --"wdt:P31"--> c6 v3 --"wdt:P2175"--> v4 v4 --"wdt:P1995"--> c5 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v3 --"wdt:P2175"--> v1 end bind1[/"substring(str(?item1),'32^^xsd:integer')"/] v1 --o bind1 bind1 --as--o v5 bind2[/"substring(str(?item2),'32^^xsd:integer')"/] v3 --o bind2 bind2 --as--o v6 subgraph s1["http://sciencesource-query.wmflabs.org/proxy/wdqs/bigdata/namespace/wdq/sparql"] style s1 stroke-width:4px; f3[["?charnumber2 - ?charnumber1 = '100^^xsd:integer'"]] f3 --> v7 f3 --> v8 v9 --http://sciencesource.wmflabs.org/prop/direct/P16--> c11 v9 --http://sciencesource.wmflabs.org/prop/direct/P2--> v5 v9 --http://sciencesource.wmflabs.org/prop/direct/P3--> c14 v10 --http://sciencesource.wmflabs.org/prop/direct/P16--> c15 v10 --http://sciencesource.wmflabs.org/prop/direct/P2--> v6 v10 --http://sciencesource.wmflabs.org/prop/direct/P3--> c14 v9 --http://sciencesource.wmflabs.org/prop/direct/P19--> v11 v10 --http://sciencesource.wmflabs.org/prop/direct/P19--> v12 v11 --http://sciencesource.wmflabs.org/prop/direct/P12--> v13 v11 --http://sciencesource.wmflabs.org/prop/direct/P3--> c18 v12 --http://sciencesource.wmflabs.org/prop/direct/P12--> v13 v12 --http://sciencesource.wmflabs.org/prop/direct/P3--> c18 v13 --http://sciencesource.wmflabs.org/prop/direct/P3--> c19 v11 --http://sciencesource.wmflabs.org/prop/direct/P10--> v8 v12 --http://sciencesource.wmflabs.org/prop/direct/P10--> v7 end