Slideshare.net (beta)

 
Post: 
Myspace Hi5 Friendster Xanga LiveJournal Facebook Blogger Tagged Typepad Freewebs BlackPlanet gigya icons



All comments

Add a comment on Slide 1

If you have a SlideShare account, login to comment; else you can comment as a guest


Showing 1-50 of 0 (more)

RDF Views of SQL Data Power Point Presentation - 1

From rumito, 8 months ago

RDF Views of SQL Data Power Point Presentation

789 views  |  0 comments  |  0 favorites
 

Groups/Events

Not added to any group/event

 
 

Privacy InfoNew!

This slideshow is Public

 
Embed in your blog
Embed (wordpress.com)
custom

Slideshow Statistics
Total Views: 789
on Slideshare: 789
from embeds: 0* * Views from embeds since 21 Aug, 07

Slideshow transcript

Slide 1: OpenLink Virtuoso – RDF Views Exposing SQL Data as RDF © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 4: Northwind Demo Database Tables include: Demo.demo.Customers Customer ID Company Contact Contact Address City Postal Country Phone Fax Name Name Code Title varchar(5) varchar(40) varchar(30) varchar(30) varchar(60) varchar(15) varchar(10 varchar(15) varchar(24) varchar(24) ) ALFKI Alfreds Maria Sales Obere Str. 57 Berlin 12209 Germany 030 - 030 - Futterkiste Anders Represe- 0074321 0076545 ntative ANATR Ana Trujillo Ana Trujillo Owner Avda. de la Mexico 05021 Mexico (5) 555 (5) 555 - Emparedados Constitucion D.F. -4729 3745 y helados 2222 ANTON Antonio Antonio Owner Avda. de la Mexico 05023 Mexico (171) 555 - (171) 555 - Moreno Moreno Constitucion D.F. 7788 6759 Taqueria 2222 Demo.demo.Orders Order ID Customer Employee Order Required Shipped Date Ship Via … ID ID Date Date 10643 ALFKI 6 1995-09-25 1995-10-23 1995-10-03 1 … 10692 ALFKI 4 1995-11-03 1995-12-01 1995-11-13 2 … … … … … … … … © 2007 OpenLink Software, All rights reserved

Slide 5: Northwind Demo Database: RDF View Definition Extract Customer Company Contact Contact Address City Postal Country Phone Fax Demo.demo.Customers ID Name Name Code Title 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 . … }} © 2007 OpenLink Software, All rights reserved

Slide 6: Northwind Demo Database: RDF View Definition Extract Order ID Customer Employee Order Required Shipped Shipped … Demo.demo.Orders ID Date Date Via ID Date 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 ; … }} © 2007 OpenLink Software, All rights reserved

Slide 7: Northwind Demo Database: Customer Table to RDF Entity Mapping Customer Company Contact Contact Address City Postal Country Phone Fax ID Name Name Code Title ALFKI Alfreds Maria Sales Obere Str. 57 Berlin 12209 Germany 030 - 030 - Futterkiste Anders Represe- 0074321 0076545 ntative prefix <http://demo.openlinksw.com/Northwind/> has_customer has_order Customer/ALFKI#this Order/10643#this has_order companyName Order/10692#this has_customer Alfreds … … Futterkiste contactName fax 030-0076545 Maria contactTitle PostalCode Anders phone 12209 Orders Table 030-0074321 address city Order Customer … country Sales ID ID Berlin Representative Germany 10643 ALFKI … 10692 ALFKI … Obere Str. 57 © 2007 OpenLink Software, All rights reserved

Slide 8: Northwind Demo Database: RDF Browser View – Customer © 2007 OpenLink Software, All rights reserved

Slide 9: Northwind Demo Database: RDF Browser View – Order © 2007 OpenLink Software, All rights reserved

Slide 10: Example: Product Portfolio – Table View © 2007 OpenLink Software, All rights reserved

Slide 11: Example: Product Portfolio – RDF View © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 13: MSL Building Blocks  Main building blocks:  Quad map patterns  IRI classes  Literal classes  Organizational enhancements  Group map patterns  Quad storage  Naming © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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 . } © 2007 OpenLink Software, All rights reserved

Slide 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 . } © 2007 OpenLink Software, All rights reserved

Slide 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 group map pattern name 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 . } © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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 ). © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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 ; ... }. }. © 2007 OpenLink Software, All rights reserved

Slide 26: Additional Meta Schema Language Features  Table aliases  SQL selection and SQL joins through filters © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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/> primary key to IRI conversion { ... pc:product_category_iri(product_category_tbl.product_cat_id) a pc:ProductCategory foreign key to IRI conversion 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 . ... } © 2007 OpenLink Software, All rights reserved

Slide 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 © 2007 OpenLink Software, All rights reserved

Slide 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) © 2007 OpenLink Software, All rights reserved