Closed ross-spencer closed 1 year ago
The asterisk stands for "0 to n" P279 properties. The query will return ?uri wdt:P31 wd:Q235557. ?uri wdt:P31/wdt:P279 wd:Q235557. ?uri wdt:P31/wdt:P279/wdt:P279 wd:Q235557. ?uri wdt:P31/wdt:P279/wdt:P279/wdt:P279 wd:Q235557. etc.
Though P279 is declared a transitive property, inference does not seem to work as you have different results with or without the asterisk...
Oh interesting. Thanks Bertrand.
It seems that there's a good example on Wikibooks using Bach:
With a +
: https://w.wiki/66uj
With a *
: https://w.wiki/66um
Without: https://w.wiki/66up
One example difference without *
is Johann August Bach: https://www.wikidata.org/wiki/Q66587214 who is JSB's grand-child and child of Carl Philipp Emanuel Bach. Without the *
or +
we just get JSB's direct descendants (children}.
https://en.wikibooks.org/w/index.php?title=SPARQL/Property_paths&oldid=3476967
TIL!! :D
Yes, but P279 is transitive (which means if A a subclass of B, and B is subclass of C, a reasoner can deduce that A is also a subclass of C). But it seems that this mechanism (inferring new relationships from data and the ontology) is not used in Wikidata.
In your example, P40 is not transitive, though a hypothetical property "descendant of" should be.
There is a project about inference. It suggests that rules of reasoning are not clearly specified (in particular, what should be done with qualifiers?).
And a use case for P279.
Description of problem
Currently we use
?uri wdt:P31/wdt:P279* wd:Q235557.
to return instance-of/subclass-of file format. We can return more results and thus signatures through?uri wdt:P31*/wdt:P279* wd:Q235557.
(note the asterisk after wdt:P31.Without asterisk:
With JSON:
Example formats we retrieve with the asterisk are: