query-67a9eecf411696cd12d9ea532237b7b6

rq turtle/ttl

Find works with a public domain date (P3893) in the calendar year in which the query is run SELECT ?work ?workLabel ?type ?typeLabel ?date ?articles ?now ?then WHERE { ?work p:P3893/psv:P3893 ?date_node . ?date_node wikibase:timeValue ?date . BIND(xsd:dateTime(concat(str(year(now())),"-01-01T00:00:00Z")) as ?now) BIND(xsd:dateTime(concat(str(year(now()+"P1Y"^^xsd:duration)),"-01-01T00:00:00Z")) as ?then)

FILTER( ?date >= "2021-01-01T00:00:00"^^xsd:dateTime && ?date < "2022-01-01T00:00:00"^^xsd:dateTime )

FILTER( ?date >= ?now && ?date < ?then ) ?work wdt:P31 ?type ; wikibase:sitelinks ?articles . SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en,de,it,es,nl" . } }

Order by number or articles on Wikimedia sites

ORDER BY DESC(?articles)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Find works with a public domain date (P3893) in the calendar year in which the query is run
SELECT ?work ?workLabel ?type ?typeLabel ?date ?articles ?now ?then WHERE {
  ?work p:P3893/psv:P3893 ?date_node .
  ?date_node wikibase:timeValue ?date .
  BIND(xsd:dateTime(concat(str(year(now())),"-01-01T00:00:00Z")) as ?now) 
  BIND(xsd:dateTime(concat(str(year(now()+"P1Y"^^xsd:duration)),"-01-01T00:00:00Z")) as ?then) 
#  FILTER( ?date >= "2021-01-01T00:00:00"^^xsd:dateTime && ?date < "2022-01-01T00:00:00"^^xsd:dateTime )
  FILTER( ?date >= ?now && ?date < ?then )
  ?work wdt:P31 ?type ;
           wikibase:sitelinks ?articles .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en,de,it,es,nl" . }
}
# Order by number or articles on Wikimedia sites
ORDER BY DESC(?articles)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?articles"):::projected v2("?date"):::projected v6("?date_node") v7("?now"):::projected v7("?then"):::projected v7("?type"):::projected v5("?work"):::projected a1((" ")) c7(["bd:serviceParam"]):::iri c9(["fr,en,de,it,es,nl"]):::literal f0[["?date >= ?now?date < ?then"]] f0 --> v2 f0 --> v7 f0 --> v7 v5 --"p:P3893"--> a1 a1 --"p:statement/value/P3893"--> v6 v6 --"wikibase:timeValue"--> v2 bind1[/"http://www.w3.org/2001/XMLSchema#dateTime(concat(str(year-from-dateTime(NOW())),'-01-01T00:00:00Z'))"/] bind1 --as--o v7 bind2[/"http://www.w3.org/2001/XMLSchema#dateTime(concat(str(year-from-dateTime(NOW() + 'P1Y^^xsd:duration')),'-01-01T00:00:00Z'))"/] bind2 --as--o v7 v5 --"p:direct/P31"--> v7 v5 --"wikibase:sitelinks"--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end