query-60f60b4e788b26c6f52f0eea32dc8ed3
Propertiesspouse (P26)height (P2048)start time (P580)end time (P582)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?spouse ?spouseLabel ?start ?end ?days #?spouse_height
{
?spouse p:P26 ?spouse_statement .
# ?spouse p:P2048/psn:P2048/wikibase:quantityAmount ?spouse_height .
?spouse_statement pq:P580 ?start .
OPTIONAL { ?spouse_statement pq:P582 ?x }
bind(if(bound(?x), ?x, NOW()) as ?end )
bind(floor(?end - ?start) as ?days)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
FILTER (?days > 0) .
}
ORDER BY ?days ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?days"):::projected
v7("?end"):::projected
v2("?itemLabel")
v3("?spouse"):::projected
v4("?spouse_statement")
v5("?start"):::projected
v6("?x")
c6(["bd:serviceParam"]):::iri
c8(["en"]):::literal
f0[["?days > '0^^xsd:integer'"]]
f0 --> v8
v3 --"p:P26"--> v4
v4 --"p:qualifier/P580"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P582".-> v6
end
bind1[/"if(bound(?x),?x,NOW())"/]
v6 --o bind1
bind1 --as--o v7
bind2[/"numeric-floor(?end - ?start)"/]
v7 --o bind2
v5 --o bind2
bind2 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end