query-2e745ed38219137c6e36f48305ab6722
I came up with the query below. Unfortunately it’s a bit too expensive and my attempts to include the labels of the items have all made the query timeout.Divudi85@
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 bd: <http://www.bigdata.com/rdf#>
#defaultView:Graph
select ?person ?linkedPerson ?type ?personLabel (?type as ?edgeLabel) {
?person wdt:P937 wd:Q641.
?person wdt:P2032 ?datafine
{
?person wdt:P1327 ?linkedPerson .
bind("business partner" as ?type)
} union {
?person wdt:P22 ?linkedPerson .
bind("father" as ?type)
} union {
?person wdt:P23 ?linkedPerson .
bind("mother" as ?type)
} union {
?person wdt:P40 ?linkedPerson .
bind("son" as ?type)
} union {
?person wdt:P26 ?linkedPerson .
bind("partner" as ?type)
}
FILTER ("1850-01-01"^^xsd:date > ?datafine)
SERVICE wikibase:label { bd:serviceParam wikibase:language "it,en" . }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?datafine")
v5("?edgeLabel")
v3("?linkedPerson"):::projected
v2("?person"):::projected
v5("?type"):::projected
c3(["wd:Q641"]):::iri
c11(["bd:serviceParam"]):::iri
c13(["it,en"]):::literal
f0[["'1850-01-01^^xsd:date' > ?datafine"]]
f0 --> v1
v2 --"wdt:P937"--> c3
v2 --"wdt:P2032"--> v1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P26"--> v3
bind1[/"'partner'"/]
bind1 --as--o v5
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P40"--> v3
bind2[/"'son'"/]
bind2 --as--o v5
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P23"--> v3
bind3[/"'mother'"/]
bind3 --as--o v5
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P22"--> v3
bind4[/"'father'"/]
bind4 --as--o v5
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P1327"--> v3
bind5[/"'business partner'"/]
bind5 --as--o v5
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end
bind6[/"?type"/]
v5 --o bind6
bind6 --as--o v5