Corporate PPT Template - PowerPoint PPT Presentation

1 / 59
About This Presentation
Title:

Corporate PPT Template

Description:

'This presentation is for informational purposes only and may not be ... Sammy :fatherOf :Cathy) (:Sammy :fatherOf :Jack) (:Suzie :motherOf :Cathy) ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 60
Provided by: hpcr
Category:

less

Transcript and Presenter's Notes

Title: Corporate PPT Template


1
This presentation is for informational purposes
only and may not be incorporated into a contract
or agreement.
2
RDF Support in Oracle RDBMS
Oracle New England Development Center
3
Talk Outline
  • Introduction
  • Resource Description Framework (RDF)
  • Querying RDF data
  • RDF Support in Oracle 10g Release 2
  • Overview
  • Querying
  • Inference
  • Operations (loading, DDL, DML, Security)

4
Resource Description Framework (RDF)
5
RDF Graph
  • Types of elements URIs, Blank Nodes, and
    Literals
  • URIs http//www.oracle.com/peopleJohn
  • Blank Nodes _r1
  • Plain Literals John, color_at_en-us
  • Typed Literals 16xsdint, Johnxsdstring
  • RDF Triples ltsubject predicate objectgt
  • Subject URIs or Blank Nodes
  • Predicate URIs
  • Objects URIs, Blank Nodes, or Literals
  • A set of RDF triples constitute an RDF graph

6
Family Schema
Male
fatherOf
brotherOf
siblingOf
Person
parentOf
motherOf
sisterOf
Female
rdfssubClassOf
rdfsrange
rdfsdomain
rdfssubPropertyOf
7
RDF Graph Example
  • Family Classes and Properties
  • (Male rdfssubClassOf Person)
  • (Female rdfssubClassOf Person)
  • (fatherOf rdfssubPropertyOf parentOf)
  • (motherOf rdfssubPropertyOf parentOf)
  • (brotherOf rdfssubPropertyOf siblingOf)
  • (sisterOf rdfssubPropertyOf siblingOf)

8
RDF Graph Example
  • Family Domains and Ranges of Properties
  • (fatherOf rdfsdomain Male)
  • (fatherOf rdfsrange
    Person)
  • (motherOf rdfsdomain Female)
  • (motherOf rdfsrange Person)
  • (brotherOf rdfsdomain Male)
  • (brotherOf rdfsrange Person)
  • (sisterOf rdfsdomain Female)
  • (sisterOf rdfsrange
    Person)

9
Family Data
Janice
John
Martha
Matt
Suzie
Sammy
Cindy
Tom
Jack
Cathy
Female
Male
fatherOf
motherOf
rdftype
sisterOf
10
RDF Graph Example
  • Family Data
  • (John fatherOf Suzie)
  • (John fatherOf Matt)
  • (Janice motherOf Suzie)
  • (Janice motherOf Matt)
  • (Sammy fatherOf Cathy)
  • (Sammy fatherOf Jack)
  • (Suzie motherOf Cathy)
  • (Suzie motherOf Jack)

Family Data (Matt fatherOf
Tom) (Matt fatherOf Cindy) (Martha
motherOf Tom) (Martha motherOf
Cindy) (Jack rdftype Male) (Tom
rdftype Male) (Cindy rdftype
Female)
11
Querying RDF data
12
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)

13
RDF Query Example
  • Graph-pattern Find
  • ltgrandpa, parent, grandchildgt
  • (?x fatherOf ?y)
  • (?y parentOf ?z)
  • Bindings
  • x John y Suzie z Cathy
  • x John y Suzie z Jack
  • x John y Matt z Tom
  • x John y Matt z Cindy

Matching subgraphs (John fatherOf
Suzie) (Suzie parentOf
Cathy) (John fatherOf
Suzie) (Suzie parentOf Jack) (John
fatherOf Matt) (Matt
parentOf Tom) (John fatherOf
Matt) (Matt parentOf Cindy)
14
RDF Support in Oracle 10g R2
15
Overview
  • RDF Storage and Inference
  • Model ? RDF graph consisting of a set of triples
  • Rulebase ? Set of (user-defined) rules
  • Rules Index ? Inferred triples
  • RDF Query
  • SDO_RDF_MATCH Table Function

