SlideShare a Scribd company logo
OpenLink Virtuoso – RDF Views Exposing SQL Data as RDF
OpenLink Virtuoso Universal Server Cross-platform server for SQL, XML and RDF data management Includes Virtual database engine Web services deployment platform Web application server SPARQL support and an RDF data store tightly integrated with its relational storage engine
Virtuoso RDF Views Expose pre-existing relational data as virtual RDF graphs Available for querying through SPARQL or SPASQL (SPARQL embedded in SQL) No physical regeneration of relational data
Northwind Demo Database Tables include: Demo.demo.Orders Demo.demo.Customers varchar(24) varchar(24) varchar(15) varchar(10) varchar(15) varchar(60) varchar(30) varchar(30) varchar(40) varchar(5) Mexico Mexico Germany Country (171) 555 - 7788 (5) 555 -4729 030 - 0074321 Phone 05023 05021 12209 Postal Code Avda. de la Constitucion 2222 Avda. de la Constitucion 2222 Obere Str. 57 Address Mexico D.F. Mexico D.F. Berlin City (5) 555 - 3745 Owner Ana Trujillo Ana Trujillo Emparedados y helados ANATR (171) 555 - 6759 Owner Antonio Moreno Antonio Moreno Taqueria ANTON 030 - 0076545 Sales Represe-ntative Maria Anders Alfreds Futterkiste ALFKI Fax Contact Title Contact Name Company  Name Customer ID … 2 1995-11-13 1995-12-01 1995-11-03 4 ALFKI 10692 … … … … 1 Ship Via … 1995-10-23 Required Date … 1995-10-03 Shipped Date … … … 1995-09-25 6 ALFKI 10643 Order Date Employee ID Customer ID Order ID
Northwind Demo Database: RDF View Definition Extract 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 … { Demo.demo.Customers Northwind RDF View Definition 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 . Country Phone Postal Code Address City Fax Contact Title Contact Name Company  Name Customer ID
Northwind Demo Database: RDF View Definition Extract 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 … { Demo.demo.Orders Northwind RDF View Definition 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 ; Shipped Via … Required Date Shipped Date Order Date Employee  ID Customer ID Order ID
Northwind Demo Database: Customer Table to RDF Entity Mapping Orders Table Germany Country 030 - 0074321 Phone 12209 Postal Code Obere Str. 57 Address Berlin City 030 - 0076545 Sales Represe-ntative Maria Anders Alfreds Futterkiste ALFKI Fax Contact Title Contact Name Company  Name Customer ID companyName contactName contactTitle address city PostalCode country phone fax Alfreds Futterkiste Maria Anders Sales Representative Obere Str. 57 Berlin 12209 Germany 030-0074321 030-0076545 … Order/10643#this has_order Order/10692#this … has_order Customer/ALFKI#this prefix  <http://demo.openlinksw.com/Northwind/> has_customer has_customer … ALFKI 10643 … ALFKI 10692 … Customer ID Order  ID
Northwind Demo Database: RDF Browser View – Customer
Northwind Demo Database: RDF Browser View – Order
Example: Product Portfolio – Table View
Example: Product Portfolio – RDF View
Meta-Schema Language RDF Views =  Virtuoso RDF Meta-Schema +  Meta-Schema Language MSL = A domain specific, declarative language for mapping a logical SQL data model to a conceptual RDF data model
MSL Building Blocks Main building blocks: Quad map patterns IRI classes Literal classes Organizational enhancements Group map patterns Quad storage Naming
Organizational Enhancements Make it easier to administer large sets of quad map patterns Group map patterns  – group together map patterns sharing a common graph Quad storage  – groups together group map patterns as a named set Both allow map patterns to be altered/deleted individually or as a group
Quad Map Pattern Basic unit of meta schema Defines transformation from one set of relational columns into triples that match one SPARQL graph pattern Comprises 4 declarations of quad map values – each calculates a triple field value from the SQL data
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 graph <http://www.openlinksw.com/oplweb> { p:product_iri (oplweb2.oplweb.product.product_id) p:description oplweb2.oplweb.product.product_description as  virtrdf:product_product_description  . }
Group Map Patterns Quad map patterns for the same graph can be grouped together into a  group map pattern create virtrdf:product_portfolio as  graph <http://www.openlinksw.com/oplweb> { p:product_iri (oplweb2.oplweb.product.product_id)  a p:Product  as virtrdf:product_product_id ; p:description oplweb2.oplweb.product.product_description  as virtrdf:product_product_description . } group map pattern name
Quad Storage Quad storage = a named set of quad patterns Compartmentalizes the RDF to SQL mapping Contained quad patterns can be manipulated en-bloc drop quad storage   storage-name   create quad storage   storage-name   {   quad-map declarations  } alter quad storage   storage-name   {   quad-map declarations or  drop commands  } Map patterns can only be created inside a quad storage definition
IRI Classes – Creating IRIs from Keys IRI class – constructs a subject IRI for each primary key column value Defines how key values (for atomic or compound key) are combined into / decomposed from an IRI string 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 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 ) . Sprintf-style format string for performing conversion Other format specifiers supported. E.g. %d The reverse conversion is inferred automatically
IRI Classes – Complex Conversions For more complex conversions, functions can be specified that assemble and disassemble an IRI from/into its constituent parts create iri class prd:product_iri using function oplweb2.oplweb.product_uri (in id varchar) returns varchar, function oplweb2.oplweb.product_uri_inverse (in id_iri varchar) returns varchar . Functions product_uri and product_uri inverse would be defined elsewhere in Virtuoso/PL
Literal classes / Identity classes Non-key columns normally form the object of a triple Object component of an RDF triple can be an IRI or an RDF literal Literal classes create RDF literals from non-key column values Identity class  = special form of literal class Converts a SQL VARCHAR value into an untyped literal Converts values of other SQL data types to an appropriate XML Schema typed literal (e.g. xsd:integer or xsd:date) Need not be defined explicitly Invoked implicitly when a column name is used directly as the object in a quad map pattern
Quad Pattern Construction Rules An RDF View is defined by combining the building blocks described so far into a collection of quad patterns Each quad pattern can consist of: Subject : an IRI class or constant IRI Predicate : a constant IRI or an IRI class Object : an IRI class, literal class, literal IRI or a scalar Graph : a constant IRI or an IRI class Filter : an optional SQL search condition used to filter rows
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 and SQL joins through filters
Table Aliases Provide a concise alternative to fully qualified table names in map patterns Declared with a statement such as: from oplweb2.oplweb.product as product_tbl Declared once at the start of the storage declaration Because quad map patterns usually share a common set of source tables Shared between all the quad maps defined in the storage declaration
SQL Selection & Joins Through Filters SQL Projection Not always desirable to expose all the columns in a table or view Security reasons etc. Key column value may have no meaning beyond being a unique identifier which is transformed into an IRI Obvious – simply : omit defining quad map patterns for the relevant columns Omit property definitions for these columns in the RDFS class for the table
SQL Selection A quad map pattern can include a  condition i.e. a boolean SQL expression Filters out unwanted rows of source data SQL expression includes placeholders where a table reference should be printed from oplweb2.oplweb.product as product_tbl from oplweb2.oplweb.product_category as product_category_tbl graph <http://www.openlinksw.com/oplweb/> { . . . pc:product_category_iri(product_category_tbl.product_cat_id)   a pc:ProductCategory   as virtrdf:product_category_product_cat_id ; pc:includes_product p:product_iri(product_tbl.product_id)   where (^{product_tbl.}^.product_cat_id =^{product_category_tbl.}^.product_cat_id)   as virtrdf:product_category_product_collection . . . . } foreign key to IRI conversion primary key to IRI conversion
Associating Filters with Table Aliases An alternative to specifying filter conditions directly in quad patterns is to specify them alongside a table alias from DB.DBA.SYS_USERS as user where (^{user.}^.U_IS_ROLE = 0) from DB.DBA.SYS_USERS as group where (^{group.}^.U_IS_ROLE = 1) All map patterns using the alias are subject to the same filter condition If several aliases have associated conditions, the WHERE clause of the generated SQL contains a combination of all relevant conditions
SQL Joins As well as filtering, a quad map pattern condition can also specify join criteria Multiple conditions can be associated with a table alias For complex joins a quad map pattern can reference a SQL view joining multiple tables from DB.DBA.SYS_USERS as user where (^{user.}^.U_IS_ROLE = 0) from DB.DBA.SYS_USERS as group where (^{group.}^.U_IS_ROLE = 1) from DB.DBA.SYS_USERS as account from user as active_user where (^{active_user.}^.U_ACCOUNT_DISABLED = 0) from DB.DBA.SYS_ROLE_GRANTS as grant where (^{grant.}^.GI_SUPER = ^{account.}^.U_ID) where (^{grant.}^.GI_SUB = ^{group.}^.U_ID) where (^{grant.}^.GI_SUPER = ^{user.}^.U_ID)

More Related Content

PPT
Virtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data Sources
PDF
DataBearings: A semantic platform for data integration on IoT, Artem Katasonov
PDF
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
PPT
Deploying RDF Linked Data via Virtuoso Universal Server
PPTX
RDFa Tutorial
PPT
SPARQL Query Forms
PDF
Introduction to RDFa
PPT
Solving Real Problems Using Linked Data
Virtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data Sources
DataBearings: A semantic platform for data integration on IoT, Artem Katasonov
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
Deploying RDF Linked Data via Virtuoso Universal Server
RDFa Tutorial
SPARQL Query Forms
Introduction to RDFa
Solving Real Problems Using Linked Data

What's hot (20)

PDF
RDFa: introduction, comparison with microdata and microformats and how to use it
PPTX
"RDFa - what, why and how?" by Mike Hewett and Shamod Lacoul
PDF
Os riak1-pdf
PDF
Comparative study on the processing of RDF in PHP
PPTX
Publishing Linked Data 3/5 Semtech2011
PPTX
RESTful Web Services
PPTX
Introducing JDBC for SPARQL
PPTX
RDF SHACL, Annotations, and Data Frames
PPTX
LDAP Integration
PDF
Introduction to LDAP and Directory Services
PPTX
Solid pods and the future of the spatial web
PPTX
PPTX
Introduction to dotNetRDF
PDF
Is multi-model the future of NoSQL?
PPTX
dotNetRDF - A Semantic Web/RDF Library for .Net Developers
PDF
Ldap introduction (eng)
PPT
Facet: Building Web Pages with SPARQL
ODP
Data Integration And Visualization
PDF
Introduction to RDF
PPTX
Future of HCatalog - Hadoop Summit 2012
RDFa: introduction, comparison with microdata and microformats and how to use it
"RDFa - what, why and how?" by Mike Hewett and Shamod Lacoul
Os riak1-pdf
Comparative study on the processing of RDF in PHP
Publishing Linked Data 3/5 Semtech2011
RESTful Web Services
Introducing JDBC for SPARQL
RDF SHACL, Annotations, and Data Frames
LDAP Integration
Introduction to LDAP and Directory Services
Solid pods and the future of the spatial web
Introduction to dotNetRDF
Is multi-model the future of NoSQL?
dotNetRDF - A Semantic Web/RDF Library for .Net Developers
Ldap introduction (eng)
Facet: Building Web Pages with SPARQL
Data Integration And Visualization
Introduction to RDF
Future of HCatalog - Hadoop Summit 2012
Ad

Similar to RDF Views of SQL Data Power Point Presentation - 1 (20)

PPT
Investigating Community Implementation of the GoodRelations Ontology
PDF
IRJET- Data Retrieval using Master Resource Description Framework
PDF
RDF - Resource Description Framework and RDF Schema
PPTX
SWT Lecture Session 2 - RDF
PPTX
Enterprise knowledge graphs
PPT
Structured Dynamics' Semantic Technologies Product Stack
PDF
GoodRelations & RDFa for Deep Comparison Shopping on a Web Scale
PDF
Introduction to RDF & SPARQL
PDF
Culture Geeks Feb talk: Adventures in Linked Data Land
PPTX
Linking up your data
PPTX
Apa itu RDF dan SPARQL sebagai alat bantu pada big Data
PDF
Deploying PHP applications using Virtuoso as Application Server
PPT
Linked Data Tutorial
PPTX
Triple Stores
PPT
Rdf And Rdf Schema For Ontology Specification
PPT
Publishing data on the Semantic Web
PPTX
Sören Auer | Enterprise Knowledge Graphs
PPTX
Introduction to RDF Data Model
PPTX
Hacia la Internet del Futuro: Web Semántica y Open Linked Data, Parte 2
PDF
20th Feb 2020 json-ld-rdf-im-proposal.pdf
Investigating Community Implementation of the GoodRelations Ontology
IRJET- Data Retrieval using Master Resource Description Framework
RDF - Resource Description Framework and RDF Schema
SWT Lecture Session 2 - RDF
Enterprise knowledge graphs
Structured Dynamics' Semantic Technologies Product Stack
GoodRelations & RDFa for Deep Comparison Shopping on a Web Scale
Introduction to RDF & SPARQL
Culture Geeks Feb talk: Adventures in Linked Data Land
Linking up your data
Apa itu RDF dan SPARQL sebagai alat bantu pada big Data
Deploying PHP applications using Virtuoso as Application Server
Linked Data Tutorial
Triple Stores
Rdf And Rdf Schema For Ontology Specification
Publishing data on the Semantic Web
Sören Auer | Enterprise Knowledge Graphs
Introduction to RDF Data Model
Hacia la Internet del Futuro: Web Semántica y Open Linked Data, Parte 2
20th Feb 2020 json-ld-rdf-im-proposal.pdf
Ad

More from rumito (9)

PPT
Linked Data Driven Data Virtualization for Web-scale Integration
PPT
Open Conceptual Data Models
PPT
Virtuoso Universal Server Overview
PPT
Linked Data Planet Key Note
PPT
ESWC2008 SPARQL BI OpenLink- SPARQL for Business Intelligence
PPT
ESWC2008 Relational2RDF - Mapping Relational Databases to RDF with OpenLink V...
PPT
ESWC2008 Identity OpenLink - On The Evolution of Terms
PPT
Data Portability And Data Spaces
PPT
Virtuoso Relational To RDF Mapping
Linked Data Driven Data Virtualization for Web-scale Integration
Open Conceptual Data Models
Virtuoso Universal Server Overview
Linked Data Planet Key Note
ESWC2008 SPARQL BI OpenLink- SPARQL for Business Intelligence
ESWC2008 Relational2RDF - Mapping Relational Databases to RDF with OpenLink V...
ESWC2008 Identity OpenLink - On The Evolution of Terms
Data Portability And Data Spaces
Virtuoso Relational To RDF Mapping

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
KodekX | Application Modernization Development
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPT
Teaching material agriculture food technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Understanding_Digital_Forensics_Presentation.pptx
cuic standard and advanced reporting.pdf
Chapter 3 Spatial Domain Image Processing.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
KodekX | Application Modernization Development
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Network Security Unit 5.pdf for BCA BBA.
Unlocking AI with Model Context Protocol (MCP)
The Rise and Fall of 3GPP – Time for a Sabbatical?
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Empathic Computing: Creating Shared Understanding
sap open course for s4hana steps from ECC to s4
Dropbox Q2 2025 Financial Results & Investor Presentation
Teaching material agriculture food technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

RDF Views of SQL Data Power Point Presentation - 1

  • 1. OpenLink Virtuoso – RDF Views Exposing SQL Data as RDF
  • 2. OpenLink Virtuoso Universal Server Cross-platform server for SQL, XML and RDF data management Includes Virtual database engine Web services deployment platform Web application server SPARQL support and an RDF data store tightly integrated with its relational storage engine
  • 3. Virtuoso RDF Views Expose pre-existing relational data as virtual RDF graphs Available for querying through SPARQL or SPASQL (SPARQL embedded in SQL) No physical regeneration of relational data
  • 4. Northwind Demo Database Tables include: Demo.demo.Orders Demo.demo.Customers varchar(24) varchar(24) varchar(15) varchar(10) varchar(15) varchar(60) varchar(30) varchar(30) varchar(40) varchar(5) Mexico Mexico Germany Country (171) 555 - 7788 (5) 555 -4729 030 - 0074321 Phone 05023 05021 12209 Postal Code Avda. de la Constitucion 2222 Avda. de la Constitucion 2222 Obere Str. 57 Address Mexico D.F. Mexico D.F. Berlin City (5) 555 - 3745 Owner Ana Trujillo Ana Trujillo Emparedados y helados ANATR (171) 555 - 6759 Owner Antonio Moreno Antonio Moreno Taqueria ANTON 030 - 0076545 Sales Represe-ntative Maria Anders Alfreds Futterkiste ALFKI Fax Contact Title Contact Name Company Name Customer ID … 2 1995-11-13 1995-12-01 1995-11-03 4 ALFKI 10692 … … … … 1 Ship Via … 1995-10-23 Required Date … 1995-10-03 Shipped Date … … … 1995-09-25 6 ALFKI 10643 Order Date Employee ID Customer ID Order ID
  • 5. Northwind Demo Database: RDF View Definition Extract 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 … { Demo.demo.Customers Northwind RDF View Definition 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 . Country Phone Postal Code Address City Fax Contact Title Contact Name Company Name Customer ID
  • 6. Northwind Demo Database: RDF View Definition Extract 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 … { Demo.demo.Orders Northwind RDF View Definition 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 ; Shipped Via … Required Date Shipped Date Order Date Employee ID Customer ID Order ID
  • 7. Northwind Demo Database: Customer Table to RDF Entity Mapping Orders Table Germany Country 030 - 0074321 Phone 12209 Postal Code Obere Str. 57 Address Berlin City 030 - 0076545 Sales Represe-ntative Maria Anders Alfreds Futterkiste ALFKI Fax Contact Title Contact Name Company Name Customer ID companyName contactName contactTitle address city PostalCode country phone fax Alfreds Futterkiste Maria Anders Sales Representative Obere Str. 57 Berlin 12209 Germany 030-0074321 030-0076545 … Order/10643#this has_order Order/10692#this … has_order Customer/ALFKI#this prefix <http://demo.openlinksw.com/Northwind/> has_customer has_customer … ALFKI 10643 … ALFKI 10692 … Customer ID Order ID
  • 8. Northwind Demo Database: RDF Browser View – Customer
  • 9. Northwind Demo Database: RDF Browser View – Order
  • 10. Example: Product Portfolio – Table View
  • 12. Meta-Schema Language RDF Views = Virtuoso RDF Meta-Schema + Meta-Schema Language MSL = A domain specific, declarative language for mapping a logical SQL data model to a conceptual RDF data model
  • 13. MSL Building Blocks Main building blocks: Quad map patterns IRI classes Literal classes Organizational enhancements Group map patterns Quad storage Naming
  • 14. Organizational Enhancements Make it easier to administer large sets of quad map patterns Group map patterns – group together map patterns sharing a common graph Quad storage – groups together group map patterns as a named set Both allow map patterns to be altered/deleted individually or as a group
  • 15. Quad Map Pattern Basic unit of meta schema Defines transformation from one set of relational columns into triples that match one SPARQL graph pattern Comprises 4 declarations of quad map values – each calculates a triple field value from the SQL data
  • 16. 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 . }
  • 17. Named Quad Map Patterns graph <http://www.openlinksw.com/oplweb> { p:product_iri (oplweb2.oplweb.product.product_id) p:description oplweb2.oplweb.product.product_description as virtrdf:product_product_description . }
  • 18. Group Map Patterns Quad map patterns for the same graph can be grouped together into a group map pattern create virtrdf:product_portfolio as graph <http://www.openlinksw.com/oplweb> { p:product_iri (oplweb2.oplweb.product.product_id) a p:Product as virtrdf:product_product_id ; p:description oplweb2.oplweb.product.product_description as virtrdf:product_product_description . } group map pattern name
  • 19. Quad Storage Quad storage = a named set of quad patterns Compartmentalizes the RDF to SQL mapping Contained quad patterns can be manipulated en-bloc drop quad storage storage-name create quad storage storage-name { quad-map declarations } alter quad storage storage-name { quad-map declarations or drop commands } Map patterns can only be created inside a quad storage definition
  • 20. IRI Classes – Creating IRIs from Keys IRI class – constructs a subject IRI for each primary key column value Defines how key values (for atomic or compound key) are combined into / decomposed from an IRI string 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 ) .
  • 21. IRI Classes – Format Strings 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 ) . Sprintf-style format string for performing conversion Other format specifiers supported. E.g. %d The reverse conversion is inferred automatically
  • 22. IRI Classes – Complex Conversions For more complex conversions, functions can be specified that assemble and disassemble an IRI from/into its constituent parts create iri class prd:product_iri using function oplweb2.oplweb.product_uri (in id varchar) returns varchar, function oplweb2.oplweb.product_uri_inverse (in id_iri varchar) returns varchar . Functions product_uri and product_uri inverse would be defined elsewhere in Virtuoso/PL
  • 23. Literal classes / Identity classes Non-key columns normally form the object of a triple Object component of an RDF triple can be an IRI or an RDF literal Literal classes create RDF literals from non-key column values Identity class = special form of literal class Converts a SQL VARCHAR value into an untyped literal Converts values of other SQL data types to an appropriate XML Schema typed literal (e.g. xsd:integer or xsd:date) Need not be defined explicitly Invoked implicitly when a column name is used directly as the object in a quad map pattern
  • 24. Quad Pattern Construction Rules An RDF View is defined by combining the building blocks described so far into a collection of quad patterns Each quad pattern can consist of: Subject : an IRI class or constant IRI Predicate : a constant IRI or an IRI class Object : an IRI class, literal class, literal IRI or a scalar Graph : a constant IRI or an IRI class Filter : an optional SQL search condition used to filter rows
  • 25. 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 ; ... } . } .
  • 26. Additional Meta Schema Language Features Table aliases SQL selection and SQL joins through filters
  • 27. Table Aliases Provide a concise alternative to fully qualified table names in map patterns Declared with a statement such as: from oplweb2.oplweb.product as product_tbl Declared once at the start of the storage declaration Because quad map patterns usually share a common set of source tables Shared between all the quad maps defined in the storage declaration
  • 28. SQL Selection & Joins Through Filters SQL Projection Not always desirable to expose all the columns in a table or view Security reasons etc. Key column value may have no meaning beyond being a unique identifier which is transformed into an IRI Obvious – simply : omit defining quad map patterns for the relevant columns Omit property definitions for these columns in the RDFS class for the table
  • 29. SQL Selection A quad map pattern can include a condition i.e. a boolean SQL expression Filters out unwanted rows of source data SQL expression includes placeholders where a table reference should be printed from oplweb2.oplweb.product as product_tbl from oplweb2.oplweb.product_category as product_category_tbl graph <http://www.openlinksw.com/oplweb/> { . . . pc:product_category_iri(product_category_tbl.product_cat_id) a pc:ProductCategory as virtrdf:product_category_product_cat_id ; pc:includes_product p:product_iri(product_tbl.product_id) where (^{product_tbl.}^.product_cat_id =^{product_category_tbl.}^.product_cat_id) as virtrdf:product_category_product_collection . . . . } foreign key to IRI conversion primary key to IRI conversion
  • 30. Associating Filters with Table Aliases An alternative to specifying filter conditions directly in quad patterns is to specify them alongside a table alias from DB.DBA.SYS_USERS as user where (^{user.}^.U_IS_ROLE = 0) from DB.DBA.SYS_USERS as group where (^{group.}^.U_IS_ROLE = 1) All map patterns using the alias are subject to the same filter condition If several aliases have associated conditions, the WHERE clause of the generated SQL contains a combination of all relevant conditions
  • 31. SQL Joins As well as filtering, a quad map pattern condition can also specify join criteria Multiple conditions can be associated with a table alias For complex joins a quad map pattern can reference a SQL view joining multiple tables from DB.DBA.SYS_USERS as user where (^{user.}^.U_IS_ROLE = 0) from DB.DBA.SYS_USERS as group where (^{group.}^.U_IS_ROLE = 1) from DB.DBA.SYS_USERS as account from user as active_user where (^{active_user.}^.U_ACCOUNT_DISABLED = 0) from DB.DBA.SYS_ROLE_GRANTS as grant where (^{grant.}^.GI_SUPER = ^{account.}^.U_ID) where (^{grant.}^.GI_SUB = ^{group.}^.U_ID) where (^{grant.}^.GI_SUPER = ^{user.}^.U_ID)