0

I want to know the meaning of * and / in SPARQL.

If you check this example from Wikidata, you will see that a / and a * are used in here:

?item wdt:P361* wd:Q362 .   
?item wdt:P31/wdt:P279* wd:Q178561 .

What are they for? Why are they used?

Thank you in advance!

TallTed
  • 9,069
  • 2
  • 22
  • 37
Jack Green
  • 141
  • 2
  • 12
  • You can find the meaning of those stars in the [`SPARQL 1.1 specs`](https://www.w3.org/TR/sparql11-query/), especially in section "[Property Path Syntax](https://www.w3.org/TR/sparql11-query/#pp-language)" – KarelG Jun 08 '17 at 13:38

2 Answers2

1

They are part of SPARQL 1.1 syntax which is called property paths. They allow you to search for a specific path in the query.

For instance first basic graph pattern of yours (wdt:P361*) is serching for one or more occurance of the property wdt:P361 associated with the resource wd:Q362 - as long as time permits.

Or in the second one / allows you to search for a property wdt:P31 which is followed by a wdt:P279. However, I reccomend you to start with trying shorter paths not to confront any execution timeouts.

unor
  • 92,415
  • 26
  • 211
  • 360
Erwarth
  • 547
  • 6
  • 18
0

They are Property Paths. The first one selects subjects connected to the object wd:Q362 by any number of wdt:P361 properties. The second selects subject connected by wdt:P31 followed by zero-or-more wdt:P279 properties. There are some examples in the SPARQL 1.1 Query Language recommendation.

TallTed
  • 9,069
  • 2
  • 22
  • 37
chrisis
  • 1,983
  • 5
  • 20
  • 17