Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What the asterisk mean in this SPARQL query?

What the asterisk mean in this SPARQL query?

SELECT ?uri ?type
WHERE{
    ?uri a ?type.
    ?type rdfs:subClassOf* example:Device.
}

Does it mean "subclass of a subclass"? Can I use it with other predicates?

like image 770
Juan Avatar asked Sep 16 '25 19:09

Juan


1 Answers

An asterisk (*) after a path element means “zero or more of this element”.

If there are no other elements in the path, ?a something* ?b means that ?b might also just be ?a directly, with no path elements between them at all.

?item wdt:P31/wdt:P279* ?class.
# means:
?item wdt:P31 ?class
# or
?item wdt:P31/wdt:P279 ?class
# or
?item wdt:P31/wdt:P279/wdt:P279 ?class
# or
?item wdt:P31/wdt:P279/wdt:P279/wdt:P279 ?class

See here for more detailed answer.

like image 173
Enayat Avatar answered Sep 18 '25 10:09

Enayat