-
Notifications
You must be signed in to change notification settings - Fork 2
RO evolution API
The goals of this API are:
- Enable the creation of different types ROs (Live, Snapshot, Archived)
- Mechanism to "clone" an RO from an internal RO, external RO resource, external non-RO content.
- Retrieve the evolution provenance of an RO, including the direct evolution (e.g., priorVersion) and contributions (e.g., derivedFrom, originalSource, etc.)
- Retrieve list of snapshots, archived ROs.
This API should:
- Vocabulary for describing RO evolution, including RO types and relations: roevo
- Special creation operation of an RO, which makes a copy from another resource
- Handle different types of ROs, representing different stages in its lifecycle
- Handle RO versions
- Handle relations with other resources (e.g., contributions)
- Prevent modification of snapshots and archived ROs
The goals of this API are to enable transformation of the research objects based on their lifecycle and to facilitate retrieving the evolution history of the research objects.
The lifecycle transformation of research objects is achieved by providing a service that performs a copy of a research object and saves the copy as a live, snapshot or archived research object. The client needs to make two requests to complete the copying:
- Copy a research object. The new research object is in a transient state and is available only to the creator. It can still be modified before reaching the target evolution state.
- Finalize the state transformation. The service validates that the transient research object meets the requirements for being in the target evolution state and performs the state transition. For evolution states such as a snapshot or archived research object, that means that the research object becomes immutable.
The second API functionality is a facility for retrieving the evolution provenance. The client may send a request with a research object URI as a query parameter and the service will return an RDF graph with selected information about the research object in question, its copies and the research object that it itself was copied from. Note that typically this information can equally be achieved with a series of SPARQL queries to the ROSR service hosting the research object.
The service is based on the research object evolution model.
❗ URIs here are all examples - not fixed by API
⚠️ Piotr
At this moment I would suggest that the URIs for all types of ROs have the same format and leave introducing special URI forms for a second step.
If a client wants to create a copy of an RO (i.e. a snapshot), the steps are:
- Retrieve the evolution service document and find the links to copy and finalize resources
- Create a new copy job and wait until it finishes
- Modify the copy in any way, i.e. delete temporary or private resources.
- Create a new finalize job and wait until it finishes
- Perform a GET or HEAD operation to the RO to find the link to evolution information resource
- Retrieve the evolution provenance information using the link provided
The client retrieves the service document to learn the URI templates for the resources.
C: GET http://example.com/evo/ HTTP/1.1 C: Accept: text/turtle S: HTTP/1.1 200 OK S: Content-Type: text/turtle S: S: @prefix evo: <http://purl.org/ro/service/evolution/> . S: S: . evo:copy "http://example.com/evo/copy/" ; S: evo:finalize "http://example.com/evo/finalize/" ; S: evo:info "http://example.com/evo/info{?ro}" .
This operation creates a copy of a research object. The new research object is in a transient state unless the operation is immediately finalised. Transient state means it is only available to the creator. The type of the copy has to be defined because it influences the new research object URI form.
A "Slug" HTTP header may be used to indicate the requested RO id.
Creating and finalising a copy may be presented to the user as one operation, only the client application will use a one step or two step process.
Copyfrom URI may be a research object in the same ROSR service, a research object in another ROSR service, or even an external non-RO content. It is more an implementation detail how the copy will be made in each of these cases.
The copy operation may take a considerable amount of time because it may involve copying resource contents. For that reason it is realised in a form of a job that can be created and monitored by the client.
Initiate a copy job.⚠️ Define the copy manifest changes
We should define which fields from the manifest are copied and which are added. For example, the dcterms:creator will probably be copied but evo:asSnapshotedBy or similar will be used for the person who made the copy.
Get a copy job status (running).C: POST http://example.com/evo/copy/ HTTP/1.1 C: Content-Type: application/json C: Authorization: Bearer 47d5423c-b507-4e1c-7 C: Slug: copy-1 C: C: { C: "copyfrom": "http://example.com/ROs/ro-id/", C: "type": "SNAPSHOT", C: "finalize": false C: } S: HTTP/1.1 201 Created S: Location: http://example.com/evo/copy/12345 S: S: { S: "copyfrom": "http://example.com/ROs/ro-id/", S: "type": "SNAPSHOT", S: "finalize": false, S: "target": "http://example.com/ROs/copy-1/", S: "status": "running" S: }
Get a copy job status (finished).C: GET http://example.com/evo/copy/12345 HTTP/1.1 C: Accept: application/json S: HTTP/1.1 200 OK S: Content-Type: application/json S: S: { S: "copyfrom": "http://example.com/ROs/ro-id/", S: "type": "SNAPSHOT", S: "finalize": false, S: "target": "http://example.com/ROs/copy-1/", S: "status": "running" S: }
The copy job may get deleted by the service after any time after completion but it is recommended to keep it for enough time for the client to check back.C: GET http://example.com/evo/copy/12345 HTTP/1.1 C: Accept: application/json S: HTTP/1.1 200 OK S: Content-Type: application/json S: S: { S: "copyfrom": "http://example.com/ROs/ro-id/", S: "type": "SNAPSHOT", S: "finalize": false, S: "target": "http://example.com/ROs/copy-1/", S: "status": "done" S: }
Finalise a copy operation
Finalize a copy operation. Can only be executed on research objects in transient state, created as a result of a (not finalized) copy operation.
The finalisation operation may take a considerable amount of time because it may involve verifying the research object quality. For that reason it is realised in a form of a job that can be created and monitored by the client.
Getting a status of a successfully finished finalization.C: POST http://example.com/evo/finalize/ HTTP/1.1 C: Content-Type: application/json C: Authorization: Bearer 47d5423c-b507-4e1c-7 C: C: { C: "target": "http://example.com/ROs/copy-1/", C: } S: HTTP/1.1 201 Created S: Location: http://example.com/evo/finalize/345
The finalization may perform additional verification of the research object depending on the intended status. If the verification fails, the service will answer with a status failed and an explanation in reason.C: GET http://example.com/evo/finalize/345 HTTP/1.1 C: Accept: application/json S: HTTP/1.1 200 OK S: Content-Type: application/json S: S: { S: "target": "http://example.com/ROs/copy-1/", S: "status": "done" S: }
C: GET http://example.com/evo/finalize/345 HTTP/1.1 C: Accept: application/json S: HTTP/1.1 200 OK S: Content-Type: application/json S: S: { S: "target": "http://example.com/ROs/copy-1/", S: "status": "failed", S: "reason": "Please annotate foo/bar.txt" S: }
In order to cancel the copy operation after the copying finished but before it was finalized, the client must simply delete the transient research object.
C: DELETE http://example.com/ROs/copy-1/ HTTP/1.1 S: HTTP/1.1 204 No Content
A separate but linked resource can be used to query for evolution information of a research object. The resource URI is obtained via a link relation returned when querying the RO itself.
@@ Option to include this link in the RO manifest?
An example for a Live RO.
An example for a Snapshot RO.C: HEAD http://example.com/ROs/ro-id/ HTTP/1.1 S: HTTP/1.1 200 OK S: Content-Type: application/rdf+xml S: Link: <http://example.com/evo/info?ro=/ROs/ro-id/>;rel="ro:roevo-info" C: GET http://example.com/evo/info?ro=/ROs/ro-id/ HTTP/1.1 C: Accept: text/turtle S: HTTP/1.1 200 OK S: Content-Type: text/turtle S: S: @prefix roevo: <http://purl.org/wf4ever/roevo#> . S: @prefix prov: <http://www.w3.org/ns/prov#> . S: S: <http://example.com/ROs/ro-id/> a roevo:LiveRO; S: roevo:hasSnapshot <http://example.com/ROs/ro-id/roevo/copy-1/> ; S: prov:hadOriginalSource <http://www.myexperiment.org/packs/258> . S: S: <http://example.com/ROs/ro-id/roevo/copy-1> roevo:snapshotedAtTime "2012-05-07T09:18:48.056Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
C: HEAD http://example.com/ROs/copy-1/ HTTP/1.1 S: HTTP/1.1 200 OK S: Content-Type: application/rdf+xml S: Link: <http://example.com/evo/info?ro=/ROs/copy-1/>;rel="ro:roevo-info" C: GET http://example.com/evo/info?ro=/ROs/copy-1/ HTTP/1.1 C: Accept: text/turtle S: HTTP/1.1 200 OK S: Content-Type: text/turtle S: S: @prefix roevo: <http://purl.org/wf4ever/roevo#> . S: @prefix prov: <http://www.w3.org/ns/prov#> . S: @prefix dcterms: <http://purl.org/dc/terms/> . S: S: <http://example.com/ROs/ro-id/roevo/copy-1/> a roevo:SnapshotRO; S: roevo:isSnapshotOf <http://example.com/ROs/ro-id/> ; S: roevo:snapshotedAtTime "2012-05-07T09:18:48.056Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
✅ Notes
- Getting evolution information of an RO in transient state is not allowed?
- Copies are not having all the evolution information, such as previousVersion. Only a link to the RO from which it was copied, is kept.