query-ce89a08efa6a86556ca70b1c78591e50
Biological Parents. The following query should do, but times out: (Q66363468)non-biological parent qualifier marking the relationship as (some subclass of) (P1039)kinship to subject a without statements (P25)mother and (P22)father I am trying to get items together with their biological parents, i.e. the values of
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/>
SELECT DISTINCT ?child ?father ?mother
WHERE
{
?child p:P22 ?fatherProperty;
p:P25 ?motherProperty.
?fatherProperty a wikibase:BestRank;
ps:P22 ?father.
?motherProperty a wikibase:BestRank;
ps:P25 ?mother.
OPTIONAL
{
?fatherProperty pq:P1039 ?fatherKinship.
?fatherKinship wdt:P279* wd:Q66363468.
}
FILTER(!BOUND(?fatherKinship))
OPTIONAL
{
?motherProperty pq:P1039 ?motherKinship.
?motherKinship wdt:P279* wd:Q66363468.
}
FILTER(!BOUND(?motherKinship))
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?child"):::projected
v6("?father"):::projected
v2("?fatherKinship")
v4("?fatherProperty")
v7("?mother"):::projected
v1("?motherKinship")
v5("?motherProperty")
c9(["wd:Q66363468"]):::iri
c4(["wikibase:BestRank"]):::iri
f0[["not bound(?motherKinship)"]]
f0 --> v1
f1[["not bound(?fatherKinship)"]]
f1 --> v2
v3 --"p:P22"--> v4
v3 --"p:P25"--> v5
v4 --"a"--> c4
v4 --"p:statement/P22"--> v6
v5 --"a"--> c4
v5 --"p:statement/P25"--> v7
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P1039".-> v2
v2 --"p:direct/P279"--> c9
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P1039".-> v1
v1 --"p:direct/P279"--> c9
end