Property talk:P4316
Documentation
kinship equivalent in SPARQL at Wikidata
part of a SPARQL query that lists this type of ?relative of a ?person. Use with relationship properties (except "relative" (P1038)). See instructions for applicable format
part of a SPARQL query that lists this type of ?relative of a ?person. Use with relationship properties (except "relative" (P1038)). See instructions for applicable format
Represents | Wikidata Query Service (Q20950365) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Data type | String | |||||||||
Domain | kinship (Q171318) | |||||||||
Allowed values | (?i)((?!\bP1038).)*.*\?person.*.*\?relative.*(?i)((?!\b(,|;)).)* | |||||||||
Usage notes | SPARQL query without SELECT * {}, wdt:P31 wd:Q5, but always including ?person and ?relative. Relationship properties: P22 (father), P25 (mother), P40 (child), P26 (spouse), P3373 (sibling) (add more if needed, not P1038) | |||||||||
Example | father (Q7565) → ?person wdt:P22 ?relative paternal grandmother (Q12433519) → ?person wdt:P22/wdt:P25 ?relative female double parallel cousin (Q113884914) → ?person wdt:P22/wdt:P3373 ?uncle . ?uncle wdt:P40 ?relative . ?uncle wdt:P21 wd:Q6581097 . ?person wdt:P25/wdt:P3373 ?aunt . ?aunt wdt:P40 ?relative . ?aunt wdt:P21 wd:Q6581072 . ?relative wdt:P21 wd:Q6581072 | |||||||||
Formatter URL | https://query.wikidata.org/#SELECT%20%3Fperson%20%3FpersonLabel%20%3Frelative%20%3FrelativeLabel%0A%7B%20%0A%20%20$1.%0A%20%20%3Fperson%20wdt%3AP31%20wd%3AQ5%20.%20%3Frelative%20wdt%3AP31%20wd%3AQ5%20.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0ALIMIT%2010 https://query.wikidata.org/#SELECT%20%0A%20%20%28COUNT%28%2a%29%20as%20%3Fct1%29%20%0A%20%20%28COUNT%28DISTINCT%20%3Fperson%29%20as%20%3Fct2%29%20%0A%20%20%28COUNT%28DISTINCT%20%3Frelative%29%20as%20%3Fct3%29%20%0AWHERE%0A%7B%20%20%0A%20%20%20%20$1%20.%20%0A%20%20%20%20%3Fperson%20wdt%3AP31%20wd%3AQ5%20.%20%0A%20%20%20%20%3Frelative%20wdt%3AP31%20wd%3AQ5%0A%7D | |||||||||
Lists |
| |||||||||
Proposal discussion | Proposal discussion | |||||||||
Current uses |
|
[create Create a translatable help page (preferably in English) for this property to be included here]
Type “kinship (Q171318)”: item must contain property “instance of (P31)” with classes “kinship (Q171318)” or their subclasses (defined using subclass of (P279)). (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303). List of violations of this constraint: Database reports/Constraint violations/P4316#Type Q171318, SPARQL
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P4316#Format, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P4316#Format, SPARQL
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P4316#Format, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P4316#Format, SPARQL
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P4316#Format, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P4316#Format, SPARQL
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P4316#Format, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P4316#Format, SPARQL
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P4316#Item P461, search, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P4316#Item P461, search, SPARQL
Distinct values: this property likely contains a value that is different from all other items. (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303). List of violations of this constraint: Database reports/Constraint violations/P4316#Unique value, SPARQL (every item), SPARQL (by value)
Scope is as main value (Q54828448): the property must be used by specified way only (Help)
List of violations of this constraint: Database reports/Constraint violations/P4316#Scope, hourly updated report, SPARQLAllowed entity types are Wikibase item (Q29934200): the property may only be used on a certain entity type (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303). List of violations of this constraint: Database reports/Constraint violations/P4316#Entity types
Pattern ^(.*) ([)/<> |].*)$ will be automatically replaced to \1\2. Testing: TODO list |
Pattern ^(.*[(/<> |]) (.*)$ will be automatically replaced to \1\2. Testing: TODO list |
Pattern ^(.+[^ ])\.(.+)$ will be automatically replaced to \1 .\2. Testing: TODO list |
Sample query edit
- Items used: Elizabeth II (Q9682)
- Properties used: kinship equivalent in SPARQL at Wikidata (P4316)
#Relatives of Q9682
#Added 2017-10-10 by Jura1
SELECT (
IRI(
CONCAT(
"https://query.wikidata.org/embed.html#",
"SELECT DISTINCT ?kinship ?relative ?relativeLabel ",
"%0AWHERE ",
"%0A{ ",
"%0A BIND( wd:Q9682 as ?person) %0A%20%20" ,
GROUP_CONCAT(?sparql1; separator="%0A%20%20 UNION "),
"%0A SERVICE wikibase:label { bd:serviceParam wikibase:language 'en'. ?relative rdfs:label ?relativeLabel } ",
"%0A} " )
)
as ?sparql)
WHERE
{
SELECT ( CONCAT( "{", str(?value), ' . BIND("', str(?itemLabel), '" as ?kinship)} ' ) as ?sparql1)
{
?item wdt:P4316 ?value
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". ?item rdfs:label ?itemLabel }
}
LIMIT 100
}
LIMIT 1000
Sample query 2 edit
- Items used: President of the United States (Q11696) , human (Q5) , Ahnentafel (Q267388)
#title:Ancestors of US Presidents with Ahnentafel number, retrieve definitions
#Added 2017-10-21 by Jura1, updated 2021-07-17
SELECT (
IRI(
CONCAT(
"https://query.wikidata.org/embed.html#",
"%0A#title:Ancestors of US Presidents with Ahnentafel number, definitions from Wikidata",
"%0ASELECT DISTINCT ?person ?personLabel ?ord ?kinship ?relative ?relativeLabel ?relativeDescription ",
"%0AWHERE ",
"%0A{ ",
"%0A ?person wdt:P39 wd:Q11696 ; wdt:P31 wd:Q5 %0A" ,
GROUP_CONCAT(?sparql1; separator=" UNION %0A%20%20"),
"%0A SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE],en'. } ",
"%0A} ",
"%0AORDER BY ?personLabel ?ord " )
)
as ?sparql)
WHERE
{
SELECT ( CONCAT( "{", str(?value), ' . BIND(', str(?ord), ' as ?ord) . BIND("', str(?itemLabel), '" as ?kinship)} ' ) as ?sparql1)
{
?item wdt:P4316 ?value ; p:P179 [ ps:P179 wd:Q267388 ; pq:P1545 ?ord ]
SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE],en'. ?item rdfs:label ?itemLabel }
}
}
LIMIT 1000
Sample query 3 edit
#Chinese family relationship terms
#Added 2017-10-22 by Jura1
SELECT (
IRI(
CONCAT(
"https://query.wikidata.org/#",
"SELECT DISTINCT ?person ?personLabel ?kinship ?kinshipLabel ?kinshipDescription ?relative ?relativeLabel ",
"WHERE ",
"{ ",
" { ?person wdt:P27 wd:Q148 } UNION { ?person wdt:P27 wd:Q29520 } UNION { ?person wdt:P27 wd:Q865 } . ?person wdt:P31 wd:Q5 " ,
GROUP_CONCAT(?sparql1; separator=" UNION "),
" SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE],en' } ",
"} ",
"ORDER BY ?personLabel ?kinshipLabel " )
)
as ?sparql)
WHERE
{
SELECT ( CONCAT( "{", str(?value), ' . BIND(IRI("', str(?item), '") as ?kinship)} ' ) as ?sparql1)
{
?item wdt:P4316 ?value ; wdt:P31 wd:Q42301475
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". ?item rdfs:label ?itemLabel }
}
}
LIMIT 1000
To do edit
property values:
- maybe change wdt:P26 to p:P26/ps:P26
- normalize space around "/" and "|" and "."
- replace "," or ";" in syntax
- add complex constraints based values for qualifier "criterion used" on "opposite of"-statements
- maybe replace named variables with "/" when not needed
other: