Integrating OData Services into the Semantic Web

Integrating OData Services into the
Semantic Web
Marc Kirchhoff
September 2014
Public
Agenda

Motivation

Problem

Architecture

Semantic description of OData services

Mapping SPARQL queries to OData calls
 Evaluation semantics for graph templates
 Creation of OData URIs

Example

Conclusion
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
Public
2
Motivation

The retrieval of data from ERP-systems is not an easy task.
Document A
ID = 71277
Description = "Technical Documentation"
Equipment A
ID = 71277
SerialNr. = 234867
ManuName = "XYC"
Existing interfaces:

Several service-/RPC-calls

Several hundred lines of code
Document B
ID = 89723
Description = "User Manual"
Document C
ID = 62435
Description = "Quick Guide"
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
vs.
SPARQL:
SELECT ?desc
WHERE {
?equ rdf:type boo:Equipment .
?equ boo:hasManufacturerSerialID 234867 .
?equ boo:hasManufacturerName "XYC" .
?equ boo:hasDocument ?doc .
?doc boo:hasDescription ?desc }
Public
3
Problem

It is not possible to realize the SPARQL endpoint on top of the database

Solution: Place it on top of the OData interface

OData = Open Data Protocol

REST-based protocol (HTTP, AtomPub and JSON)

Widespread attention within the industry (Microsoft, eBay, SAP usw.)

Query language (filter, select etc.)
SPARQL
SPARQLOData-Layer
OData
Interface
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
Public
4
Architecture
Client
Application
SPARQL
R
SPARQL-OData-Layer
R
SPARQLOData-Layer
Query Engine
Service
Registry
Triple
Store
R
Execution
Engine
OData
Interface
SPARQL
Processor
Reasoner
R
RDF Adapter
R
OData Server
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
Public
5
Entity Data Model

EDM = Entity Data Model

Realization of the entity relationship model

Entity Types / Entities

Properties / Navigation Properties

Inheritance
FK_Orders_Customers
Customer

Described in CSDL

CSDL-description is part
of the Service Metadata Document
CustomerID: Edm.Int32
CompanyName: Edm.Date
Order
0..1
*
OrderID: Edm.Int32
ShippedDate: Edm.Date
ShipName: Edm.String
ExpressOrder
ExtraShippingFee: Edm.Int32
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
Public
6
Extension of CSDL

Goal: Extension of CSDL that allows the definition of mappings from EDM to RDF
RDF-Graph-Template
Entity Type
Order
+OrderID: Edm.Int32
+ShippedDate: Edm.Date
+ShipName: Edm.String
northw:Order
rdf:type
<?>^^ownns:own_
data_type
northw:shipped_date
northwi:3323/Order_<ID>
northw:order_id
<?>^^xsd:int
northw:ship_name
<?>@en
<EntityType Name="Order" sem:Mapping="?order rdf:type northw:Order">
<Property Name="ShippedDate" Type="Edm.DateTime"
sem:Mapping="?order northw:shipped_date $^^ownns:own_data_type"/>
<Property Name="ShipName" Type="Edm.String"
sem:Mapping="?order northw:ship_name $@en" />
…
</EntityType>
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
Public
7
Mapping SPARQL queries to OData calls
OData Service
Calls
SPARQL Query
SPARQL-Algebra
Project
SELECT ?s ?o
WHERE {
?s_1 rdf:type type_1 .
LeftJoin
?s_1 p_1 o_1
OPTIONAL
{ ?s_1 p_2 ?o_2 }
BGP
BGP
…
}
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
Mapping
Query
Engine
GET URL_1
GET URL_2
GET URL_3
Semantically
annotated ServiceMetadataDocuments
Public
8
Evaluation semantics for graph templates
SPARQL-Algebra
Project
Semantically annotated
CSDL-documents
LeftJoin
BGP
BGP
Triple-Patterns
Graph-Template
Project(LeftJoin({𝜗1 , 𝜗2 , … , 𝜗𝑛 },{𝜗1′ , 𝜗2′ , … , 𝜗𝑘′ })
,{?s,?o}) = {𝜗𝑖 , 𝜗𝑗 , 𝜗𝑙′′ , … }
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
GET URL_1
GET URL_2
Public
GET URL_3
9
Example
SPARQL
SELECT *
WHERE {
?or rdf:type ens:Order .
?or ens:ordered_by ?cu .
OPTIONAL { ?cu ens:city ?city .
?cu ens:country 'Germany' }}
SPARQL-Algebra
LeftJoin(BGP(?or
?or
BGP(?cu
?cu
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
rdf:type ens:Order.
ens:ordered_by ?cu),
ens:city ?city.
ens:country 'Germany'),true)
Public
10
Example
?or rdf:type ens:Order .
?or ens:ordered_by ?cu .
?cu ens:city ?city .
?cu ens:country 'Germany' .
?order rdf:type ens:Order .
?order ens:ordered_by ?customer .
?customer ens:city $City .
?customer ens:country $Country .
?employee ens:city $City .
?employee ens:country $Country .
𝜗1 : ? 𝑜𝑟 ⟼? 𝑜𝑟𝑑𝑒𝑟, ? 𝑐𝑢 ⟼? 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟
<Root-URI>/Orders ?$select=OrderID,Customers/CustomerID &$expand=Customers
𝜗2 : ? 𝑐𝑢 ⟼? 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟, ? 𝑐𝑖𝑡𝑦 ⟼ $𝐶𝑖𝑡𝑦
<Root-URI>/Customers?$select=CustomerID,City &$filter=Country eq 'Germany'
𝜗3 : ? 𝑐𝑢 ⟼? 𝑒𝑚𝑝𝑙𝑜𝑦𝑒𝑒, ? 𝑐𝑖𝑡𝑦 ⟼ $𝐶𝑖𝑡𝑦
<Root-URI>/Employees?$select=EmployeeID,City &$filter=Country eq 'Germany'
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
Public
11
Example
LeftJoin(BGP(?or
?or
BGP(?cu
?cu
rdf:type ens:Order.
ens:ordered_by ?cu),
ens:city ?city.
ens:country 'Germany'),true)
LeftJoin({𝜗1 },{𝜗2 , 𝜗3 },true) = {𝜗1 }
{𝜗2 , 𝜗3 } = {𝜗1 ∪ 𝜗2 }
𝜗1 ∪ 𝜗2 : ? 𝑜𝑟 ⟼? 𝑜𝑟𝑑𝑒𝑟, ? 𝑐𝑢 ⟼? 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟, ? 𝑐𝑖𝑡𝑦 ⟼ $𝐶𝑖𝑡𝑦
<Root-URI>/Orders ?$select=OrderID,Customers/CustomerID &$expand=Customers
<Root-URI>/Customers?$select=CustomerID,City &$filter=Country eq 'Germany'
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
Public
12
Conclusion

Motivation and problem

Simplify the retrieval of data from ERP-systems

Realization of SPARQL-endpoint based on a relational database is not possible

Solution

Semantic description of OData services

Evaluation semantics for graph templates

Concepts for the creation of OData URIs

Contributions

Simplification of specific queries

Integration of different systems

Integration of OData services into the Semantic Web
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
Public
13
Thank you
Contact information:
Marc Kirchhoff
Chemnitzer Straße 48, 01187 Dresden
+49 351 4811-6232
marc.kirchhoff@sap.com
© 2014 SAP AG or an SAP affiliate company. All rights reserved.