GRSF-services
Contents
GRSF-services
In this page we describe the components that are responsible for interacting with the gCube infrastructure for performing various activities about GRSF records. GRSF records are handled as dataset resources and are stored in the data catalogue. The following image depicts a high level view of the architecture of components that are exploited for constructing the GRSF KB, publishing GRSF records and updating them. In the sequel we will focus and describe the components grsf-services-core and grsf-services-updater.
grsf-services-core
This component is responsible for retrieving individual records from the GRSF KB and publish them in the GRSF data catalogue. For this reason it uses the particular service (which is described at GCube_Data_Catalogue_for_GRSF). Since the service is accepting incoming records (either for stocks or fisheries) as JSON objects, the main functionality of the grsf-services-core component is to act a a bridge between the GRSF KB and the GRSF data catalogue. The corresponding steps for publishing a set of records is described below (and in the corresponding part of the sequence diagram).
- The grsf-services-core component fetches all the GRSF records and their corresponding information from the GRSF KB. Since the GRSF KB is a semantic warehouse, its contents are stored as a set of RDF triples; therefore in order to fetch them a particular SPARQL query has to be formulated and submitted to the GRSF KB.
- After fetching all the GRSF records (in terms of RDF triples), they have to be transformed so that they can be published through the publishing service of the GRSF data catalogue. The services accepts JSON object, therefore the RDF triples are transformed accordingly with respect to the expected metadata (which are described here).
- The grsf-services-core component publishes the transformed JSON objects and retrieves the results.
The component is being delivered as a software library. It is being triggered from MatWare after the construction of the GRSF KB.
grsf-services-updater
This component is responsible for updating the status of a record, when the users requires so. More specifically the component is delivered as a service, that accepts incoming requests containing the record that will be updated, with its accompanying information (the new status, a narrative text describing the status update). Once a request has been received the service will update the contents in the GRSF KB, and return a response message information the caller for the results. The communication messages for the service are formulated JSON objects. The steps that are followed are described in detail below (with the corresponding part of the sequence diagram).
- a new incoming request for a record status update is being received from the grsf-services-updater.
- grsf-services-updater validates that the request contains valid data
- grsf-services-updater updates the corresponding component in the GRSF KB. For this reason the appropriate SPARQL update query is being formulated and submitted to GRSF KB
- grsf-services-updater returns a response (as a JSON object) with the result of the update process.
Check service availability
In order to check that the service is up and running you can use the following url
[GRSF_SERVICES-CORE BASE_URL]/grsf-services-updater
This will show a landing page with instructions for using the service indicating that the service is up and running.
Service input
The service accepts as input json objects. Some of the fields in the object are mandatory while others are optional. The following table lists the fields of the json objects.
Name | Api Name (JSON) | Mandatory/Optional | Description |
---|---|---|---|
Catalogue ID | catalogue_id | mandatory | the id of the record in the data catalog |
Record ID | record_id | mandatory | the id of the record in the GRSF knowledge base |
Type | type | mandatory | the type of the resource. It can be one of the following: [stock, fishery] |
Status | status | mandatory | the new status of the record. The accepted values are: [confirmed, rejected, pending] |
Annotation message | annotation_msg | optional | a short narrative text used for justifying the status change |
Service response
The service returns JSON objects as response. In particular it returns an object containing the following values:
- catalog_id: the id of the record in the data catalog
- record_id: the id of the record in the GRSF knowledge base
- status: the updated status of the record.
- annotation_msg: the short narrative text used for justifying the status change
- error: A short narrative text describing the error that has occurred. This value appears only if an error has occurred
Apart from returned JSON the service uses HTTP codes for indicating whether the request has been processed successfully or not. More specifically the following HTTP codes are returned:
- 200: it is returned if the request has been processed successfully, and the status of the corresponding record has been updated
- 400: it is returned if any of the given parameters that are mandatory is missing or contains incorrect values (i.e. a wrong status value)
- 500: it is returned for any error that might occur when updating the records in the GRSF KB
Service usage
Some indicative urls for using the service follow:
[GRSF_SERVICES-CORE BASE_URL]/grsf-services-updater/updateRecordStatus?catalog_id=XXX&record_id=YYY&status=confirmed [GRSF_SERVICES-CORE BASE_URL]/grsf-services-updater/updateRecordStatus?catalog_id=XXX&record_id=YYY&status=rejected&annotation_msg=message"
Links
//TO-ADD
- Links to SVN
- Links to corresponding tickets