query-262e1276d6d36b927af2464089508003
Now I would need two further readapaptations: include not only people born in 1950, but all people born in years ending with 50 (e.g. 450 BCE, 50 BCE, 50 AD, 150 AD, 1450 AD ...) - I don't know how to do this, could you help me? - I think it suffices removing the last FILTER(P854)reference URL include all the dates of birth having at least a reference containing ]reply[08:43, 8 June 2020 (UTC) dosisEpìThank you very much as always, --Here is a query for all years ending in 50. I also added the precision for the date (11=date, 10=month, 9=year, 8=decade, 7=century). The list still is a sample because of the limit of results for use of MWAPI.
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?p ?db ?precision
WHERE
{
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam mwapi:generator "exturlusage" .
bd:serviceParam mwapi:geuprop "title" .
bd:serviceParam mwapi:geunamespace "0" .
bd:serviceParam mwapi:geuprotocol "https" .
bd:serviceParam mwapi:geuquery "viaf.org/viaf/" .
bd:serviceParam mwapi:geulimit "max" .
?p wikibase:apiOutputItem mwapi:title .
}
?p p:P569 [psv:P569 ?dbv ; prov:wasDerivedFrom [pr:P854 ?site] ].
FILTER CONTAINS(STR(?site),"viaf.org/viaf/")
?dbv wikibase:timeValue ?db; wikibase:timePrecision ?precision.
BIND (YEAR(?db) AS ?year)
FILTER IF(?year > 0,
?year - FLOOR(?year / 100) * 100 = 50, # year is AD
?year - FLOOR(?year / 100) * 100 = 51) # year is BC, 1 BC is encoded as "0", 2 BC as "-1" etc.
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?db"):::projected
v4("?dbv")
v3("?p"):::projected
v6("?precision"):::projected
v2("?site")
v7("?year")
a1((" "))
a2((" "))
c5(["viaf.org/viaf/"]):::literal
c15(["title"]):::literal
c7(["bd:serviceParam"]):::iri
c19(["https"]):::literal
c9(["www.wikidata.org"]):::literal
c22(["max"]):::literal
c17(["0"]):::literal
c13(["exturlusage"]):::literal
c24(["mwapi:title"]):::iri
c11(["Generator"]):::literal
f0[["if(?year > '0^^xsd:integer',?year - numeric-floor(?year / '100^^xsd:integer') * '100^^xsd:integer' = '50^^xsd:integer',?year - numeric-floor(?year / '100^^xsd:integer') * '100^^xsd:integer' = '51^^xsd:integer')"]]
f0 --> v7
f1[["contains(str(?site),'viaf.org/viaf/')"]]
f1 --> v2
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c7 --"mwapi:endpoint"--> c9
c7 --"mwapi:api"--> c11
c7 --"mwapi:generator"--> c13
c7 --"mwapi:geuprop"--> c15
c7 --"mwapi:geunamespace"--> c17
c7 --"mwapi:geuprotocol"--> c19
c7 --"mwapi:geuquery"--> c5
c7 --"mwapi:geulimit"--> c22
v3 --"mwapi:apiOutputItem"--> c24
end
a1 --"p:statement/value/P569"--> v4
a2 --"p:reference/P854"--> v2
a1 --"prov:wasDerivedFrom"--> a2
v3 --"p:P569"--> a1
v4 --"mwapi:timeValue"--> v5
v4 --"mwapi:timePrecision"--> v6
bind2[/"year-from-dateTime(?db)"/]
v5 --o bind2
bind2 --as--o v7