This documentation is for WSO2 Data Services Server 3.2.2. View documentation for the latest release.
Resource Description Framework - Data Services Server 3.2.2 - WSO2 Documentation
Skip to end of metadata
Go to start of metadata

You can service enable data stored in a RDF (Resource Description Framework). First, follow the steps from 1 to 3 in creating a data service using various data sources. When you get to the Add New Data Source screen, select RDF as the data source type. The RDF-specific options will now be available for editing as shown below.

In the above example, we use a sample resource located in the file system but you can also use one hosted online.

To write a sample query to this datasource, see Sample 4: Querying a RDF datasource or read everything about query writing in Writing Data Service Queries.

Also, see a demonstration of service enabling in RDF Sample.

Exposing relational data in RDF format

You can also expose relational data in RDF format by configuring the relevant data service query. For example, let's see how to expose a CSV datasource as a RDF resource.

  1. Create and deploy a data service using a CSV datasource. For information, see CSV
  2. In the management console, click List under Services to open the Deployed Services page.
  3. Select the service created earlier using a CSV datasource to go to its dashboard.
  4. In the CSV data service's dashboard, click Edit Data Service.
  5. Navigate to the Queries page and click Add New Query.    
  6. Since the output is a RDF resul set, select output type as RDF from the drop-down list in the Output Mapping section.

    RDF Base URI has the format rdf:about, which uniquely identifies each resource. In this example, the RDF base URI takes the value of column 1 of the CSV for each row and replaces it with the RDF about attribute inside rdf:Description element.

    RDF Base URI : http://www.product/cd/{id}
    Row namespace : http://www.product/cd#


  7. To generate the response in RDF format, click Add New Output Mapping. There are two mapping types in RDF Output mapping.

    • as an element
    • as a resource

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

  8. Save your changes and click Next to add resources. To create the RDF resource, map your RDF query as a resource in the data service.

  9. Provide a suitable name and description to your resource. In this example, the resource method is Get . Select the the rdfQuery created in the previous step as the Query ID and Finish.

  10. You can access this RDF resource via a rest call and validate generated RDF response using an online validator such as:
  • No labels