Oracle Database Semantic Technologies Tutorial

Transcription

Insert Picture Here Oracle Database Semantic Technologies Tutorial

Oracle Semantic Technologies Agenda Introduction Tutorial

Oracle Database Semantic Data Store A feature of Oracle Spatial 11g Option for Oracle Database 11gEnterprise Edition Requires Partitioning and Advanced Compression OptionsAn open and persisted RDF data model and analysis platform forsemantic applicationsAn RDF Data Model with inferencing (RDFS, OWL and user-definedrules)Performs SQL-based access to triples and inferred dataCombines SQL query of relational data with RDF graphs andontologiesSupports large graphs (billion triples)Easily extensible by 3rd party tools/apps

Only Oracle Database 11g Has an open, persistent, analytic semantic datamanagement platform Scalability – Trillions of triples Availability – tens of thousands of users Security – protect sensitive business data Performance – timely load, query & inference Accessibility – to enterprise applications Manageability – leverage IT resources Oracle Database Strengths

Oracle Customer Examples Enterprise Information Integration Hutchinson 3G Austria Large Public Dataset for Data Integration Uniprot dataset at the Swiss Institute of Bioinformatics Data Integration Yale University Stanford University University of Cincinnati Bio-surveillance University of Texas at Houston Re-use of Legacy Data Pharmaceutical companies

Semantic Data Management WorkflowTransactionSystemsUnstructuredContentRSS, emailOther DataFormatsDataSourcesEdit &Load, QueryApplications &Transform& InferenceAnalysis EntityExtraction &Transform OntologyEngineering RDF/OWL DataManagement GraphVisualization SQL & SPARQLQuery Link Analysis Inferencing StatisticalAnalysis Categorization Semantic Rules Faceted Search CustomScripting Scalability &Security Pattern Discovery Text Mining

Oracle Spatial 11g Semantic yRDF/OWLdata andontologiesOntologyAssistedQuery ofEnterprise DataIncr.DMLBatchLoadBulkLoad RDF/OWLdata Ontologies &rule basesRelationaldata

Semantic Data Management Tasks Create a new Semantic Network Create a RDF/OWL model Load RDF/OWL data Optionally create user-defined rulebases Infer new RDF/OWL data Query RDF/OWL data Perform Ontology-assisted Query

Tutorial Agenda RDF Concepts Using Oracle Database 11g as a SemanticData Store Jena Adaptor System Metadata and Views National Cancer Institute Ontology CaseStudy Best Practices

RDF Concepts Originally created to encode metadata such as ‘author’,‘date’, etc. for web resources. It has become popular to relate things in the real-worldsuch as people, places, concepts, schemas The basic unit of information (fact) is represented as subject, property, object triple Triples together form a graph, connecting pieces of ��32” xsd:decimal

TriplesEach triple represents a statement of a relationshipbetween the things denoted by the nodes that itlinks. Each triple has three parts:1. A subject,2. An object, and3. A predicate (also called a property) that denotes arelationship.The direction of the arc is significant: it always pointstoward the object.The nodes of an RDF graph are its subjects andobjects.

URIsA Uniform Resource Identifier (URI), is a compact string of charactersused to identify or name a resource. The main purpose of thisidentification is to enable interaction with representations of theresource over a network, typically the World Wide Web, using specificprotocols. URIs are defined in schemes defining a specific syntax andassociated protocols.

RDF TriplesHand Fracture:subClassOfArm Fracture RDF triple represents a directed labeled edge http://purl.uniprot.org/uniprot/Q4U9M9 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://purl.uniprot.org/core/Protein RDF triple set represents a directed labeled graph# uniprot:. rdf:type :Protein http://purl.uniprot.org/uniprot/Q4U9M9 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://purl.uniprot.org/core/Protein . http://purl.uniprot.org/uniprot/P15711 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://purl.uniprot.org/core/Protein . http://purl.uniprot.org/uniprot/Q43495 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://purl.uniprot.org/core/Protein . http://purl.uniprot.org/uniprot/P18646 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://purl.uniprot.org/core/Protein . http://purl.uniprot.org/uniprot/P13813 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://purl.uniprot.org/core/Protein .# other attributes http://purl.uniprot.org/uniprot/Q4U9M9 http://www.w3.org/2000/01/rdf-schema#seeAlso http://purl.uniprot.org/interpro/IPR007480 .

