query-e2767496407b708e57095463c3a68e4a
find items that are instances of severe weather
that may or may not have dates which could come either from a point in time or a start time property
SELECT DISTINCT ?item ?itemLabel ?date WHERE { #not sure why adding this initial pattern changes number of results ?item wdt:P31 ?type. ?type (wdt:P31?/wdt:P279*) wd:Q741507. ?item rdfs:label ?humanLabel.
OPTIONAL { {?item wdt:P585 ?date} UNION {?item wdt:P580 ?date} } 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 wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# find items that are instances of severe weather
# that may or may not have dates which could come either from a point in time or a start time property
SELECT DISTINCT ?item ?itemLabel ?date WHERE {
#not sure why adding this initial pattern changes number of results
?item wdt:P31 ?type.
?type (wdt:P31?/wdt:P279*) wd:Q741507.
?item rdfs:label ?humanLabel.
OPTIONAL {
{?item wdt:P585 ?date}
UNION
{?item wdt:P580 ?date}
}
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("?date"):::projected
v3("?humanLabel")
v1("?item"):::projected
v2("?type")
a1((" "))
c3(["wd:Q741507"]):::iri
c8(["bd:serviceParam"]):::iri
c10(["#91;AUTO_LANGUAGE#93;"]):::literal
c11(["en"]):::literal
v1 --"wdt:P31"--> v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> a1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
end
union0r <== or ==> union0l
end
a1 --"wdt:P279"--> c3
v1 --"rdfs:label"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v1 -."wdt:P580".-> v4
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P585"--> v4
end
union1r <== or ==> union1l
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
c8 --"wikibase:language"--> c11
end