A set of SPARQL examples that are used in LOTUS
References dates (CASCADE query).
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#title: CASCADE query.
SELECT DISTINCT ?structure ?structureLabel ?structure_id ?structureSmiles ?taxaLabels ?taxa ?referencesLabels ?references_ids ?references WHERE {
VALUES ?taxon_id { wd:Q158572 }
VALUES ?date_start { 0 }
VALUES ?date_end { 9999 }
?taxa (wdt:P171*) ?taxon_id;
wdt:P225 ?taxaLabels.
?structure wdt:P235 ?structure_id;
wdt:P233 ?structureSmiles;
p:P703 ?statement.
?statement ps:P703 ?taxa;
prov:wasDerivedFrom ?ref.
?ref pr:P248 ?references.
SERVICE <https://query-scholarly.wikidata.org/sparql> {
?references wdt:P1476 ?referencesLabels;
wdt:P356 ?references_ids;
wdt:P577 ?art_date.
}
FILTER(((YEAR(?art_date)) >= ?date_start ) && ((YEAR(?art_date)) <= ?date_end ))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], mul, en". }
}
LIMIT 1000000
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?art_date")
v5("?date_end")
v5("?date_start")
v11("?ref")
v12("?references"):::projected
v13("?referencesLabels"):::projected
v14("?references_ids"):::projected
v10("?statement")
v7("?structure"):::projected
v9("?structureSmiles"):::projected
v8("?structure_id"):::projected
v5("?taxa"):::projected
v6("?taxaLabels"):::projected
v4("?taxon_id")
c14([http://www.bigdata.com/rdf#serviceParam]):::iri
c16(["#91;AUTO_LANGUAGE#93;, mul, en"]):::literal
f0[["year-from-dateTime(?art_date) >= ?date_startyear-from-dateTime(?art_date) <= ?date_end"]]
f0 --> v1
f0 --> v5
f0 --> v5
bind1[/VALUES ?taxon_id/]
bind1-->v4
bind10(["wd:Q158572"])
bind10 --> bind1
bind2[/VALUES ?date_start/]
bind2-->v5
bind20(["0^^xsd:integer"])
bind20 --> bind2
bind3[/VALUES ?date_end/]
bind3-->v5
bind30(["9999^^xsd:integer"])
bind30 --> bind3
v5 --"p:direct/P171"--> v4
v5 --"p:direct/P225"--> v6
v7 --"p:direct/P235"--> v8
v7 --"p:direct/P233"--> v9
v7 --"p:P703"--> v10
v10 --"p:statement/P703"--> v5
v10 --"prov:wasDerivedFrom"--> v11
v11 --"p:reference/P248"--> v12
subgraph s1["https://query-scholarly.wikidata.org/sparql"]
style s1 stroke-width:4px;
v12 --"p:direct/P1476"--> v13
v12 --"p:direct/P356"--> v14
v12 --"p:direct/P577"--> v1
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c14 --"wikibase:language"--> c16
end