RDF Data Model RDF terms (values) can be of three types URIs Blank Nodes:x Literals“John”, “2004-12-21T11:22:33-05:00” xsd:dateTime,“0010” xsd:integer Positional constraints Predicatemust be a URI Subjectmust be a URI or a blank node Objectmust be a URI, blank node, or literal Set property Value-point basedequivalence URI URI Blank node URI Blank node Literal

OntologyA systematic arrangement of all of the importantcategories of objects or concepts which exist in somefield of discourse, showing the relations betweenthemThe Gene Ontology project provides a controlledvocabulary to describe gene and gene productattributes in any organismThe Protein Ontology (PO) provides a unifiedvocabulary for capturing declarative knowledgeabout protein domain and to classify thatknowledge to allow reasoning

Inferencing: Rules and RulebasesInferencing is the ability to make logical deductions based onrulesA rule is an object that can be applied to draw inferences fromsemantic data.A rule consists of:An IF side pattern for the antecedentsAn optional filter condition that further restricts the subgraphsA THEN side pattern for the consequentsFor example, the rule that a chairperson of a conference is alsoa reviewer of the conference could be represented as follows:('chairpersonRule', -- rule name'(?r :ChairPersonOf ?c)', -- IF side patternNULL, -- filter condition'(?r :ReviewerOf ?c)', -- THEN side pattern)

Rules IndexContains precomputed triplesInferred from model(s) and rulebase(s)Mandatory when using SEM MATCH (for eachrulebase-model combination)Use SEM APIS.CREATE RULES INDEX tocreate a rules indexView under MDSYS is created (SEMI rules-indexname)BEGINSEM APIS.CREATE RULES INDEX('rdfs rix family',SEM Models('family'),SEM Rulebases('RDFS','family rb'));END;/

Tutorial Agenda RDF Concepts Using Oracle Database 11g as a SemanticData Store Jena Adaptor System Metadata and Views National Cancer Institute Ontology CaseStudy Best Practices

Introducing the Family Tree Use Case John and Janice have two children:Suzie and Matt. Matt married Martha, and they havetwo children:Tom (male, height 5.75) andCindy (female, height 06.00) Suzie married Sammy,they have two children:Cathy (height 5.8) andJack (male, height 6).

Family Tree Classes and Properties Person is a class that has twosubclasses:Male and Female siblingOf is a property that hastwo subproperties:brotherOf and sisterOf parentOf is a property that has twosubproperties:fatherOf and motherOf

Family Tree Domains The domain of the fatherOf andbrotherOf properties is Male The domain of the motherOf andsisterOf properties is Female

Using Oracle Database 11g as aSemantic Data Store Create a Semantic Network Create an RDF/OWL model Load RDF/OWL data Infer RDF/OWL data Query RDF/OWL data and ontologies Perform Ontology-assisted Query of relational data

Creating a Semantic Network and Model Creating a Semantic Network Generates all RDF% tables and views under userMDSYS Creating a RDF/OWL model Create a table with a column of typeSDO RDF TRIPLE S Optionally choose a tablespace for the model

Entities in a Semantic NetworkApplicationTables withscottRDF objecttype columnsRDF/OWLdata andontologiesVocabularies and RulebasesOWLsubsetRDF /RDFS RulebasemRModel 1A1hermanA2Model 2scott RAnModel nInferredTriple Set 1InferredTriple Set 2InferredTriple Set pRules Indexes(Derived data)ROracle DB Semantic Network (inside MDSYS)

Security & Access Control Models A database view owned by MDSYS created at model creation Creator gets SELECT privilege with GRANT option DML on a model is done via DML on the associated RDF objecttype column and requires invoker to have appropriate privilegeson the associated application table Rulebases Database view owned by MDSYS created at rulebase creation Creator gets SELECT and DML privilege with GRANT option Rules Indexes (Inferred Triple Sets) Database view owned by MDSYS created at rules index creation Creator must have SELECT privilege on underlying model andrulebase views Creator gets SELECT privilege with GRANT option

Create a Semantic Network Connected as sys as sysdba Install the Oracle Database 11.1.0.6 patch set antic technologies/index.html Run ?/md/admin/catsem11i.sql See MetaLink Note 472876.1 What Are The Tasks For a DBA To SetupSemantic Models In The Database Create a tablespace for the system tablesCREATE TABLESPACE rdf tblspace DATAFILE'/oradata/orcl/rdf tblspace.dat' SIZE 1024MAUTOEXTEND ON NEXT 256M MAXSIZE 16384M; Create a semantic data networkEXECUTE SEM APIS.CREATE SEM NETWORK('rdf tblspace');* This generates allMDSYSRDF% tables and views under user

