Skip to main content

Queries Across Sources

You've been told that SPARQL queries can allow you to query across sources, and that the fd: in front of predicates meant Fluree. Now, it's time to actually learn how to query across sources.

The concept is pretty simple: each triple refers to a particular dataset. A single triple cannot reference multiple datasets.

If every item in a triple is a variable, we assume that your datasource is Fluree, but you can specify otherwise by listing a prefix in front of any variable, for example ?creator fd:?label ?artwork.

The most up-to-date list of supported sources is available here.

In this lesson, we'll focus on three sources:

  1. The current Fluree
  2. The Fluree as of a given point in time
  3. Wikidata sources

There are multiple ways to specify Fluree, including fd and fdb. In order to use a Fluree as of a given block, simply add a number after the prefix, for example fdb3.

The following query has triples that use the current Fluree as a source, as well as a previous version of the Fluree as a source:

SELECT ?person ?favNums
?person fd:person/favNums ?favNums;
fd3:person/favNums ?favNums.