Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Image RemovedImage Added

In the above example, we use a sample resource hosted online located in the file system but you can also use one in your local machine. The RDF resource used in this example is hosted by NASAhosted 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

...

  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.

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

    Image Removed Image Added 

  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.
    Image Removed Image Added

  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: http://www.w3.org/RDF/Validator.