Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

The WSO2 Data Services Server supports  exposing relational data in RDF (Resource Description Framework) format as a service. In the following example, we demonstrate how a CSV data source can be exposed as a RDF resource.

In order to expose relational data in RDF format, you need to configure the relevant data service query accordingly. To start, add a new query to your CSV data service. For instructions on creating a CSV data service, refer to section CSV.

1. Log on to the Data Services Server Management Console.

2.  Click the Main menu and select List under Web Services.

3. The Deployed Services page appears which lists out all the currently active services and service groups.

Click on the data service you want to edit.

4. The dashboard of the data service opens. Click on the Edit Data Service link. In this example, we edit using the management console.

5. Navigate to the Queries page of the data service and click the Add New Query link.

6. The Add New Query page opens.

Since the output is a RDF result set, select output type as RDF from the drop-down list in the Output Mapping section.

...

Code Block
RDF Base URI : http://www.product/cd/{1}
Row namespace : http://www.product/cd#

7. To generate the response in RDF format, click the Add New Output Mapping link. The Add/Edit Output Mapping window opens.

There are two mapping types in RDF Output mapping.

  • as an element
  • as a resource

When mapping an element as a resource, you need to give the resource URI along with the column name which needs to be mapped in curly brackets as shown below. This way we can link two RDF resources together and create a relationship between the two.

8. Once you create the output mappings, go back to the main configuration and save your RDF query.

9. Once the query is completed, navigate to the resources window by clicking Next.

In the Resources window, click Add New Resource.

10. To create the RDF resource, you need to map your RDF query as a resource in the data service.

Provide a suitable name and description for your resource. The resource method is Get. Select the the rdfQuery created in the previous step as the Query ID. Click Finish to deploy the data service.

Once we create the resource we can access our RDF resource via a rest call.

You can validate generated RDF response by using an Online validator such as: http://www.w3.org/RDF/Validator. For example:

Image Added