query-7dc12abd1920ae6a37f9b8deb5fd3472
Items created today?Hi, I want to list the items created within a certain period of time, or the X items created last. I could not figure out if there is a property or a way to query for "item creation date", and came up with a brute force solution, using a sort on the numeric part of the QID:
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?item ?itemLabel
where {
# restrict to some class
?item wdt:P31 wd:Q43501 .
bind(xsd:integer(strafter(str(?item), 'Q')) as ?id)
service wikibase:label { bd:serviceParam wikibase:language "en,de,fr,es,pt,fi,sv,no,lv,nl,pl" .}
}
order by desc(?id )
limit 10
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?id")
v2("?item"):::projected
c4(["bd:serviceParam"]):::iri
c6(["en,de,fr,es,pt,fi,sv,no,lv,nl,pl"]):::literal
c2(["wd:Q43501"]):::iri
v2 --"wdt:P31"--> c2
bind0[/"http://www.w3.org/2001/XMLSchema#integer(substring-after(str(?item),'Q'))"/]
v2 --o bind0
bind0 --as--o v3
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end