ORKG Snapshots
Snapshots in the ORKG are immutable captures of a resource’s state at a specific point in time. They preserve the complete subgraph structure based on a template, and can optionally be assigned persistent Handle identifiers for long-term referencing. The snapshots component is added to the ORKG class to encapsulate these actions.
Having defined our entry point to the ORKG instance
from orkg import ORKG # import base class from package
orkg = ORKG(host="<host-address-is-here>", creds=('email-address', 'password')) # create the connector to the ORKG
We can access the snapshots manager directly to do the following:
Getting all snapshots of a resource
You can retrieve all snapshots that have been created for a specific resource. Optionally, you can filter by template ID.
### Fetch all snapshots of a resource
# resource_id: the ID of the resource
# template_id: (optional) filter by template used to create the snapshot
orkg.snapshots.all_of_resource(resource_id='R2146740')
>>> (Success)
[
{
"id":"52a7sti8",
"created_by":"3f73b40d-4d9b-49bf-ae38-8fcf4e57cc4d",
"created_at":"2025-11-20T10:43:22.66351+01:00",
"data":{...},
"resource_id":"R2146740",
"template_id":"R2146171",
"handle":None
},
{
"id":"s93bn4fj",
"created_by":"18a48c35-0a9d-4d35-b276-fe293f7d79c7",
"created_at":"2025-11-21T10:58:49.02423+01:00",
"data":{...},
"resource_id":"R2146740",
"template_id":"R2146171",
"handle":"20.500.14488/s93bn4fj"
},
...
]
Filter by template:
### Fetch all snapshots of a resource filtered by template
orkg.snapshots.all_of_resource(resource_id='R2146740', template_id='R2146171')
Getting a single snapshot
You can retrieve a specific snapshot by its ID and the resource ID it belongs to.
### Fetch a single snapshot by ID
# resource_id: the ID of the resource
# snapshot_id: the ID of the snapshot
orkg.snapshots.single_of_resource(resource_id='R2146740', snapshot_id='52a7sti8')
>>> (Success)
{
"id":"52a7sti8",
"created_by":"3f73b40d-4d9b-49bf-ae38-8fcf4e57cc4d",
"created_at":"2025-11-20T10:43:22.66351+01:00",
"data":{
"root":{
"id":"R2146740",
"label":"Example Resource",
...
},
"predicates":{
"P1":{
"id":"P1",
"label":"has property",
...
}
},
"statements":{
"S1":{
"id":"S1",
"subject":"R2146740",
"predicate":"P1",
"object":"L1",
...
}
}
},
"resource_id":"R2146740",
"template_id":"R2146171",
"handle":None
}
Creating a snapshot
You can create a new snapshot for a resource. The snapshot will capture the complete subgraph structure based on the specified template. Optionally, you can register a persistent Handle identifier for the snapshot.
Note: your credentials must be entered in the ORKG instance in order to use this functionality. All newly created snapshots will be credited to your user.
### Create a new snapshot
# resource_id: the ID of the resource to snapshot
# template_id: the ID of the template to use for subgraph exploration
# register_handle: (optional) whether to register a persistent Handle identifier (default: True)
orkg.snapshots.create_one(
resource_id='R2146740',
template_id='R2146171',
register_handle=True
)
>>> (Success)
{
"id":"52a7sti8",
"created_by":"3f73b40d-4d9b-49bf-ae38-8fcf4e57cc4d",
"created_at":"2025-11-20T10:43:22.66351+01:00",
"data":{
"root":{...},
"predicates":{...},
"statements":{...}
},
"resource_id":"R2146740",
"template_id":"R2146171",
"handle":"20.500.14488/52a7sti8"
}
Create a snapshot without registering a Handle:
### Create a snapshot without Handle registration
orkg.snapshots.create_one(
resource_id='R2146740',
template_id='R2146171',
register_handle=False
)
>>> (Success)
{
"id":"mj97hbh3",
"created_by":"18a48c35-0a9d-4d35-b276-fe293f7d79c7",
"created_at":"2025-11-21T11:25:28.369011+01:00",
"data":{...},
"resource_id":"R2146740",
"template_id":"R2146171",
"handle":None
}
Understanding Snapshots
Snapshots serve several important purposes in the ORKG:
Versioning: Capture the state of a resource at specific points in time
Persistence: Create immutable records that won’t change even if the original resource is modified
Citation: When a Handle is registered, the snapshot gets a persistent identifier suitable for academic citation
Preservation: Ensure long-term availability of research data structures
The snapshot data includes:
root: The main resource being snapshotted
predicates: All predicates used in the subgraph
statements: All statements connecting resources and literals in the subgraph
The subgraph exploration follows the structure defined by the template, ensuring consistency across snapshots of similar resources.