query-333ece3e910111beccef746258cf493a
find items that are instances of severe weather
without dates which could come either from a point in time or a start time property
but which contain 4-digit number (presumed to be a year) in the item's label in any language
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.
FILTER NOT EXISTS { {?item wdt:P585 ?date} UNION {?item wdt:P580 ?date} } FILTER REGEX(?humanLabel,"[0-9]{4}"). 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
# without dates which could come either from a point in time or a start time property
# but which contain 4-digit number (presumed to be a year) in the item's label in any language
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.
  FILTER NOT EXISTS {
    {?item wdt:P585 ?date}
    UNION
    {?item wdt:P580 ?date}
    }
  FILTER REGEX(?humanLabel,"[0-9]{4}").
  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;
  v3("?date"):::projected 
  v1("?humanLabel")
  v2("?item"):::projected 
  v4("?type")
  a1((" "))
  c6(["wd:Q741507"]):::iri 
  c9(["bd:serviceParam"]):::iri 
  c11(["#91;AUTO_LANGUAGE#93;"]):::literal 
  c12(["en"]):::literal 
  f0[["regex(?humanLabel,'#91;0-9#93;{4}')"]]
  f0 --> v1
  f1[["not  "]]
  subgraph f1e0["Exists Clause"]
    subgraph unione00[" Union "]
    subgraph unione00l[" "]
      style unione00l fill:#abf,stroke-dasharray: 3 3;
      e0v1 --"wdt:P580"-->  e0v2
    end
    subgraph unione00r[" "]
      style unione00r fill:#abf,stroke-dasharray: 3 3;
      e0v1 --"wdt:P585"-->  e0v2
    end
    unione00r <== or ==> unione00l
    end
    e0v2("?date"):::projected 
    e0v1("?item"):::projected 
  end
  f1--EXISTS--> f1e0
  f1 --> v2
  f1 --> c2
  f1 --> v3
  f1 --> c3
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    v2 --"wdt:P580"-->  v3
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v2 --"wdt:P585"-->  v3
  end
  union0r <== or ==> union0l
  end
  v2 --"wdt:P31"-->  v4
  subgraph union1[" Union "]
  subgraph union1l[" "]
    style union1l fill:#abf,stroke-dasharray: 3 3;
    v4 --"wdt:P31"-->  a1
  end
  subgraph union1r[" "]
    style union1r fill:#abf,stroke-dasharray: 3 3;
  end
  union1r <== or ==> union1l
  end
  a1 --"wdt:P279"-->  c6
  v2 --"rdfs:label"-->  v1
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c9 --"wikibase:language"-->  c11
    c9 --"wikibase:language"-->  c12
  end