Create an RDF Modelof Family Relationships Create a table to store references to the semantic data,include a column of type SDO RDF TRIPLE SCREATE TABLEfamily rdf data(id NUMBER, triple SDO RDF TRIPLE S); Create the model on the triple columnexecute SEM APIS.create sem model('family','family rdf data', 'triple');

Model Info (RDF MODEL /RDF LINK ) Under MDSYS:INSERT INTO mdsys.rdf model (owner, model id, model name, table name, column name)VALUES(:owner, :m id2, :model, :rdf table, :rdf column)CREATE VIEW RDFM FAMILYas select * from rdf link partition (model 1)CREATE VIEW SEMM FAMILYas select * from rdf link partition (model 1)select * from mdsys.rdf model ;OWNERMODEL ID MODEL NAMETABLE NAMECOLUMN NAME------- ---------- ------------ ---------------- -----------RDF1 FAMILYFAMILY RDF DATA TRIPLEBased onRDF LINK

Using Oracle Database 11g as aSemantic Data Store Create a Semantic Network Create an RDF/OWL model Load RDF/OWL data Infer RDF/OWL data Query RDF/OWL data and ontologies Perform Ontology-assisted Query of relational data

Loading RDF/OWL Data Oracle Database is a scalable native graph data store Oracle Database 11g stores up to 8 exabytes Semantic data stored optimally in relational tables Load Options: Bulk, Batch, and DML INSERT Single management environment for all your data

Alternatives for Loading RDF/OWL Data Bulk-load Fastest, but skips triples with literals 4k bytes Load data into a staging table (using SQL*Loader from a file orNamed Pipe containing N-Triple formatted data) Invoke PL/SQL API to do bulk load from the staging table Batch-load Fast and can handle long literals Invoke Java-based API to load from file containing N-Tripleformatted data DML INSERT on RDF/OWL data INSERT on app table (for loading small amounts of data) UPDATE of app table’s SDO RDF TRIPLE S col DELETE of row(s) from app table

Bulk Loading Using SQL*Loader Use SQL*Loader to load staging table Control file template is available in 11g companion CD Only the Staging Table name may need to be changed Staging Table definition is shown in documentation Use COMPRESS (to reduce storage cost) Input file must be N-Triple formatted Named Pipe may be used to save disk space SEM APIS.BULK LOAD FROM STAGING TABLE Model ownerTable ownerTable nameFlags (default NULL)

Bulk Loading Using Sql*loadercreate tablestaging(RDF STC sub varchar2(4000) not null,RDF STC pred varchar2(4000) not null,RDF STC obj varchar2(4000) not null,RDF STC sub ext varchar2(64),RDF STC pred ext varchar2(64),RDF STC obj ext varchar2(64),RDF STC canon ext varchar2(64))tablespace uniprot stagingstorage (initial 64M next 64M); You must grant SELECT privilege and UPDATE privilege on the last four requiredcolumns (with names ending with ext) in the staging table to user MDSYS. You mustalso grant INSERT privilege on the application table to user MDSYS .grant SELECT,UPDATE(RDF STC sub ext,RDF STC pred ext,RDF STC obj ext,RDF STC canon ext)on staging to MDSYS; ORACLE HOME/bin/sqlldr userid rdf \control ORACLE HOME/md/demo/network/rdf demos/bulkload.ctl data uniprot 100m.nt \direct true skip 0 discardmax 1000000 bad uniprot.bad discard uniprot.rej\log uniprot.log errors 1000000Load completed - logical record count 100000000.

API: Bulk load from staging tablecreate table uniprot rdf data(id number, triple sdo rdf triple s)tablespace uniprot;exec sem apis.create sem model('uniprot', 'uniprot rdf data', 'triple');exec sem apis.bulk load from staging table('uniprot', 'rdf', 'staging');*ERROR at line 1:ORA-55302: insufficient privileges FAILED: INSERT INTO"RDF"."UNIPROT RDF DATA"("TRIPLE") SQLERRM ORA-01031: insufficient privilegesgrant insert on uniprot rdf data to mdsys;exec sem apis.bulk load from staging table('uniprot', 'rdf', 'staging');select count(*) from uniprot rdf data;COUNT(*)---------99999420

