query-feb4205298bf7675ad7a7d975b0cada8
Speakers of Odia that are married to each other SELECT ?item1 ?item1Label ?item2 ?item2Label ?year ?placeLabel WHERE { ?item1 wdt:P1412 wd:Q33810; p:P26 ?statement . ?statement ps:P26 ?item2 . ?item2 wdt:P1412 wd:Q33810 . FILTER( STR( ?item1 ) > STR( ?item2 ) ) . # Result differs if '<' is used in place of '>' as on 13 MAY 2020 OPTIONAL {?statement pq:P580 ?date . BIND( YEAR( ?date ) AS ?year ) . } . OPTIONAL { ?statement pq:P2842 ?place } . SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE], or, en' } } ORDER BY ASC(?item1Label)
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 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#>
# Speakers of Odia that are married to each other
SELECT ?item1 ?item1Label ?item2 ?item2Label ?year ?placeLabel
WHERE {
?item1 wdt:P1412 wd:Q33810;
p:P26 ?statement .
?statement ps:P26 ?item2 .
?item2 wdt:P1412 wd:Q33810 .
FILTER( STR( ?item1 ) > STR( ?item2 ) ) . # Result differs if '<' is used in place of '>' as on 13 MAY 2020
OPTIONAL {?statement pq:P580 ?date .
BIND( YEAR( ?date ) AS ?year ) . } .
OPTIONAL { ?statement pq:P2842 ?place } .
SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE], or, en' }
}
ORDER BY ASC(?item1Label)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?date")
v2("?item1"):::projected
v1("?item1Label"):::projected
v3("?item2"):::projected
v7("?place")
v4("?statement")
v6("?year"):::projected
c10(["#91;AUTO_LANGUAGE#93;, or, en"]):::literal
c8(["bd:serviceParam"]):::iri
c2(["wd:Q33810"]):::iri
f0[["str(?item1) > str(?item2)"]]
f0 --> v2
f0 --> v3
v2 --"p:direct/P1412"--> c2
v2 --"p:P26"--> v4
v4 --"p:statement/P26"--> v3
v3 --"p:direct/P1412"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P580".-> v5
bind1[/"year-from-dateTime(?date)"/]
v5 --o bind1
bind1 --as--o v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P2842".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end