query-d4c00d5430f07f874735be1d743fb450

rq turtle/ttl

Show the first 25 items from the delete log from before 7 Jan 2021 19:03:00 SELECT ?num ?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 "07 Jan 2021 19:03: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" .
?num wikibase:apiOrdinal true .

} OPTIONAL { ?item wikibase:statements ?statements . ?item wikibase:sitelinks ?sitelinks .
} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY ?num

Use at

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 7 Jan 2021 19:03:00
SELECT ?num ?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 "07 Jan 2021 19:03: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" .
    ?num wikibase:apiOrdinal true .
  }
  OPTIONAL
  {
    ?item wikibase:statements ?statements .
    ?item wikibase:sitelinks ?sitelinks .    
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
ORDER BY ?num

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?delete_comment"):::projected v3("?delete_timestamp"):::projected v5("?delete_user"):::projected v2("?item"):::projected v1("?num"):::projected v7("?sitelinks"):::projected v6("?statements"):::projected c21(["24"]):::literal c25(["//api/query/logevents/item/@timestamp"]):::literal c18(["07 Jan 2021 19:03: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 c29(["true^^xsd:boolean"]):::literal c34(["#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 v2 --"mwapi:apiOutputItem"--> c23 v3 --"mwapi:apiOutput"--> c25 v4 --"mwapi:apiOutput"--> c26 v5 --"mwapi:apiOutput"--> c27 v1 --"mwapi:apiOrdinal"--> c29 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."mwapi:statements".-> v6 v2 --"mwapi:sitelinks"--> v7 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c2 --"mwapi:language"--> c34 end