query-a5880e9113fcad9979bd388dfd8cb2e9
Calendar of birthdays of women who studied at Oxford
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 schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?monthLabel (?day_int as ?d) ?personLabel ?personDesc
(URI(CONCAT("https://tools.wmflabs.org/reasonator/?q=", STRAFTER(STR(?rperson),"entity/") )) as ?link) WHERE {
{ SELECT ?month_int ?month ?day_int (SAMPLE(?person) AS ?rperson) WHERE {
?month wdt:P31 wd:Q47018901; wdt:P1545 ?month_ordinal. # These lines generate a calendar from January 1 to December 31
?day p:P361 [ps:P361 ?month; pq:P1545 ?day_ordinal ].
BIND(xsd:integer(?month_ordinal) AS ?month_int)
BIND(xsd:integer(?day_ordinal) AS ?day_int)
OPTIONAL {
# Define the people we're interested in
{?person wdt:P69 wd:Q34433 } UNION {?person wdt:P69/wdt:P31 wd:Q2581649 } # educated at Oxford or an Oxford college
?person wdt:P21 wd:Q6581072 ; # female
p:P569/psv:P569 ?date_node. # birth date
?date_node wikibase:timePrecision "11"^^xsd:integer ; # birth date has specific day
wikibase:timeValue ?birthdate .
filter(DAY(?birthdate)=?day_int) filter (MONTH(?birthdate)=?month_int )
}
} GROUP BY ?month_int ?month ?day_int }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?rperson rdfs:label ?personLabel. ?rperson schema:description ?personDesc. ?month rdfs:label ?monthLabel }
} ORDER BY ?month_int ?day_int
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?birthdate")
v14("?d")
v9("?date_node")
v7("?day")
v8("?day_int"):::projected
v6("?day_ordinal")
v15("?link")
v4("?month")
v13("?monthLabel"):::projected
v8("?month_int")
v5("?month_ordinal")
v8("?person")
v12("?personDesc"):::projected
v11("?personLabel"):::projected
v10("?rperson"):::projected
a1((" "))
a2((" "))
a3((" "))
c15(["11^^xsd:integer"]):::literal
c11(["wd:Q6581072"]):::iri
c18(["bd:serviceParam"]):::iri
c2(["wd:Q47018901"]):::iri
c20(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c8(["wd:Q34433"]):::iri
c9(["wd:Q2581649"]):::iri
v4 --"p:direct/P31"--> c2
v4 --"p:direct/P1545"--> v5
a1 --"p:statement/P361"--> v4
a1 --"p:qualifier/P1545"--> v6
v7 --"p:P361"--> a1
bind0[/"http://www.w3.org/2001/XMLSchema#integer(?month_ordinal)"/]
v5 --o bind0
bind0 --as--o v8
bind1[/"http://www.w3.org/2001/XMLSchema#integer(?day_ordinal)"/]
v6 --o bind1
bind1 --as--o v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v8 -."p:direct/P69".-> a2
a2 --"p:direct/P31"--> c9
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P69"--> c8
end
union0r <== or ==> union0l
end
v8 --"p:direct/P21"--> c11
v8 --"p:P569"--> a3
a3 --"p:statement/value/P569"--> v9
v9 --"wikibase:timePrecision"--> c15
v9 --"wikibase:timeValue"--> v3
end
bind3[/"sample(?person)"/]
v8 --o bind3
bind3 --as--o v10
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c18 --"wikibase:language"--> c20
v10 --"rdfs:label"--> v11
v10 --"schema:description"--> v12
v4 --"rdfs:label"--> v13
end
bind4[/"?day_int"/]
v8 --o bind4
bind4 --as--o v14
bind5[/"concat('https://tools.wmflabs.org/reasonator/?q=',substring-after(str(?rperson),'entity/'))"/]
v10 --o bind5
bind5 --as--o v15