Skip to Content

This blog shares an experience of creating OData from RDF(Resource Description Framework) data sets.

While  walking through the Semantic Web course in with my colleague Atanu Mallik, we realized that RDF is very much parallel with the OData stack, in terms of using http, REST and XML. In this blog we discuss an  approach towards creating an OData service from a RDF Class.

As the name suggests, Semantic web aka RDF’s goal is to build a semantic web of data, where data sources can communicate with each other, and aggregate and mash up their data; whereas, OData aims to standardize data publishing and accessing mechanism in addition to providing a data model.

Unlike OData, RDF is in the market  for more years and is a W3C specification as well. Also there is a significant amount of Open data that is already available as RDF. Example RDF sources can be found at

With this information let us look at a use case.

The Client is a “Music Title reseller” running SAP Suite. I am an ABAP developer, who wants to develop an OData service for subsequent use in creating an Android mobile application. The OData service needs to provide the following information about the music title. Name, Price, Stock Status, Manufacturer, Lyrics By, Music By, Based On, Awards Won, and Home Page.

Most of the information mentioned above are available in the in the SAP Suite, and the rest of the information are available in for most of the Musical albums. If I can create an OData service out of the available Wikipedia data, it can be mashed up with the OData service generated from SAP suite. Another option would be to integrate the Wikipedia data’s OData service in the Android application.

Approach for Metadata

Keeping the above option is mind; we derived a model mapping between RDF and OData.

Wikipedia data, which is available as RDF Class instances in, has a SPARQL endpoint. Each RDF Class will be converted into an OData Service, which will contain only one Entity. All the properties of the RDF Class will be converted into the properties of the Entity. In addition to the properties that are created, another property is added to the Entity and this is the key property for the Entity. The name of the key property can be ‘<Class name>ID’ and its value will be the name of the class instance. All the properties are typed as ‘Edm.String’. Representation of the Model Mapping


A SPARQL query to get all properties of an RDF class can be used, and the result can be used to generate code for the Model Provider Class. Refer  the above mapping diagram to fetch various artifacts.

Approach for Runtime

A simple library can be written to convert the SAP NetWeaver Gateway URIs into SPARQL queries. The returned xml/json document can be transformed using simple XML transformations into ABAP internal tables and mapped back as entity data. We were able to do this for query and read functionalities.

It was heartening to see that we could create OData services for any RDF classe and fetch various useful data from dbpedia.

Thanks for reading the blog and let us know your thoughts.

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Derek Scuffell

    A good starting point for discussion. Which has been developed further here to discuss Janus points allowing SPARQL access to RDF data throigh ODATA. Also described here “OData2SPARQL: consuming SPARQL/RDF with OData RESTful interface” by @peterjlawrence on @LinkedIn


Leave a Reply