16
Components
Appl. Tables

Rulebase 1
Rulebase 2
Rulebase m
A1
Model 1
RDF Query
DDL Load DML
Rules Index 1
Rules Index 2
Model 2
A2


Rules Index p
An
Model n
17
RDF Query
18
RDF Querying Approach
  • New language approach
  • Create new (declarative, SQL-like) languages
    e.g., RQL, SeRQL, TRIPLE, Versa, SPARQL, RDQL,
    RDFQL, SquishQL
  • 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

19
Embedding RDF Query in SQL
  • SELECT
  • FROM , TABLE (
  • ) t,
  • WHERE

RDF Query (expressed via SDO_RDF_MATCH invocation)
20
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

21
RDF Query Example
  • select from TABLE(SDO_RDF_MATCH(
  • '(?f rdftype Female)', -- find all
    the females in the family
  • SDO_RDF_Models('family'),
  • null,
  • SDO_RDF_Aliases(
  • SDO_RDF_Alias('', 'http//www.example.org/f
    amily/')),
  • null))
  • Table Function returns a two-column table

f varchar2
frdfVTYP varchar2
22
SDO_RDF_MATCH Table Func
  • Each returned row contains one (or more) of the
    following
  • cols (of type VARCHAR2) for each variable ?x in
    graph-pattern

23
Query Projection Optimization
  • select m from TABLE(SDO_RDF_MATCH(
  • '(?m rdftype Male)',
  • SDO_RDF_Models('family'),
  • null,
  • SDO_RDF_Aliases(
  • SDO_RDF_Alias('', 'http//www.example.org/f
    amily/')),
  • null))
  • M
  • --------------------------------------------------
    ------------------------------
  • http//www.example.org/family/Jack
  • http//www.example.org/family/Tom
  • Table function returns a single-column table M

24
Matching multiple representations of a value
  • The same point in value space may have multiple
    representations
  • 10xsdInteger
  • 10xsdPositiveInteger
  • 010xsdInteger
  • 10.00xsddecimal
  • SDO_RDF_MATCH automatically resolves these

25
Join with SQL tables Example
  • Find salary and hiredate of Matts grandfather(s)
  • SELECT emp.name, emp.salary, emp.hiredateFROM
    emp, TABLE(SDO_RDF_MATCH(
    (?x fatherOf ?y)
    (?y parentOf Matt)
    (?x name ?name),
    SDO_RDF_Models(family'),
    )) tWHERE emp.namet.name

26
Join Example 2
  • Find pairs of persons residing at the same
    address where the first person rents a truck and
    the second person buys a fertilizer
  • SELECT t3.x name1, t3.y name2FROM AddrTable t1,
    AddrTable t2, TABLE(SDO_RDF_MATCH(
    '(?x rents ?a) (?a
    rdftype Truck) (?y
    buys ?b) (?b rdftype Fertilizer)',
    SDO_RDF_Models('Activities,

    Vehicles_ont, Chemicals_ont),
    )) t3WHERE t1.namet3.x and t2.namet3.y
    and t1.addrt2.addr

27
Inference
28
Components
Appl. Tables

Rulebase 1
Rulebase 2
Rulebase m
A1
Model 1
RDF Query
DDL Load DML
Rules Index 1
Rules Index 2
Model 2
A2


Rules Index p
An
Model n
29
Rulebases
30
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

31
Rulebase Example
  • Oracle supplied, pre-loaded rulebases e.g., RDFS
  • rdfssubClassOf is transitive and reflexive
  • Antecedent (?x rdftype ?y) (?y
    rdfssubClassOf ?c)
  • Consequent (?x rdftype ?c)
  • Antecedent (?x ?p ?y) (?p rdfsdomain ?c)
  • Consequent (?x rdftype ?c)
  • Rules in a rulebase family_rb
  • Antecedent (?x parentOf ?y) (?y parentOf
    ?z)
  • Consequent (?x grandParentOf ?z)

32
Rules Indexes
33
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

34
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

35
RDF Query with Inference
36
SDO_RDF_MATCH with Rulebases
  • Arguments
  • Graph Pattern
  • RDF Data set
  • A set of RDF models
  • A set of Rulebases
  • Filters
  • Aliases
  • Example
  • SDO_RDF_Rulebases (RDFS, Family_RB)

37
Query w/ RDFSFamily Inference
  • select x, y from TABLE(SDO_RDF_MATCH(
  • '(?x grandParentOf ?y) (?x rdftype
    Male)',
  • SDO_RDF_Models('family'),
  • SDO_RDF_Rulebases('RDFS', 'family_rb'),
  • SDO_RDF_Aliases(
  • SDO_RDF_Alias('','http//www.example.org/fa
    mily/')),
  • null))
  • X Y
  • --------------------------------------------------
    ---- ---------------------------------------------
    --------
  • http//www.example.org/family/John http//www.exam
    ple.org/family/Cindy
  • http//www.example.org/family/John http//www.exam
    ple.org/family/Tom
  • http//www.example.org/family/John http//www.exam
    ple.org/family/Jack
  • http//www.example.org/family/John http//www.exam
    ple.org/family/Cathy

38
Operations
39
Components
Appl. Tables

Rulebase 1
Rulebase 2
Rulebase m
A1
Model 1
RDF Query
DDL Load DML
Rules Index 1
Rules Index 2
Model 2
A2


Rules Index p
An
Model n
40
RDF Model operations
41
Model DDL
  • Procedures provided as part of the API to
  • Create a model
  • Drop a model
  • When a user creates a model, a database view gets
    created automatically
  • RDFM_family
  • A model corresponds to a column of type
    SDO_RDF_TRIPLE_S in an application table
  • Each model has exactly one application table
    column associated with it

42
Model DDL ? Creating a Model
  • Create an Application Table
  • CREATE TABLE family_table (, family_triple
    SDO_RDF_TRIPLE_S, )
  • Create a Model
  • exec SDO_RDF.CREATE_RDF_MODEL('family',
    'family_table', 'family_triple')
  • Automatically creates a database view
  • RDFM_family ()

43
Loading RDF Data into Oracle
  • Java API provided to load RDF data in NTriple
    format

44
Model DML
  • SQL DML commands may be used to do DML operations
    on a application table to effect DML (i.e.,
    triple insert, delete, and update) on the
    corresponding model
  • Insert Triples
  • INSERT INTO family_table VALUES (1,
  • SDO_RDF_TRIPLE_S(family',
  • 'lthttp//example.org/family/Johngt',
  • 'lthttp//example.org/family/fatherOfgt',
  • lthttp//example.org/family/Suziegt'))

45
Model Security
  • The creator of the application table
    corresponding to a model can grant privileges to
    other users
  • To perform DML to a model, a user must have DML
    privileges for the corresponding application
    table
  • The creator of a model can grant SELECT
    privileges on the corresponding database view to
    other users
  • A user can query only those models for which s/he
    has SELECT privileges (via corresponding DB
    views)
  • Only the creator of a model can drop the model

46
Model Views
  • RDFM_ltmode-namegt
  • Contains list of triples for an RDF model

47
Rulebase operations
48
Rulebase DDL
  • Procedures provided as part of the API may be
    used to
  • Create a rulebasecreate_rulebase('family_rb')
  • Drop a rulebase
  • drop_rulebase('family_rb')
  • When a user creates a rulebase, a database view
    gets created automatically
  • RDFR_family_rb (rule_name, antecedents,
    filter, consequents, aliases)

49
Rulebase DML
  • SQL DML commands may be used on the database view
    corresponding to a target rulebase to insert,
    delete, and update rules
  • insert into mdsys.RDFR_family_rb values(
    grandParent_rule', (?x parentOf ?y) (?y
    parentOf ?z), NULL, '(?x grandParentOf
    ?z)', SDO_RDF_Aliases())

50
Rulebase Security
  • Creator of a rulebase can grant privileges on the
    corresponding database view to other users
  • Performing DML operations requires invoker to
    have appropriate privileges on the database view
  • Only the creator of a rulebase can drop the
    rulebase

51
Rulebase Views
  • RDF_RULEBASE_INFO
  • Contains the list of rulebases
  • For each rulebase, contains additional
    information (such as, creator, view name, etc)
  • RDFR_ltrulebase-namegt
  • Shows content of each rulebase consisting of its
    list of rules and for each rule, its name,
    antecedents, filter, consequents, and aliases

52
Rules Index operations
53
Rules Index DDL
  • Procedures provided as part of the API to
  • Create a rules indexcreate_rules_index
    ('family_rb_rix_family, SDO_RDF_Models
    ('family'), SDO_RDF_Rulebases
    (rdfs','family_rb'))
  • Drop a rules indexdrop_rules_index
    ('family_rb_rix_family')
  • When a user creates a rules index, a database
    view gets created automatically
  • RDFI_family_rb_rix_family ()

54
Rules Index Dependencies
  • Content of a rules index depends upon the content
    of each element of its dataset
  • Any modification to the models or rulebases in
    its dataset invalidates the rules index
  • Insertion VALID ? INCOMPLETE
  • Deletion/Update VALID ? INVALID
  • Dropping a model or rulebase will drop dependent
    rules indexes automatically.

55
Rules Index Security
  • To create a rules index on an RDF dataset (models
    and rulebases), user needs to have SELECT
    privileges on those models and rulebases
  • Creator of a rules index holds SELECT privilege
    on the rules index and may grant this privilege
    to other users
  • Only the creator of a rules index can drop it

56
Rule Index Views
  • RDFI_ltrules-index-namegt
  • Contains the list of inferred triples
  • RDF_RULESINDEX_INFO
  • Contains the list of rules indexes
  • For each rules index, contains additional
    information (such as, creator, status, etc)
  • RDF_RULESINDEX_DATASETS
  • For every rules index, contains the names of its
    models and rulebases

57
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_tec
    hnologies/index.html

58
A
59
Query w/ RDFS Inference
  • select m from TABLE(SDO_RDF_MATCH(
  • '(?m rdftype Male)',
  • SDO_RDF_Models('family'),
  • SDO_RDF_Rulebases('RDFS'),
  • SDO_RDF_Aliases(
  • SDO_RDF_Alias('', 'http//www.example.org/f
    amily/')),
  • null))
  • M
  • --------------------------------------------------
    ------------------------------
  • http//www.example.org/family/Jack
  • http//www.example.org/family/Tom
  • http//www.example.org/family/John
  • http//www.example.org/family/Matt
  • http//www.example.org/family/Sammy

60
Join w/ Inference Example
  • Find salary and hiredate of Matts grandfathers
  • SELECT emp.name, emp.salary, emp.hiredateFROM
    emp, TABLE(SDO_RDF_MATCH(
    '(?x grandParentOf Matt)
    (?x rdftype Male)
    (?x name ?name)',
    SDO_RDF_Models('family'),
    SDO_RDF_Rulebases(RDFS',
    'family_rb'), )) tWHERE
    emp.namet.name

61
Join w/ Inference Example 2
  • Find pairs of persons residing at the same
    address where the first person rents a truck and
    the second person buys a fertilizer
  • SELECT t3.x name1, t3.y name2FROM AddrTable t1,
    AddrTable t2, TABLE(SDO_RDF_MATCH(
    '(?x rents ?a) (?a
    rdftype Truck) (?y
    buys ?b) (?b rdftype Fertilizer)',
    SDO_RDF_Models('Activities'),
    SDO_RDF_Rulebases(RDFS')
    , )) t3WHERE t1.namet3.x and
    t2.namet3.y and t1.addrt2.addr

62
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com