Batch Loading Using the Java API Batch-load uses theoracle.spatial.rdf.client.BatchLoader class packagedin ORACLE HOME /md/jlib/sdordf.jar Example (on Linux) java-Ddb.user scott -Ddb.password password-Ddb.host 127.0.0.1 -Ddb.port 1522 -Ddb.sid orcl-classpath {ORACLE HOME}/md/jlib/sdordf.jar: {ORACLE .BatchLoader N-TripleFile tablename tablespaceName modelName

DML Inserts to Load RDF data INSERT INTO app table VALUES ( ,SDO RDF TRIPLE S( model , sub , pred , obj ) ) UPDATE app table a SET a. rdf triple col SDO RDF TRIPLE S( model , sub , pred , obj )WHERE DELETE FROM app table a WHERE Where clause:WHERE a. rdf triple col .rdf p id (SELECT value id FROM mdsys.RDF VALUE WHERE vname prefix AND vname suffix AND value type );

Semantic Data (Insert) John is the father of SuzieINSERT INTO family rdf data VALUES(1, SDO RDF TRIPLE .example.org/family/Suzie'));select value namefrommdsys.rdf value atherOfselect P VALUE ID, START NODE ID, CANON END NODE ID, END NODE ID, MODEL ID, COSTfrommdsys.semm family;P VALUE IDSTART NODE IDCANON END NODE ID--------------------- --------------------- --------------------END NODE ID MODEL IDCOST--------------------- -------- 9450493542747620677945049354274762011

Semantic Data (Insert) John is the father of SuzieINSERT INTO family rdf data VALUES(1, SDO RDF TRIPLE .example.org/family/Suzie'));select to char(f.triple.rdf s id, '99999999999999999999') as Subject,to char(f.triple.rdf p id, '99999999999999999999') as Property,to char(f.triple.rdf o id, '99999999999999999999') as Objectfrom family rdf data fSUBJECTPROPERTYOBJECT--------------------- --------------------- 004929006779450493542747620

Semantic Data (Insert) Martha is the mother of CindyINSERT INTO family rdf data VALUES (12,SDO RDF TRIPLE ww.example.org/family/Cindy')); Cathy is the sister of JackINSERT INTO family rdf data VALUES (13,SDO RDF TRIPLE w.example.org/family/Jack'));

Semantic Data (Insert) A sister is femaleINSERT INTO family rdf data VALUES (25,SDO RDF TRIPLE ttp://www.example.org/family/Female')); A mother is femaleINSERT INTO family rdf data VALUES (29,SDO RDF TRIPLE ttp://www.example.org/family/Female'));

Semantic Data (Insert) Cathy's height is 5.8 (decimal)INSERT INTO family rdf data VALUES (30,SDO RDF TRIPLE http://www.example.org/family/height','"5.8" xsd:decimal')); Jack's height is 6 (integer)INSERT INTO family rdf data VALUES (31,SDO RDF TRIPLE ttp://www.example.org/family/height','"6" xsd:integer'));

Family Model Data

Using Oracle Database 11g as aSemantic Data Store Create a Semantic Network Create an RDF/OWL model Load RDF/OWL data Infer RDF/OWL data Query RDF/OWL data and ontologies Perform Ontology-assisted Query of relational data

Inference1. The act or process of derivinglogical conclusions from premisesknown or assumed to be true.2. The act of reasoning from factualknowledge or evidence.

Inferencing RDF Data Native inference engine in Oracle Database for RDF, RDFS, OWL subset, and user-defined rules Rules are stored in rulebases in Oracle Database New relationships (triples) are entailed (inferred) from anRDF/OWL graph by applying rules to a model Uses Forward Chaining Minimizes on-the-fly computation for faster queries Automatic identification of new relationships (triples)Ex: hand fracture :subClassOf arm fracture,arm fracture :subClassOf upper extremity fracture hand fracture :subClassOf upper extremity fracture

Vocabularies: RDFS and OWL RDFS (RDF Schema) Structuring of resources and properties rdfs:classClass of resources rdfs:subClassOfhierarchy of classes rdfs:subPropertyOfhierarchy of properties OWL (Web Ontology Language) Builds on RDFS Property Characteristics: transitivity, symmetry, functional,inverse functional, inverse Class construction via set operations and propertyrestrictions Separate layers have been defined balancing expressibility vs.implementability: OWL Lite, OWL DL, OWL Full

