Hello I would add that if you're not that fond of the mother/father
properties, you can write the same query based only on the child
property.
SELECT DISTINCT ?item ?itemLabel WHERE {
wd:Q177329 ^wdt:P40* ?item.
SERVICE wikibase:label { bd:serviceParam wikibase:language
"[AUTO_LANGUAGE],en". }
}
And if you want all the descendants of those ancestors you can just add
/wdt:P40*:
SELECT DISTINCT ?item ?itemLabel WHERE {
wd:Q177329 ^wdt:P40*/wdt:P40* ?item.
SERVICE wikibase:label { bd:serviceParam wikibase:language
"[AUTO_LANGUAGE],en". }
}
You can test it here : https://w.wiki/fKe
Now, one of the reasons for keeping Father and Mother separated is that
without them it would be very complicated to write the same query to
retrieve the patrilineal or matrilineal list :
SELECT DISTINCT ?item ?itemLabel WHERE {
wd:Q177329 wdt:P22*/^wdt:P22* ?item.
SERVICE wikibase:label { bd:serviceParam wikibase:language
"[AUTO_LANGUAGE],en". }
}
SELECT DISTINCT ?item ?itemLabel WHERE {
wd:Q177329 wdt:P25*/^wdt:P25* ?item.
SERVICE wikibase:label { bd:serviceParam wikibase:language
"[AUTO_LANGUAGE],en". }
}
JL
On 2020-10-06 00:46, Bruno Belhoste wrote:
Thank you, Lucas, for the solution! It was very simple indeed, but,
shame on me, I confess I did'nt know this fundamental property path.
All the best,
Bruno
Le 05/10/2020 à 21:36, Lucas Werkmeister a écrit :
I don’t understand the problem, the query shouldn’t need to get
much more complicated… what kind of query did you have in mind?
Here’s a simple one for all ancestors of Frodo Baggins [1]:
SELECT DISTINCT ?item ?itemLabel WHERE {
wd:Q177329 (wdt:P22|wdt:P25)* ?item.
SERVICE wikibase:label { bd:serviceParam wikibase:language
"[AUTO_LANGUAGE],en". }
}
Cheers,
Lucas
On 05.10.20 19:10, Bruno Belhoste wrote:
It works well, but it's a descendant tree (the father of Djingis
Khan is not in the tree). My question is how to explore family trees
in the opposite direction, I mean from children to parents, and more
generally to get all the relatives of a given person. The fact that
there are two different properties, one for the child-father link
and one for the child-mother link, makes the query much more
difficult in this case.
Le 05/10/2020 à 15:58, Magnus Sälgö a écrit :
Have you tested gas:traversalDirection below we follow child
gas:traversalDirection "Undirected"
example https://w.wiki/fDz
#People related to Djingis Khan
#defaultView:Graph
PREFIX gas: <http://www.bigdata.com/rdf/gas#> [2]
SELECT ?item ?itemLabel ?pic ?WikiTreef ?FindAGravef ?linkTo {
SERVICE gas:service {
gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.SSSP"
;
gas:in wd:Q720 ;
gas:traversalDirection "Undirected" ;
gas:out ?item ;
gas:out1 ?depth ;
gas:maxIterations 4 ;
gas:linkType wdt:P40 .
}
OPTIONAL { ?item wdt:P40 ?linkTo }
OPTIONAL { ?item wdt:P18 ?pic }
SERVICE wikibase:label {bd:serviceParam wikibase:language "sv" } }
-------------------------
From: Wikidata <[email protected]> on behalf of
Olaf Simons <[email protected]>
Sent: Monday, October 5, 2020 1:53 PM
To: Discussion list for the Wikidata project.
<[email protected]>
Subject: Re: [Wikidata] a question of data modeling about family
ties
Dear Wikidata list,
one of our big contributors, Bruno Belhoste in Paris, just gave me a
weird question which I feel I cannot answer that fast.
We, FactGrid, are a Wikidata child and so it came that we adopted
structures like the father/mother differentiation. Bruno's question
is now whether it would not have been wise to just create just a
"parent" option instead of the gender fork that splits the lineages.
Let me insert his mail:
Dear Olaf,
I have a question of data modeling in FactGrid concerning family
ties.
We have one property for children (P150) and also one for siblings
(P203), but two different properties for parents: father (P141)
and
mother (P142). The problem is: how can you get all the members of
the
family of somebody? One have (1) to explore both the matrilinear
trees
and the patrilinear trees at each generation to get all the
ancestors
and (2) to get all the descents of these ancestors. It is very
complex.
It would be much simpler to have only one property including the
father
and the mother.
In case we choose this solution, it would be easy to transform all
the
triples with P141 or P142 into triples with the new property. What
do
you think about that? Have you another solution for querying
family links?
All the best,
Bruno
I wonder what people with more data knowledge think about the
proposal (which would affect just our site, not Wikidata...) (so: no
worries, we can do experimental things without affecting our parent
- I hesitate to speak of a father or mother - Wikidata).
Best,
Olaf
Dr. Olaf Simons
Forschungszentrum Gotha der Universität Erfurt
Schloss Friedenstein, Pagenhaus
99867 Gotha
Büro: +49-361-737-1722
Mobil: +49-179-5196880
Privat: Hauptmarkt 17b/ 99867 Gotha
_______________________________________________
Wikidata mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata
_______________________________________________
Wikidata mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata
_______________________________________________
Wikidata mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata
_______________________________________________
Wikidata mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata
Links:
------
[1]
https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20WHERE%20%7B%0A%20%20wd%3AQ177329%20%28wdt%3AP22%7Cwdt%3AP25%29%2a%20%3Fitem.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D
[2] http://www.bigdata.com/rdf/gas#
_______________________________________________
Wikidata mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata
_______________________________________________
Wikidata mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata