query-9dac2f919406ab0be7e1db9294666e1e
Show the first 25 items from the delete log from before 1 Feb 2021 00:00:00 SELECT ?item ?itemLabel ?statements ?sitelinks ?delete_user ?delete_timestamp ?delete_comment WHERE { SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org" .
# There is no "list" option for wikibase:api, but it is possible to combine
# a list and a generator in the same API call of type "action=query"
bd:serviceParam wikibase:api "Generator" . 
bd:serviceParam mwapi:generator "allpages" .
bd:serviceParam mwapi:gaplimit "1" .
# Get items from the delete log
bd:serviceParam mwapi:list "logevents" .
bd:serviceParam mwapi:letype "delete" .
bd:serviceParam mwapi:lenamespace "0" .
bd:serviceParam mwapi:lestart "01 Feb 2021 00:00:00" .
bd:serviceParam mwapi:lelimit "1" .
# It is not efficient, but as MWAPI consider this an "allpages" generator call, we can only get one item per call 
bd:serviceParam wikibase:limitContinuations "24". # Get 24 continuations for a total of 25 deleted items
# Output variables for the logevents list
?item wikibase:apiOutputItem "//api/query/logevents/item/@title" .
?delete_timestamp wikibase:apiOutput "//api/query/logevents/item/@timestamp" .
?delete_comment wikibase:apiOutput "//api/query/logevents/item/@comment" .
?delete_user wikibase:apiOutput "//api/query/logevents/item/@user" .
}
  OPTIONAL
  {
    ?item wikibase:statements ?statements .
    ?item wikibase:sitelinks ?sitelinks .  
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
Use at
- https://query.wikidata.org/sparql
 
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Show the first 25 items from the delete log from before 1 Feb 2021 00:00:00
SELECT ?item ?itemLabel ?statements ?sitelinks ?delete_user ?delete_timestamp ?delete_comment
WHERE
{
  SERVICE wikibase:mwapi
  {
    bd:serviceParam wikibase:endpoint "www.wikidata.org" .
    # There is no "list" option for wikibase:api, but it is possible to combine
    # a list and a generator in the same API call of type "action=query"
    bd:serviceParam wikibase:api "Generator" . 
    bd:serviceParam mwapi:generator "allpages" .
    bd:serviceParam mwapi:gaplimit "1" .
    # Get items from the delete log
    bd:serviceParam mwapi:list "logevents" .
    bd:serviceParam mwapi:letype "delete" .
    bd:serviceParam mwapi:lenamespace "0" .
    bd:serviceParam mwapi:lestart "01 Feb 2021 00:00:00" .
    bd:serviceParam mwapi:lelimit "1" .
    # It is not efficient, but as MWAPI consider this an "allpages" generator call, we can only get one item per call 
    bd:serviceParam wikibase:limitContinuations "24". # Get 24 continuations for a total of 25 deleted items
    # Output variables for the logevents list
    ?item wikibase:apiOutputItem "//api/query/logevents/item/@title" .
    ?delete_timestamp wikibase:apiOutput "//api/query/logevents/item/@timestamp" .
    ?delete_comment wikibase:apiOutput "//api/query/logevents/item/@comment" .
    ?delete_user wikibase:apiOutput "//api/query/logevents/item/@user" .
  }
  OPTIONAL
  {
    ?item wikibase:statements ?statements .
    ?item wikibase:sitelinks ?sitelinks .    
  }
  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("?delete_comment"):::projected 
  v2("?delete_timestamp"):::projected 
  v4("?delete_user"):::projected 
  v1("?item"):::projected 
  v6("?sitelinks"):::projected 
  v5("?statements"):::projected 
  c21(["24"]):::literal 
  c25(["//api/query/logevents/item/@timestamp"]):::literal 
  c18(["01 Feb 2021 00:00:00"]):::literal 
  c14(["delete"]):::literal 
  c2(["bd:serviceParam"]):::iri 
  c8(["allpages"]):::literal 
  c26(["//api/query/logevents/item/@comment"]):::literal 
  c4(["www.wikidata.org"]):::literal 
  c23(["//api/query/logevents/item/@title"]):::literal 
  c16(["0"]):::literal 
  c10(["1"]):::literal 
  c12(["logevents"]):::literal 
  c32(["#91;AUTO_LANGUAGE#93;,en"]):::literal 
  c27(["//api/query/logevents/item/@user"]):::literal 
  c6(["Generator"]):::literal 
  subgraph s1["http://wikiba.se/ontology#mwapi"]
    style s1 stroke-width:4px;
    c2 --"mwapi:endpoint"-->  c4
    c2 --"mwapi:api"-->  c6
    c2 --"mwapi:generator"-->  c8
    c2 --"mwapi:gaplimit"-->  c10
    c2 --"mwapi:list"-->  c12
    c2 --"mwapi:letype"-->  c14
    c2 --"mwapi:lenamespace"-->  c16
    c2 --"mwapi:lestart"-->  c18
    c2 --"mwapi:lelimit"-->  c10
    c2 --"mwapi:limitContinuations"-->  c21
    v1 --"mwapi:apiOutputItem"-->  c23
    v2 --"mwapi:apiOutput"-->  c25
    v3 --"mwapi:apiOutput"-->  c26
    v4 --"mwapi:apiOutput"-->  c27
  end
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."mwapi:statements".->  v5
    v1 --"mwapi:sitelinks"-->  v6
  end
  subgraph s2["http://wikiba.se/ontology#label"]
    style s2 stroke-width:4px;
    c2 --"mwapi:language"-->  c32
  end