SPARQL/WIKIDATA Qualifiers, References and Ranks

The data on WIKIDATA contains more info than only the triples. For a full description see Wikidata:Glossary.

Let us look at and where he is.

Qualifiers
Let us list the education of Douglas Adams and the qualifiers Start time end End time:

The prefix  points not to the object, but to a statement node. This node then is the subject of other triples. The prefix  within the statement node retrieves the object. The prefix  within the statement node retrieves the qualifier information.

The code can be abbreviated a lot with the [ ] syntax by eliminating the variable.

Ranks
Let us list the education of Douglas Adams and the ranks of them:

The prefix  points not to the object, but to a statement node. This node then is the subject of other triples. The prefix  within the statement node retrieves the object. The  within the statement node retrieves the rank information.

The code can be abbreviated a lot with the [ ] syntax by eliminating the variable.

An example with different ranks is the (historcal) countries in which Berlin lied.

The 3 possible values for ranks are,   and

Compare this with the normal triples, which will select only the value(s) with the highest rank. In this case only the Preferred Rank value.

Ignore ranks in queries
Ranks might cause unexpected results. For example, consider this query, that will give you back all Dutch municipalities that share a border with :

This will not show, because its rank for is 'normal' while the other three values for  are 'preferred'. To see Boskoop in the previous query as well, rewrite it like this:

Or use a property path to shorten the query like this:

Summary
A full query of Douglas Adams education, with rank, qualifiers and references could look like