Retrieving a statement value

Queries retrieving a statement value 

As noted in the introduction, Wikidata stores information in the form of statements that have an Item-Property-Value structure.

In our first example, our query returns Wikidata items that match our query pattern: they match a specific combination of Property and Value, namely, they have a P179 property (part of a series) with a value of Q22092344 (Star Wars film series). In other words, the variable with the name “item” collects those Wikidata items that have a statement which matches the pattern:

?item – has property:part of a series – with value:Star Wars (film series)

In this case, the item part of a matching statement is retrieved. But queries do not necessarily have to return the first part (Item) of statements.

In the following query the ?actor variable collects values of the property cast member (P161) of the item Star Wars Episode IV: A New Hope (Q17738). That is to say, the variable collects the third part (the object) of the statements:

Skip to content