Entailment Rules RDFS has 14 entailment rules E.g. rule : aaa rdfs:domain XXX .uuuaaayyy .uuu rdf:type XXX . OWLPrime has 50 entailment rules E.g. rule : aaa owl:inverseOf bbb .bbb rdfs:subPropertyOf ccc .ccc owl:inverseOf ddd .aaa rdfs:subPropertyOf ddd .xxx owl:disjointWith yyy .ardf:typexxx .brdf:typeyyy .a owl:differentFrom b . These rules have efficient implementations in Oracle47

Entailment Examples RDFS Example rdfs:subClassOf is transitive rdfs:subPropertyOf is transitive X rdf:type C, C rdfs:subClassOf SC X rdf:type SC OWL Example :partOf rdf:type owl:TransitiveProperty :friendOf rdf:type owl:SymmetricProperty User-defined Rule Example: X :hasParent Y, Y :hasBrother Z X :hasUncle Z

SEM MATCH namespacesThe following default namespaces (namespace id and namespace valattributes) are used by the SEM MATCH table function:('rdf', fs', 'http://www.w3.org/2000/01/rdf-schema#')('xsd', 'http://www.w3.org/2001/XMLSchema#')You can override any of these defaults by specifying the namespace idvalue and a different namespace val value in the aliases attribute.

Creating a RDFS Rules Index RDFS inferencing in the family modelBEGINSEM APIS.CREATE RULES INDEX('rdfs rix family',SEM Models('family'),SEM Rulebases('RDFS'));END;/select * from mdsys.rdf rulebase OWNERID NAME---------- --- ---------------SYS1 RDFSYS2 RDFSSYS3 RDFS SYS4 OWLSIFSYS5 OWLPRIMESTATUS---------VALIDVALIDVALIDVALIDVALID

RDFS Rules Index (Cont)Select P VALUE ID, START NODE ID, CANON END NODE ID,END NODE ID, MODEL IDfrom MDSYS.SEMI RDFS RIX FAMILY;P VALUE IDSTART NODE IDCANON END NODE ID--------------------- --------------------- --------------------END NODE ID MODEL ID--------------------- 0372635066808621017356.211 rows selected.574525778517600127212635066808621017356

RDFS Rules Index (Cont)select owner, index name, index view nameFromMDSYS.SEM RULES INDEX INFO;SEMI RDFS RIX FAMILY "alias"to RDFI RDFS RIX FAMILYOWNERINDEX NAMEINDEX VIEW NAME---------- ------------------------- -------------------RDFRDFS RIX FAMILYRDFI RDFS RIX FAMILYselect * fromMDSYS.SEM RULES INDEX DATASETS;INDEX NAME------------------------RDFS RIX FAMILYRDFS RIX FAMILYDATA TYP-------MODELRULEBASEDATA NAME------------------------FAMILYRDFS

SEM MATCH without inferenceSELECT mFROM TABLE(SEM MATCH('(?m rdf:type :Male)',SDO RDF Models('family'),null,SDO RDF Aliases(SDO RDF /TomSEM MATCH(queryVARCHAR2,modelsSEM MODELS,rulebasesSEM RULEBASES,aliasesSEM ALIASES,filterVARCHAR2,index status VARCHAR2) RETURN ANYDATASET;

RDFS inferenceSELECT mFROM TABLE(SEM MATCH('(?m rdf:type :Male)',SDO RDF Models('family'),SDO RDF Rulebases('RDFS'),SDO RDF Aliases(SDO RDF .org/family/Matt

If RDFS Rules Index Isn’t Defined .*ERROR at line 1:ORA-20000: We do not have a rules indexfor this Model-Rulebase combinationORA-06512: at "MDSYS.RDF MATCH IMPL T",line 176ORA-06512: at line 1

OWL Subsets SupportedThree subsets to meet most needs* RDFS RDFS plus owl:sameAs and owl:InverseFunctionalProperty OWLSIF Based on Dr. Horst’s pD* vocabulary¹ OWLPrime owl:TransitiveProperty, SymmetricProperty, FunctionalProperty,InverseFunctionalProperty owl:inverseOf sameAs, differentFrom owl:disjointWith, complementOf owl:hasValue, allValuesFrom, someValuesFrom owl:equivalentClass, equivalentProperty* Jointly determined with domain experts, customers and partners1 Completeness, decidability and complexity of entailment for RDF Schema and a semantic extension involving the OWL vocabulary56

RDFS/OWL vocabulary constructs included in each rulebase

11g OWL Inference PL/SQL API SEM APIS.CREATE ENTAILMENT( Index name sem models(‘GraphTBox’, ‘GraphABox’, ), sem rulebases(‘OWLPrime’), passes, Inf components, Options) Use “PROOF T” to generate inference proofTypical Usage: First load RDF/OWL data Call create entailment togenerate inferred graph Query both original graph andinferred dataInferred graph contains only newtriples! Saves time &resourcesTypical Usage: SEM APIS.VALIDATE ENTAILMENT( sem models((‘GraphTBox’, ‘GraphABox’, ), sem rulebases(‘OWLPrime’), Criteria, Max conflicts, Options)First load RDF/OWL dataCall create entailment togenerate inferred graphCall validate entailment to findinconsistencies58

OWL Inferencing (Native)EXECUTE sem apis.create entailment('owltst idx',sem models('owltst'), sem rulebases('OWLPRIME'));View mdsys.semi owltst idxSEM APIS.CREATE ENTAILMENT(index name inINVARCHAR2,models inINSEM MODELS,rulebases inINSEM RULEBASES,passesIN NUMBER DEFAULTSEM APIS.REACH CLOSURE,inf components in INVARCHAR2 DEFAULT NULL,optionsVARCHAR2 DEFAULT NULL);IN

Adding User-Defined Rules Oracle Database 10gR2 RDF and 11g RDF/OWLsupports user-defined rules in this form (filter equents?y .?x .?z :uncleOf ?y E.g. to support core semantics of owl:intersectionOf owl:Class rdf:ID “FemaleAstronaut" rdfs:label chair /rdfs:label owl:intersectionOf rdf:parseType "Collection" 1. owl:Class rdf:about "#Female" / owl:Class rdf:about "#Astronaut" / /owl:intersectionOf /owl:Class 3.2.:FemaleAstronaut rdfs:subClassOf:Female:FemaleAstronaut rdfs:subClassOf:Astronaut?x rdf:type :Female .?x rdf:type :Astronaut .x rdf:type :FemaleAstronaut60

Adding a User-Defined RDFS Rule BaseEXECUTE SEM APIS.CREATE RULEBASE('family rb');INSERT INTO mdsys.semr family rb VALUES('grandparent rule','(?x :parentOf ?y) (?y :parentOf ?z)',NULL,'(?x :grandParentOf ?z)',SEM ALIASES(SDO SEM ALIAS('','http://www.example.org/family/')));RULE NAMEANTECEDENTSCONSEQUENTS---------------- ------------------------------ -----------------------------GRANDPARENT RULE (?X http://www.example.org/fa (?X http://www.example.org/family/parentOf ?Y)(?Y http:// mily/grandParentOf ?Z)www.example.org/family/parentOf ?Z)

User-defined RDFS Rules for family rbSELECT x grandfather, y grandchildFROM TABLE(SEM MATCH('(?x :grandParentOf ?y) (?x rdf:type :Male)',SDO RDF Models('family'),SDO RDF Rulebases('RDFS'),SDO RDF Aliases(SDO RDF ;No rows selectedEXECUTE SDO RDF INFERENCE.DROP RULES INDEX ('rdfs rix family');BEGINSDO RDF INFERENCE.CREATE RULES INDEX('rdfs rix family',SDO RDF Models('family'),SDO RDF Rulebases('RDFS','family rb'));END;/

User-defined RDFS Rules for family rb Select all grandfathers and their grandchildrenfrom the family model Use inferencing from both theRDFS and family rb rulebasesSELECT x grandfather, y grandchildFROM TABLE(SEM MATCH('(?x :grandParentOf ?y) (?x rdf:type :Male)',SDO RDF Models('family'),SDO RDF Rulebases('RDFS','family rb'),SDO RDF Aliases(SDO RDF rg/family/Cindy

Changing User-defined RulesUPDATE mdsys.rdfr family rb SETantecedents '(?x :parentOf ?y) (?y :parentOf ?z) (?z :height ?h)',filter '(h 6)',aliases SDO RDF Aliases(SDO RDF Alias('','http://www.example.org/family/'))WHERE rule name 'GRANDPARENT RULE';** Re-create rules index **SELECT x grandfather, y grandchildFROM TABLE(SEM MATCH('(?x :grandParentOf ?y) (?x rdf:type :Male)',SDO RDF Models('family'),SDO RDF RuleBases('RDFS','family rb'),SDO RDF Aliases(SDO RDF /www.example.org/family/Cindy

User-Defined OWL InferencingINSERT INTO owltst VALUES (1,sdo rdf triple s('owltst',-- In the following statement, 'USER RULES T' is required,to'http://foo.com/name/John', 'http://foo.com/rel/fatherOf',-- include the original graph plus the inferred triples.'http://foo.com/name/Mary'));INSERT INTO owltst VALUES (1,EXECUTE sem apis.create entailment('owltst2 idx',sem models('owltst'),sdo rdf triple s('owltst',sem rulebases('OWLPRIME','USER RULEBASE'),'http://foo.com/name/Jack', 'http://foo.com/rel/brotherOf',SEM APIS.REACH CLOSURE, null, 'USER RULES T');'http://foo.com/name/John'));-- Create a user-defined rulebase.-- In the result of the following query, :Jack :uncleOf :Maryis inferred.EXECUTE sem apis.create rulebase('user rulebase');SELECT s,p,o FROM table(SEM MATCH('(?s ?p ?o)',-- Insert a simple "uncle" rule.SEM MODELS('OWLTST'),INSERT INTO mdsys.semr user rulebaseSEM RULEBASES('OWLPRIME','USER RULEBASE'), null,null ));VALUES ('uncle rule','(?x http://foo.com/rel/brotherOf ?y)(?y http://foo.com/rel/fatherOf ?z)',NULL, '(?x http://foo.com/rel/uncleOf ?z)', null);

Testing the Soundness of OWL Inference Soundness of OWL verified through Comparison with other well-tested reasoners Proof generation A proof of an assertion consists of a rule (name), and a set ofassertions which together deduce that assertion. Option “PROOF T” instructs 11g OWL to generate proofTripleID1 :emailAddress rdf:typeTripleID2 :John:emailAddressTripleID3 rseFunctionaProperty .:John at yahoo dot com .:John at yahoo dot com .(proof : TripleID1, TripleID2, TripleID3, “IFP”)66

OWL Inferencing ProofsEXECUTE sem apis.create entailment('owltst idx', sem models('owltst'),sem rulebases('owlprime'), SEM APIS.REACH CLOSURE, 'SAM', 'PROOF T');SELECT link id ' generated by ' explain as triple and its proofFROM mdsys.semi owltst idx;TRIPLE AND ITS ----------------------8 5 5 4 generated by 4 D 5 5 : SYMM SAMH SYMM8 4 5 4 generated by 8 5 5 4 4 D 5 5 : SAM SAMH. . . . .

OWL Inferencing Proofs (Cont)SELECT to char(x.triple.rdf m id, 'FMXXXXXXXXXXXXXXXX') ' ' to char(x.triple.rdf s id, 'FMXXXXXXXXXXXXXXXX') ' ' to char(x.triple.rdf p id, 'FMXXXXXXXXXXXXXXXX') ' ' to char(x.triple.rdf c id, 'FMXXXXXXXXXXXXXXXX'), x.triple.get triple()FROM ( SELECT sdo rdf triple s(t.canon end node id, t.model id, t.start node id, t.p value id, t.end node id) tripleFROM (select * from mdsys.semm owltst union all select * from mdsys.semi owltst idx) tWHERE t.link id IN ('4 D 5 5','8 5 5 4')) x;LINK ID X.TRIPLE.GET TRIPLE()(SUBJECT, PROPERTY, OBJECT)---------- -----------4 D 5 5 SDO RDF TRIPLE(' http://foo.com/name/John ', ' http://www.w3.org/2002/07/owl#sameAs ', ' http://foo.com/name/JohnQ ')8 5 5 4 SDO RDF TRIPLE(' http://foo.com/name/JohnQ ', ' http://www.w3.org/2002/07/owl#sameAs ', ' http://foo.com/name/John ')For the proof entry 8 5 5 4 generated by 4 D 5 5 : SYMM SAMH SYMMFor the triple with LINK ID 8 5 5 4, it is inferred from the triple with 4 D 5 5 using the symmetricity of owl:sameAs. page

Oracle Database Semantic Data Store A feature of Oracle Spatial 11g Option for Oracle Database 11g . Text Mining Load, Query & Inference Applications & Analysis Semantic Data Management Workflow Other Data . Tutorial Agenda RDF Concepts Using Oracle Database 11g as a Semantic Data Store