(Exposing SQL Data as RDF)
Orri Erling
Program Manager - OpenLink
Virtuoso
oerling@openlinksw.com
Tables include:
Demo.demo.Customers
Demo.demo.Orders:
Demo.demo.Customers:
Northwind RDF View Definition
prefix northwind: <http://www.openlinksw.com/schemas/northwind#>
...
create iri class northwind:Customer
<http://^{URIQADefaultHost}^/Northwind/Customer/%U#this>
(in customer_id varchar not null)
...
alter quad storage virtrdf:DefaultQuadStorage
...
from Demo.demo.Customers as customers
from Demo.demo.Orders as orders ...{
create virtrdf:NorthwindDemo
as graph iri ("http://^{URIQADefaultHost}^/Northwind") {
...
northwind:Customer(customers.CustomerID) a foaf:Organization
as virtrdf:Customer-CustomerID ;
northwind:companyName customers.CompanyName as ... ;
...
northwind:fax customers.Fax as virtrdf:Customer-fax .
northwind:Customer(orders.CustomerID)
northwind:has_order northwind:Order(orders.OrderID)
as virtrdf:Order-has_order .
...
}}
Demo.demo.Orders:
Northwind RDF View Definition
prefix northwind: <http://www.openlinksw.com/schemas/northwind#>
...
create iri class northwind:Order
<http://^{URIQADefaultHost}^/Northwind/Order/%d#this>
(in order_id integer not null) .
...
alter quad storage virtrdf:DefaultQuadStorage
...
from Demo.demo.Customers as customers
from Demo.demo.Orders as orders ... {
create virtrdf:NorthwindDemo
as graph iri ("http://^{URIQADefaultHost}^/Northwind") {
...
northwind:Order (orders.OrderID) a northwind:Order
as virtrdf:Order-Order ;
northwind:orderDate orders.OrderDate
as virtrdf:Order-order_date ;
northwind:requiredDate orders.RequiredDate
As virtrdf:Order-required_date ;
...
northwind:has_customer northwind:Customer (orders.CustomerID)
as virtrdf:Order-order_has_customer
northwind:has_employee northwind:Employee (orders.EmployeeID)
as virtrdf:Order-order_has_employee ;
...
} }