query-9f52f3e8a6304c0a0d49056e9bd8c0ef
Co-occurrence filtered by the condition "disease term before drug term" SELECT ?articletitle ?disease ?drug ?charnumber1 ?charnumber2 WHERE {?term1 wdt:P19 ?anchor1. ?term2 wdt:P19 ?anchor2. ?term1 wdt:P15 ?disease. ?term2 wdt:P15 ?drug. ?term1 wdt:P16 "infectiousdiseases". ?term2 wdt:P16 "infectiousdiseasesdrugs". ?anchor1 wdt:P10 ?charnumber1. ?anchor2 wdt:P10 ?charnumber2. ?anchor1 wdt:P12 ?article. ?anchor2 wdt:P12 ?article. ?article wdt:P20 ?articletitle. FILTER (?charnumber2 > ?charnumber1) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
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#>
#Co-occurrence filtered by the condition "disease term before drug term"
SELECT ?articletitle ?disease ?drug ?charnumber1 ?charnumber2
WHERE {?term1 wdt:P19 ?anchor1.
?term2 wdt:P19 ?anchor2.
?term1 wdt:P15 ?disease.
?term2 wdt:P15 ?drug.
?term1 wdt:P16 "infectiousdiseases".
?term2 wdt:P16 "infectiousdiseasesdrugs".
?anchor1 wdt:P10 ?charnumber1.
?anchor2 wdt:P10 ?charnumber2.
?anchor1 wdt:P12 ?article.
?anchor2 wdt:P12 ?article.
?article wdt:P20 ?articletitle.
FILTER (?charnumber2 > ?charnumber1)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?anchor1")
v6("?anchor2")
v9("?article")
v10("?articletitle"):::projected
v2("?charnumber1"):::projected
v1("?charnumber2"):::projected
v7("?disease"):::projected
v8("?drug"):::projected
v3("?term1")
v5("?term2")
c10(["bd:serviceParam"]):::iri
c4(["infectiousdiseases"]):::literal
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c5(["infectiousdiseasesdrugs"]):::literal
f0[["?charnumber2 > ?charnumber1"]]
f0 --> v1
f0 --> v2
v3 --"wdt:P19"--> v4
v5 --"wdt:P19"--> v6
v3 --"wdt:P15"--> v7
v5 --"wdt:P15"--> v8
v3 --"wdt:P16"--> c4
v5 --"wdt:P16"--> c5
v4 --"wdt:P10"--> v2
v6 --"wdt:P10"--> v1
v4 --"wdt:P12"--> v9
v6 --"wdt:P12"--> v9
v9 --"wdt:P20"--> v10
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end