query-dc66d6bddbdcbb359da42ae89f7227bf
MargaretRDonald
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
?User
(URI(CONCAT("https://en.wikipedia.org/wiki/Special:Contributions/", ?User)) AS ?UserContributions)
?DateFirstEdit ?TotalEdits ?n_enwikiEdits ?n_CommonsEdits ?n_WikidataEdits
(URI(CONCAT("https://en.wikipedia.org/wiki/Special:CentralAuth/", ?User)) AS ?GlobalAccount)
?DateLastEdit
(xsd:dateTime(?DateLastEdit) - xsd:dateTime(?DateFirstEdit) AS ?DaysEditing)
WHERE
{
VALUES ?User { "MargaretRDonald" "Oronsay" "Cuyahoga44" "DrPlantGenomics" }
SERVICE wikibase:mwapi
{
# Get edit counts from globaluserinfo API call.
# Best supported service is Generator. We don't need or use the generator output,
# but can construct the API call to also include the meta=globaluserinfo info
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam mwapi:generator "random" . # This generator doesn't make much output, and doesn't require additional parameters
# What we really want here:
bd:serviceParam mwapi:meta "globaluserinfo" .
bd:serviceParam mwapi:guiuser ?User .
bd:serviceParam mwapi:guiprop "merged|editcount" .
# XPath expressions to extract the results:
?TotalEdits wikibase:apiOutput "/api/query/globaluserinfo/@editcount" .
?n_enwikiEdits wikibase:apiOutput "/api/query/globaluserinfo/merged/account[@wiki='enwiki']/@editcount" .
?n_CommonsEdits wikibase:apiOutput "/api/query/globaluserinfo/merged/account[@wiki='commonswiki']/@editcount" .
?n_WikidataEdits wikibase:apiOutput "/api/query/globaluserinfo/merged/account[@wiki='wikidatawiki']/@editcount" .
bd:serviceParam wikibase:limit "once" .
}
SERVICE wikibase:mwapi
{
# Get dates for first edit at enwiki using the usercontribs API call.
# Best supported service is Generator. We don't need or use the generator output,
# but can construct the API call to also include the list=usercontribs info
bd:serviceParam wikibase:endpoint "en.wikipedia.org" .
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam mwapi:generator "random" . # This generator doesn't make much output, and doesn't require additional parameters
# What we really want here:
bd:serviceParam mwapi:list "usercontribs" .
bd:serviceParam mwapi:ucuser ?User .
bd:serviceParam mwapi:ucdir "newer" . # Start with oldest edit
bd:serviceParam mwapi:ucprop "timestamp" . # Get timestamp
bd:serviceParam mwapi:uclimit "1" .
# XPath expressions to extract the result:
?DateFirstEdit wikibase:apiOutput "/api/query/usercontribs/item/@timestamp" .
bd:serviceParam wikibase:limit "once" .
}
SERVICE wikibase:mwapi
{
# Get dates for last at enwiki using the usercontribs API call.
# Best supported service is Generator. We don't need or use the generator output,
# but can construct the API call to also include the list=usercontribs info
bd:serviceParam wikibase:endpoint "en.wikipedia.org" .
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam mwapi:generator "random" . # This generator doesn't make much output, and doesn't require additional parameters
# What we really want here:
bd:serviceParam mwapi:list "usercontribs" .
bd:serviceParam mwapi:ucuser ?User .
bd:serviceParam mwapi:ucdir "older" . # Start with newest edit
bd:serviceParam mwapi:ucprop "timestamp" . # Get timestamp
bd:serviceParam mwapi:uclimit "1" .
# XPath expressions to extract the result:
?DateLastEdit wikibase:apiOutput "/api/query/usercontribs/item/@timestamp" .
bd:serviceParam wikibase:limit "once" .
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?DateFirstEdit"):::projected
v7("?DateLastEdit"):::projected
v10("?DaysEditing")
v9("?GlobalAccount")
v2("?TotalEdits"):::projected
v1("?User"):::projected
v8("?UserContributions")
v4("?n_CommonsEdits"):::projected
v5("?n_WikidataEdits"):::projected
v3("?n_enwikiEdits"):::projected
c23(["usercontribs"]):::literal
c8(["random"]):::literal
c21(["en.wikipedia.org"]):::literal
c2(["bd:serviceParam"]):::iri
c13(["merged|editcount"]):::literal
c31(["/api/query/usercontribs/item/@timestamp"]):::literal
c18(["/api/query/globaluserinfo/merged/account#91;@wiki='wikidatawiki'#93;/@editcount"]):::literal
c32(["older"]):::literal
c28(["timestamp"]):::literal
c4(["www.wikidata.org"]):::literal
c10(["globaluserinfo"]):::literal
c26(["newer"]):::literal
c30(["1"]):::literal
c17(["/api/query/globaluserinfo/merged/account#91;@wiki='commonswiki'#93;/@editcount"]):::literal
c15(["/api/query/globaluserinfo/@editcount"]):::literal
c20(["once"]):::literal
c16(["/api/query/globaluserinfo/merged/account#91;@wiki='enwiki'#93;/@editcount"]):::literal
c6(["Generator"]):::literal
bind0[/VALUES ?User/]
bind0-->v1
bind00(["MargaretRDonald"])
bind00 --> bind0
bind01(["Oronsay"])
bind01 --> bind0
bind02(["Cuyahoga44"])
bind02 --> bind0
bind03(["DrPlantGenomics"])
bind03 --> bind0
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:meta"--> c10
c2 --"mwapi:guiuser"--> v1
c2 --"mwapi:guiprop"--> c13
v2 --"mwapi:apiOutput"--> c15
v3 --"mwapi:apiOutput"--> c16
v4 --"mwapi:apiOutput"--> c17
v5 --"mwapi:apiOutput"--> c18
c2 --"mwapi:limit"--> c20
end
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:endpoint"--> c21
c2 --"mwapi:api"--> c6
c2 --"mwapi:generator"--> c8
c2 --"mwapi:list"--> c23
c2 --"mwapi:ucuser"--> v1
c2 --"mwapi:ucdir"--> c26
c2 --"mwapi:ucprop"--> c28
c2 --"mwapi:uclimit"--> c30
v6 --"mwapi:apiOutput"--> c31
c2 --"mwapi:limit"--> c20
end
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:endpoint"--> c21
c2 --"mwapi:api"--> c6
c2 --"mwapi:generator"--> c8
c2 --"mwapi:list"--> c23
c2 --"mwapi:ucuser"--> v1
c2 --"mwapi:ucdir"--> c32
c2 --"mwapi:ucprop"--> c28
c2 --"mwapi:uclimit"--> c30
v7 --"mwapi:apiOutput"--> c31
c2 --"mwapi:limit"--> c20
end
bind1[/"concat('https://en.wikipedia.org/wiki/Special:Contributions/',?User)"/]
v1 --o bind1
bind1 --as--o v8
bind2[/"concat('https://en.wikipedia.org/wiki/Special:CentralAuth/',?User)"/]
v1 --o bind2
bind2 --as--o v9
bind3[/"http://www.w3.org/2001/XMLSchema#dateTime(?DateLastEdit) - http://www.w3.org/2001/XMLSchema#dateTime(?DateFirstEdit)"/]
v7 --o bind3
v6 --o bind3
bind3 --as--o v10