OpenLink Virtuoso - RDF Views



Exposing SQL Data as RDF

OpenLink Virtuoso Universal Server

Virtuoso RDF Views


Northwind Demo Database

Tables include:
Demo.demo.Customers

Demo.demo.Customers

Demo.demo.Orders:

Demo.demo.Orders


Northwind Demo Database: RDF View Definition Extract

Demo.demo.Customers: 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 .
... }}


Northwind Demo Database: RDF View Definition Extract

Demo.demo.Orders: 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 ;
... } }


Northwind Demo Database: Customer Table to RDF Entity Mapping

Customer Table to RDF Entity Mapping

Customer Table to RDF Entity Mapping Diagram



Northwind Demo Database: RDF Browser View - Customer

RDF Browser View: Customer


Northwind Demo Database: RDF Browser View - Order

RDF Browser View: Order


Example: Product Portfolio - Table View

Product Portfolio: Table View


Example: Product Portfolio - RDF View

Product Portfolio: RDF View


Meta-Schema Language

MSL Building Blocks

Organizational Enhancements

Quad Map Pattern

Quad Map Pattern - Example

graph <http://www.openlinksw.com/oplweb>
subject p:product_iri (oplweb2.oplweb.product.product_id)
predicate p:description
object oplweb2.oplweb.product.product_description

Alternative SPARQL-Style Notation

graph <http://www.openlinksw.com/oplweb>
{
  p:product_iri (oplweb2.oplweb.product.product_id) p:description
  oplweb2.oplweb.product.product_description .
}

Named Quad Map Patterns

Named Quad Map Patterns

Group Map Patterns

Group Map Patterns

Quad Storage

IRI Classes - Creating IRIs from Keys

 sparql
 prefix prd: <http://www.openlinksw.com/schemas/oplweb/product#>
 create iri class prd:product_iri
  "http://www.openlinksw.com/oplweb/product#%s"
  (
  in product_id varchar not null
  ) .

IRI Classes - Format Strings

IRI Classes - Format Strings

IRI Classes - Complex Conversions

Literal classes / Identity classes

Quad Pattern Construction Rules

A Simple RDF View Definition

prefix p: http://www.openlinksw.com/schemas/oplweb/product#
prefix pc: <http://www.openlinksw.com/schemas/oplweb/product_category#>

alter quad storage virtrdf:DefaultQuadStorage
from oplweb2.oplweb.product as product_tbl
from oplweb2.oplweb.product_category as product_category_tbl
{
create virtrdf:product_portfolio as graph <http://www.openlinksw.com/oplweb/>
  {
  p:product_iri(product_tbl.product_id) a p:Product
    as virtrdf:product_product_id ;
  p:details product_tbl.long_description
    as virtrdf:product_long_description ;
  p:product_category pc:product_category_iri(product_tbl.product_cat_id)
    as virtrdf:product_product_cat_id .

  pc:product_category_iri(product_category_tbl.product_cat_id)
    a pc:ProductCategory
    as virtrdf:product_category_product_cat_id ;
  ...
  } .
} .


Additional Meta Schema Language Features


Table Aliases

SQL Selection & Joins Through Filters

SQL Selection

SQL Selection


Associating Filters with Table Aliases

SQL Joins