query-c985985b40264385177ce4a5d0983bad

rq turtle/ttl

title:Birth date referenced, only one having best rank, with precision year or higher and possible precision qualifiers SELECT ?id ?person ?date ?prec ?source_condLabel ?refineLabel ?low_limit ?high_limit WHERE { ?person wdt:P5739 ?id . ?person p:P569 ?st . ?st prov:wasDerivedFrom ?ref ; a wikibase:BestRank ; psv:P569 [ wikibase:timePrecision ?prec ; wikibase:timeValue ?date ] . OPTIONAL { ?st pq:P1480 ?source_cond } . OPTIONAL { ?st pq:P4241 ?refine } . OPTIONAL { ?st pq:P1319 ?low_limit } . OPTIONAL { ?st pq:P1326 ?high_limit } . FILTER NOT EXISTS { ?person p:P569 ?st2 . ?st2 a wikibase:BestRank . FILTER( ?st2 != ?st ) } FILTER(?prec IN ("9"^^xsd:integer, "10"^^xsd:integer, "11"^^xsd:integer)) SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ?date

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Birth date referenced, only one having best rank, with precision year or higher and possible precision qualifiers
SELECT ?id ?person ?date ?prec ?source_condLabel ?refineLabel ?low_limit ?high_limit
WHERE {
  ?person wdt:P5739 ?id .
  ?person p:P569 ?st . ?st prov:wasDerivedFrom ?ref ; a wikibase:BestRank ; psv:P569 [ wikibase:timePrecision ?prec ; wikibase:timeValue ?date ] .
  OPTIONAL { ?st pq:P1480 ?source_cond } .
  OPTIONAL { ?st pq:P4241 ?refine } .
  OPTIONAL { ?st pq:P1319 ?low_limit } .
  OPTIONAL { ?st pq:P1326 ?high_limit } .
  FILTER NOT EXISTS { ?person p:P569 ?st2 . ?st2 a wikibase:BestRank . FILTER( ?st2 != ?st ) }
  FILTER(?prec IN ("9"^^xsd:integer, "10"^^xsd:integer, "11"^^xsd:integer))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?date

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?date"):::projected v11("?high_limit"):::projected v6("?id"):::projected v10("?low_limit"):::projected v5("?person"):::projected v2("?prec"):::projected v7("?ref") v9("?refine") v8("?source_cond") v4("?st") v3("?st2") a1((" ")) c6(["wikibase:BestRank"]):::iri c19(["en"]):::literal c17(["bd:serviceParam"]):::iri list0c3(["11^^xsd:integer"]):::literal list0c1(["9^^xsd:integer"]):::literal list0c2(["10^^xsd:integer"]):::literal list0c1 --o f0 list0c2 --o f0 list0c3 --o f0 f0[[" in "]] f0 --> v2 f1[["not "]] subgraph f1e1["Exists Clause"] e1f0[["?st2 != ?st"]] e1f0 --> e1v1 e1f0 --> e1v2 e1v3 --"p:P569"--> e1v1 e1v1 --"a"--> e1c3 e1v3("?person"):::projected e1v2("?st"):::projected e1v1("?st2"):::projected e1c3(["wikibase:BestRank"]):::iri end f1--EXISTS--> f1e1 f1 --> v3 f1 --> v4 f1 --> v5 f1 --> c4 f1 --> c5 f1 --> c6 f2[["?st2 != ?st"]] f2 --> v3 f2 --> v4 v5 --"p:P569"--> v3 v3 --"a"--> c6 v5 --"p:direct/P5739"--> v6 v5 --"p:P569"--> v4 v4 --"prov:wasDerivedFrom"--> v7 v4 --"a"--> c6 a1 --"wikibase:timePrecision"--> v2 a1 --"wikibase:timeValue"--> v1 v4 --"p:statement/value/P569"--> a1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P1480".-> v8 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P4241".-> v9 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P1319".-> v10 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P1326".-> v11 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c17 --"wikibase:language"--> c19 end