Version specification
Whenever a dataset or project is updated--e.g., by adding or updating a file--data.world saves the old version of the dataset or project and creates a new version. The saved versions allow for back-in-time querying, and comparison between current and previous data. The data in those versions is accessed by using special named graphs.
Warning
The availability of previous versions of your datasets and projects is subject to data.world data retention policies, which may depend on the level of data.world support you have purchased. A saved query referencing a version of a dataset which becomes unavailable may cease to work.
There are a few different ways you can specify previous versions of your data:
Version by offset
Version by timestamp
Explicit version
Important
All the links in the following examples open datasets/projects in the data.world open data community. For best experience, make sure you are logged in to the application when you click these links.
Version by offset
The simplest way to specify that you wish to use a past version of a dataset or project graph is with a version offset IRI. The IRI of the current version of a dataset or project takes the form https://<agent_id>.linked.data.world/d/<dataset_id>
or https://<agent_id>.linked.data.world/d/<project_id>
.
A synonym for the current version which serves as the base for offset versions is https://<agent_id>.linked.data.world/d/<dataset_id>/v/tip
. Data for the immediately previous version of a dataset is available in the graph with the IRI https://<agent_id>.linked.data.world/d/<dataset_id>/v/tip-1
. This formula extends back to the nth prior version of the dataset or project: https://<agent_id>.linked.data.world/d/<dataset_id>/v/tip-<n>
.
Note
Note: https://<agent_id>.linked.data.world/d/<dataset_id>/v/prev
is a synonym for https://<agent_id>.linked.data.world/d/<dataset_id>/v/tip-1
Example - Version by offset
Here is an example of a version by offset query which shows how to access data from a previous version of a dataset, three versions prior to the current one:
PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/> PREFIX version: <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/v/> PREFIX airports: <https://airports.com/> SELECT ?nameFROM version:tip-3 { ?s a airports:airport. ?s airports:name ?name. }
This is what it looks like when run on data.world:
Version by timestamp
Versioning by offset is easy, but it is not always sensible if a dataset is updating frequently. Instead, you might wish to know the data that was available in a dataset at a specific point in the past--no matter how many versions the dataset has had since then. To specify the version of a dataset that was current at a specific time, use an IRI of the form http://<agent_id>.linked.data.world/d/<dataset_id>/v/at-<timestamp>
. Timestamps can be specified in the form yyyyMMdd
to get the dataset as it was on midnight of a specific day, or yyyyMMdd’T’HHmmssX
to specify the time more precisely.
Example - Version by timestamp
Here is an example of a query showing how to access data from a previous version of a dataset at a given timestamp:
PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/> PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/> PREFIX version: <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/v/> PREFIX airports: <https://airports.com/> SELECT ?name FROM version:at-20221024T122903Z { ?s a airports:airport. ?s airports:name ?name. }
This is what the query looks like when run on data.world:
Explicit version
The version UUID of each version of a dataset or project is available as an IRI in the form http://<agent_id>.linked.data.world/d/<dataset_id>/v/<version_uuid>
.
Examples
Example - Current version
Here is a an example of a query you can use to find the current version of a dataset:
PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/> PREFIX dw: <https://ontology.data.world/v0#> SELECT ?dataset ?agentId ?datasetId ?versionId { ?dataset dw:agentId ?agentId; dw:datasetId ?datasetId; dw:versionId ?versionId. }
And here is what the query looks like on data.world:
Example - Find version IRI
If you have identified a version you wish to continue to analyze, you can find its IRI with a query like this:
PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/> PREFIX dw: <https://ontology.data.world/v0#> SELECT ?dataset ?agentId ?datasetId ?versionId FROM <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/v/tip-1> { ?dataset dw:agentId ?agentId; dw:datasetId ?datasetId; dw:versionId ?versionId. }
And this is what it looks like on data.world:
Example - Explicit version
Here is an example of a query showing how to access data from a previous version of a dataset at a given version id:
PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/> PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/> PREFIX version: <https://ddw-doccorp.linked.data.world/d/sparql-rdf-dataset/v/> PREFIX airports: <https://airports.com/> SELECT ?nameFROM version:d3362ea7-820d-4239-bca9-3494a0d7ce51 { ?s a airports:airport. ?s airports:name ?name. }
Here is what query looks like on data.world: