Querying: Difference between revisions

Line 29: Line 29:
=== Duration, start and end dates ===
=== Duration, start and end dates ===
Duration between start and end date of every region with a start date, as well as region type. [https://tinyurl.com/2k8h75bz run]
Duration between start and end date of every region with a start date, as well as region type. [https://tinyurl.com/2k8h75bz run]
PREFIX ogpq: <https://ottgaz.org/prop/qualifier/>


  SELECT ?regionLabel ?statusLabel (YEAR(?starttime) as ?start) (YEAR(?endtime) as ?end) ?duration
  SELECT ?regionLabel ?statusLabel (YEAR(?starttime) as ?start) (YEAR(?endtime) as ?end) ?duration
Line 46: Line 44:
  }
  }
  ORDER BY desc(?duration)
  ORDER BY desc(?duration)
SELECT ?regionLabel ?statusLabel ?starttime ?endtime
WHERE
{
  ?region ogt:P6 og:Q1.
  ?region ogp:P15 ?statement.
  ?statement ogps:P15 ?status.
  ?statement ogpq:P7 ?starttime.
  OPTIONAL{?statement ogpq:P8 ?endtime.}
  OPTIONAL{?statement ogpq:P22 ?endtime.}
   
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
ORDER BY ?starttime


== Federated query with Wikidata ==
== Federated query with Wikidata ==