query-97ba918028a19debacefa39b0f242d86
15:27, 26 February 2018 (UTC)) talk (Doc Taxon is "1988", but with this query I get "Jan 1, 1988". If there is not defined a day or month, then I want to get back the year only. How can I optimize the query above? (P569)date of birth The value of (Q16866748)Esther Mbabazi Hi! With this query I get some dates of birth like "Jan 1", e.g.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?women ?womenLabel ?date_of_birth ?precision WHERE {
?women wdt:P31 wd:Q5.
?women wdt:P21 wd:Q6581072.
?women wdt:P27 wd:Q967.
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". }
OPTIONAL { ?women p:P569/psv:P569 [ wikibase:timeValue ?date_of_birth; wikibase:timePrecision ?precision ] }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?date_of_birth"):::projected
v3("?precision"):::projected
v1("?women"):::projected
a2((" "))
a1((" "))
c4(["wd:Q6581072"]):::iri
c8(["bd:serviceParam"]):::iri
c6(["wd:Q967"]):::iri
c2(["wd:Q5"]):::iri
c10(["fr,en"]):::literal
v1 --"p:direct/P31"--> c2
v1 --"p:direct/P21"--> c4
v1 --"p:direct/P27"--> c6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
a1 -."wikibase:timeValue".-> v2
a1 --"wikibase:timePrecision"--> v3
v1 --"p:P569"--> a2
a2 --"p:statement/value/P569"--> a1
end