Document 13350754

advertisement
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
RDF Data Management
In Oracle10g
Jayant Sharma
Technical Director, Spatial
Oracle Server Technologies
Overview
•
•
•
•
Network Data Model
RDF Technology Background
RDF Data Model, Query, Rulebases
Summary
Managing Spatial Types in
Oracle10g
Road Networks
(directed graph)
Annotation
(text)
Zip Codes Boundaries
(polygons)
Oracle10g
Data
Spatial
Aerial Imagery
(raster)
Structured Topology
(parcels)
Business Addresses
(geocoded points)
Network Data Model (NDM)
• Feature of Oracle Spatial 10g
• Tool for managing graphs (networks) in the
database
• Supports directed and undirected networks
• spatial networks
• logical networks
• Consists of a network database schema, and a
Java API for representation and analysis.
Network Schema
• Network Metadata
• Name, Type, Node/Link/Path Table Information
•
•
Network Tables
Node Table
• Node_ID, Node_Type, Geometry,…
•
•
•
•
Link Table
• Link_ID, Link_Type, Start_Node_ID, End_Node_ID, Cost,
Geometry, …
Path Table
• Path_ID, Start_Node_ID, End_Node_ID, Cost, Geometry, Path
Links,…
• Application Information is added to network schema
Add additional columns in node, link, and path tables directly
Add foreign key(s) to node, link, and path tables
Network Data Model APIs
• PL/SQL Package: (server-side)
• Network data query and management
• Maintains referential integrity and validation
• Supports link/node/path updates
• Java API: (mid-tier or client side)
• Network loading/storage
• Network analysis
• Network Creation/Editing
• Java Functional Extensibility
• Network, Node, Link, Path are Java Interfaces
• Application-based network analysis extensions
Oracle 10g RDF Approach:
• Extended existing Oracle10g network (graph) data
model (NDM) to support RDF object types
• Support for user-defined rules, rulebases, rules indexes
• RDF data model with (user-defined) rules to support
inferencing
• Enable combined SQL query of enterprise database
and RDF graphs
• Support large, complex models (10s of millions
statements)
• Easily extensible by 3rd party tools/apps
RDF Graph
• Types of elements: URIs, Blank Nodes, and Literals
• URIs: http://www.oracle.com/people#John
• Blank Nodes: _:r1
• Plain Literals: “John”, “color”@en-us
• Typed Literals: “16”^^xsd:int, “John”^^xsd:string
• RDF Triples: <subject predicate object>
• Subject: URIs or Blank Nodes
• Predicate: URIs
• Objects: URIs, Blank Nodes, or Literals
• A set of RDF triples constitute an RDF graph
Family: Schema
:Male
:fatherOf
:parentOf
:brotherOf
:siblingOf
:Person
:motherOf
:sisterOf
:Female
rdfs:subClassOf
rdfs:domain
rdfs:range
rdfs:subPropertyOf
RDF Graph: Example
Family: Classes and Properties
(:Male
rdfs:subClassOf :Person)
(:Female rdfs:subClassOf :Person)
(:fatherOf rdfs:subPropertyOf :parentOf)
(:motherOf rdfs:subPropertyOf :parentOf)
(:brotherOf rdfs:subPropertyOf :siblingOf)
(:sisterOf rdfs:subPropertyOf :siblingOf)
RDF Graph: Example
Family: Domains and Ranges of Properties
(:fatherOf rdfs:domain
:Male)
(:fatherOf rdfs:range
:Person)
(:motherOf rdfs:domain
(:motherOf rdfs:range
:Female)
:Person)
(:brotherOf rdfs:domain
(:brotherOf rdfs:range
:Male)
:Person)
(:sisterOf
(:sisterOf
:Female)
:Person)
rdfs:domain
rdfs:range
Family: Data
:John
:Sammy
:Suzie
:Cathy
:Jack
:Janice
:Matt
:Tom
:Male
:fatherOf
:motherOf
:sisterOf
:Martha
:Cindy
:Female
rdf:type
Components
Appl.
Tables
A1
DDL
Load
DML
Rulebase Rulebase … Rulebase
1
2
m
Model 1
A2
Model 2
…
…
An
Model n
Rules
Index 1
Rules
Index p
Rules
Index 2
RDF
Query
Querying RDF data
RDF Querying Problem
• Given
• An RDF dataset (graphs) to be searched
• A graph-pattern containing a set of variables
• Find
• Subgraphs that match the graph-pattern
• Return
• Sets of variable bindings
• each set corresponds to a matching subgraph
(substitution in graph-pattern produces subgraph)
RDF Querying Approach
• SQL-based approach
• Introduces a SQL table function
SDO_RDF_MATCH that accepts RDF queries
• Benefits
• Leverage powerful constructs of SQL to process
RDF Query results
• Combine with SQL queries without staging
• Alternate approach
• Create new (declarative, SQL-like) languages
e.g., RQL, SeRQL, TRIPLE, Versa, SPARQL,
RDQL, RDFQL, SquishQL
Embedding RDF Query in SQL
SELECT …
FROM …, TABLE (
RDF Query
(expressed via
SDO_RDF_MATCH
invocation)
) t, …
WHERE …
SDO_RDF_MATCH Table Func
• Input Parameters
SDO_RDF_MATCH (
Query,
 graph-pattern (with variables)
Models,
 set of RDF models
Rulebases,  set of rulebases (e.g., RDFS)
Aliases,
 aliases for namespaces
Filter
 additional selection criteria
)
• Return type in definition is AnyDataSet
• Actual return type is determined at compile time
based on the arguments for each specific invocation
Query Example
select m from TABLE(SDO_RDF_MATCH(
'(?m rdf:type :Male)',
SDO_RDF_Models('family'),
null,
SDO_RDF_Aliases(
SDO_RDF_Alias('', 'http://www.example.org/family/')),
null));
M
-------------------------------------------------------------------------------http://www.example.org/family/Jack
http://www.example.org/family/Tom
Table function returns a single-column table: M
Join with SQL tables: Example
• Find salary and hiredate of Matt’s
grandfather(s)
• SELECT emp.name, emp.salary, emp.hiredate
FROM emp,
TABLE(SDO_RDF_MATCH(
‘(?x :fatherOf ?y)
(?y :parentOf :Matt)
(?x :name
?name)’,
SDO_RDF_Models(‘family'),
…)) t
WHERE emp.name=t.name;
Inference
Rulebase: Overview
• Each rulebase consists of a set of rules
• Each rule consists of
• antecedent: graph-pattern
• filter condition (optional)
• consequent: graph-pattern
• One or more rulebases may be used with
relevant RDF models (graphs) to infer new
data
Rulebase: Example
Oracle supplied, pre-loaded rulebases: e.g., RDFS
rdfs:subClassOf is transitive and reflexive
Antecedent: ‘(?x rdf:type ?y) (?y rdfs:subClassOf ?c)’
Consequent: ‘(?x rdf:type ?c)’
Antecedent: ‘(?x ?p ?y) (?p rdfs:domain ?c)’
Consequent: ‘(?x rdf:type ?c)’
Rules in a rulebase family_rb:
Antecedent: ‘(?x :parentOf ?y) (?y :parentOf ?z)’
Consequent: ‘(?x :grandParentOf ?z)’
Rules Index: Overview
• A rules index is created on an RDF dataset
(consisting of a set of RDF models and a set
of RDF rulebases)
• A rules index contains RDF triples inferred
from the model-rulebase combination
Rules Index: Example
• A rules index may be created on a dataset
consisting of
• family RDF data, and
• family_rb rulebase (shown earlier)
• The rules index will contain inferred triples
showing grandParentOf relationship
RDF Query with Inference
Query w/ RDFS+Family Inference
select x, y from TABLE(SDO_RDF_MATCH(
'(?x :grandParentOf ?y) (?x rdf:type :Male)',
SDO_RDF_Models('family'),
SDO_RDF_Rulebases('RDFS', 'family_rb'),
SDO_RDF_Aliases(
SDO_RDF_Alias('','http://www.example.org/family/')),
null));
X
Y
---------------------------------------------------------------------------------------------------------http://www.example.org/family/John
http://www.example.org/family/Cindy
http://www.example.org/family/John
http://www.example.org/family/Tom
http://www.example.org/family/John
http://www.example.org/family/Jack
http://www.example.org/family/John
http://www.example.org/family/Cathy
Some Oracle10g RDF Partners
•
•
•
•
•
Cerebra
Cognia
Siderean
Tom Sawyer
Top Quadrant
Summary
• Comprehensive, fully integrated into SQL RDF
support in Oracle 10g Release 2
•
•
•
•
Models (Graphs)
Rulebases
Rules Indexes
Query using SDO_RDF_MATCH table function
• Documentation and White Papers
http://www.oracle.com/technology/tech/semantic_technologies/index.html
Download