1 / 37

Triple Store Data Models

Triple Store Data Models. Convert emp Table to Triples. select * from( select empno , ename , job, to_char ( mgr ) mgr , -- all data types need to be the same so convert to_char ( sal ) sal , -- all non-strings to strings to_char ( comm ) comm , to_char ( deptno ) deptno ,

marika
Download Presentation

Triple Store Data Models

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Triple Store Data Models

  2. Convert emp Table to Triples select * from( select empno, ename, job, to_char(mgr) mgr, -- all data types need to be the same so convert to_char(sal) sal, -- all non-strings to strings to_char(comm) comm, to_char(deptno) deptno, to_char(hiredate) hiredate from emp ) unpivot (value for x in (ename, job, mgr, sal, comm, deptno, hiredate)) order by empno, x See next page for results

  3. emp Triples EMPNO X      VALUE ----- ------ ----------- 7369 DEPTNO 20 7369 ENAME SMITH 7369 HIREDATE 17-DEC-80 7369 JOB CLERK 7369 MGR 7902 7369 SAL 800 7499 COMM 300 7499 DEPTNO 30 7499 ENAME ALLEN 7499 HIREDATE 20-FEB-81 7499 JOB SALESMAN 7499 MGR 7698 7499 SAL 1600 7521 COMM 500 7521 DEPTNO 30 7521 ENAME WARD 7521 HIREDATE 22-FEB-81 7521 JOB SALESMAN 7521 MGR 7698 7521 SAL 1250 7566 DEPTNO 20 7566 ENAME JONES 7566 HIREDATE 02-APR-81 7566 JOB MANAGER 7566 MGR 7839 7566 SAL 2975 EMPNO X      VALUE ----- ------ ----------- 7654 COMM 1400 7654 DEPTNO 30 7654 ENAME MARTIN 7654 HIREDATE 28-SEP-81 7654 JOB SALESMAN 7654 MGR 7698 7654 SAL 1250 7698 DEPTNO 30 7698 ENAME BLAKE 7698 HIREDATE 01-MAY-81 7698 JOB MANAGER 7698 MGR 7839 7698 SAL 2850 7782 DEPTNO 10 7782 ENAME CLARK 7782 HIREDATE 09-JUN-81 7782 JOB MANAGER 7782 MGR 7839 7782 SAL 2450 7788 DEPTNO 20 7788 ENAME SCOTT 7788 HIREDATE 09-DEC-82 7788 JOB ANALYST 7788 MGR 7566 7788 SAL 3000 7839 DEPTNO 10 7839 ENAME KING 7839 HIREDATE 17-NOV-81 7839 JOB PRESIDENT 7839 SAL 5000 EMPNO X      VALUE ----- ------ ----------- 7844 DEPTNO 30 7844 ENAME TURNER 7844 HIREDATE 08-SEP-81 7844 JOB SALESMAN 7844 MGR 7698 7844 SAL 1500 7876 DEPTNO 20 7876 ENAME ADAMS 7876 HIREDATE 12-JAN-83 7876 JOB CLERK 7876 MGR 7788 7876 SAL 1100 7900 DEPTNO 30 7900 ENAME JAMES 7900 HIREDATE 03-DEC-81 7900 JOB CLERK 7900 MGR 7698 7900 SAL 950 7902 DEPTNO 20 7902 ENAME FORD 7902 HIREDATE 03-DEC-81 7902 JOB ANALYST 7902 MGR 7566 7902 SAL 3000 7934 DEPTNO 10 7934 ENAME MILLER 7934 HIREDATE 23-JAN-82 7934 JOB CLERK 7934 MGR 7782 7934 SAL 1300

  4. Triple-based Data Models have a Very Long History Entity-Attribute-Value (EAV) Databases have been around since the early 80s but they were never acknowledged by the database community. They are now starting to come to the forefront know as [RDF] Triple Stores. “Graph Database Models is increasingly a topic of interest the database realm. The representation of data in the form of a graph lends itself well to structured data with a dynamic schema. This paper goes over current applications and implementations of graph databases, giving an overview of the dierent types available and their application. Due wide spread of graph algorithms and models, no standard system or query language has been dened for graph databases. Research and industry adoption will determine the future direction of graph databases.”[The Current State of Graph Databases - 2012]

  5. RDF/OWL is a Standard Data Model for Triples RDF/OWL is a standard graph data model being developed by the w3c standardization committees. Key W3C Web Semantic Activities: • W3C RDF Working Group • W3C SPARQL Working Group • W3C RDB2RDF Working Group (Editors of R2RML) • W3C OWL Working group • W3C Semantic Web Education & Outreach (SWEO) • W3C Health Care & Life Sciences Interest Group (HCLS) • W3C Multimedia Semantics Incubator group • W3C Semantic Web Rules Language (SWRL)

  6. Data (expressed in RDF) <entity, attr, value> triplets (similar to: unpivoted tables) entity typically is associated with a type (rdf:type <employee>) May be extended to quads: a grouping of triples BENEFIT: uniform structure => allows syntactic integration Schema / Ontology (expressed in OWL) extended with class and property hierarchies Many other such “rules” BENEFIT => allows discovery of implicit knowledge BENEFIT => allows semantic integration Query (expressed in SPARQL) BENEFIT => Suits the triple or quad-based structure of RDF RDF/OWL Technologies in a nutshell

  7. Oracle’s RDF/OWL Architectural Overview SPARQL Endpoints Joseki / Sesame Tools SQL Interface OBIEE via SPARQL Gateway SPARQL: Jena / Sesame Java Programs SQLplus PL/SQL SQLdev. ProgrammingInterface Java API support VisualizerCytoscape-based JDBC LOAD Reasoners: Pellet INFER QUERY (SPARQL in SQL) Bulk-Load Incr. DML OWLsubsets RDF/S User-def. Core functionality Query RDF/OWL data and ontologies Ontology-assisted Query of Enterprise Data 3rd-Party Callouts NLP Extractors Security: Oracle Label Security Enterprise (Relational) data Semantic Indexes Oracle DB RDF/OWL RDF/OWL data and ontologies Rulebases: OWL, RDF/S, user-defined Inferred RDF/OWL data

  8. Semantic Technology: Building Blocks

  9. RDF

  10. Vocabularies (RDFS and OWL)

  11. RDF(S) Example

  12. RDF Query inSQL

  13. Graph Pattern-based Query (SPARQL)

  14. RDF(S) and OWL Example

  15. Inference: Overview

  16. Inferencing

  17. Storage: Highlights

  18. OWL Inferencing: A Short Primer owl:FunctionalProperty owl:InverseFunctionalProperty owl:SymmetricProperty owl:TransitiveProperty owl:inverseOf rdfs:subClassOf rdfs:subPropertyOf rdfs:domain rdfs:range owl:equivalentClass owl:equivalentProperty owl:disjointWith owl:complementOf owl:sameAs owl:differentFrom owl:someValuesFrom owl:allValuesFrom owl:hasValue

  19. Inference: Examples owl:FunctionalProperty owl:InverseFunctionalProperty owl:SymmetricProperty owl:TransitiveProperty owl:inverseOf :hasMother rdf:type owl:FunctionalProperty :John :hasMother :Mary :John :hasMother :Maria => :Mary owl:sameAs :Maria :Maria owl:sameAs :Mary

  20. Inference: Examples owl:FunctionalProperty owl:InverseFunctionalProperty owl:SymmetricProperty owl:TransitiveProperty owl:inverseOf :hasSSN rdf:type owl:InverseFunctionalProperty :John :hasSSN 123-45-6789 :Johny :hasSSN 123-45-6789 => :John owl:sameAs :Johny :Johny owl:sameAs :John

  21. Inference: Examples owl:FunctionalProperty owl:InverseFunctionalProperty owl:SymmetricProperty owl:TransitiveProperty owl:inverseOf :hasSibling rdf:type owl:SymmetricProperty :John :hasSibling :Mary => :Mary :hasSibling :John

  22. Inference: Examples owl:FunctionalProperty owl:InverseFunctionalProperty owl:SymmetricProperty owl:TransitiveProperty owl:inverseOf :hasAncestor rdf:type owl:TransitiveProperty :John :hasAncestor :Mary :Mary :hasAncestor :Tom => :John :hasAncestor :Tom

  23. Inference: Examples owl:FunctionalProperty owl:InverseFunctionalProperty owl:SymmetricProperty owl:TransitiveProperty owl:inverseOf :hasParent owl:inverseOf :hasChild :John :hasParent :Mary => :Mary :hasChild :John

  24. Inference: Examples owl:equivalentClass owl:equivalentProperty owl:disjointWith owl:complementOf :Male owl:disjointWith :Female :John rdf:type :Male :Mary rdf:type :Female => :John owl:differentFrom :Mary :Mary owl:differentFrom :John

  25. Inference: Examples owl:equivalentClass owl:equivalentProperty owl:disjointWith owl:complementOf :NonHuman owl:complementOf :Human :Fish rdfs:subClassOf :NonHuman => :Fish owl:disjointWith :Human :Human owl:disjointWith :Fish

  26. Inference: Examples owl:someValuesFrom owl:allValuesFrom owl:hasValue :Player owl:equivalentClass _:c1 _:c1 owl:onProperty :participateIn _:c1 owl:someValuesFrom :Sports _:c1 rdf:type owl:Restriction :Soccer rdf:type :Sports :John :particpateIn :Soccer => :John rdf:type :Player

  27. Inference: Examples owl:someValuesFrom owl:allValuesFrom owl:hasValue :Vegetarian rdfs:subClassOf _:c1 _:c1 owl:onProperty :eat _:c1 owl:allValuesFrom :Vegetable _:c1 rdf:type owl:Restriction :John rdf:type :Vegetarian :John :eat :bean => :bean rdf:type :Vegetable

  28. Inference: Examples owl:someValuesFrom owl:allValuesFrom owl:hasValue :EligibleToBePresident owl:equivalentClass _:c1 _:c1 owl:onProperty :countryOfBirth _:c1 owl:hasValue :USA _:c1 rdf:type owl:Restriction :John :countryOfBirth :USA => :John rdf:type :EligibleToBePresident :Tom rdf:type :EligibleToBePresident => :Tom :countryOfBirth :USA

  29. Family Tree Example Family Tree for RDF Example (see Monday October, 10 link - Oracle Semantic Tutorial examples on 1-28 and 1-29)

  30. Family Tree Example Figure 1–3 Family Tree for RDF Sample (see Monday October, 10 link - Family Tree RDF Example for Full Details) -- Create the table to hold data for the model. CREATE TABLE family_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S); -- Create the model. execute SEM_APIS.create_rdf_model('family_cs345_XXX', 'family_rdf_data', 'triple'); -- John is the father of Suzie. INSERT INTO family_rdf_data VALUES (1, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/John', 'http://www.example.org/family/fatherOf', 'http://www.example.org/family/Suzie')); . . . INSERT INTO family_rdf_data VALUES (14, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/Jack', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.example.org/family/Male'));

  31. Family Tree Example -- Person is a class. INSERT INTO family_rdf_data VALUES (17, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/Person', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/2000/01/rdf-schema#Class')); -- Male is a subclass of Person. INSERT INTO family_rdf_data VALUES (18, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/Male', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'http://www.example.org/family/Person')); -- Female is a subclass of Person. INSERT INTO family_rdf_data VALUES (19, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/Female', 'http://www.w3.org/2000/01/rdf-schema#subClassOf', 'http://www.example.org/family/Person')); -- siblingOf is a property. INSERT INTO family_rdf_data VALUES (20, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/siblingOf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property')); -- parentOf is a property. INSERT INTO family_rdf_data VALUES (21, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/parentOf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property')); -- brotherOf is a subproperty of siblingOf. INSERT INTO family_rdf_data VALUES (22, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/brotherOf', 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf', 'http://www.example.org/family/siblingOf')); -- sisterOf is a subproperty of siblingOf. INSERT INTO family_rdf_data VALUES (23, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/sisterOf', 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf', 'http://www.example.org/family/siblingOf')); -- A brother is male. INSERT INTO family_rdf_data VALUES (24, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/brotherOf', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.example.org/family/Male')); -- A sister is female. INSERT INTO family_rdf_data VALUES (25, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/sisterOf', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.example.org/family/Female')); -- fatherOf is a subproperty of parentOf. INSERT INTO family_rdf_data VALUES (26, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/fatherOf', 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf', 'http://www.example.org/family/parentOf')); -- motherOf is a subproperty of parentOf. INSERT INTO family_rdf_data VALUES (27, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/motherOf', 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf', 'http://www.example.org/family/parentOf')); -- A father is male. INSERT INTO family_rdf_data VALUES (28, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/fatherOf', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.example.org/family/Male')); -- A mother is female. INSERT INTO family_rdf_data VALUES (29, SDO_RDF_TRIPLE_S('family_cs345_XXX', 'http://www.example.org/family/motherOf', 'http://www.w3.org/2000/01/rdf-schema#domain', 'http://www.example.org/family/Female'));

  32. Family Tree Example - Inferencing -- RDFS inferencing in the family model BEGIN SEM_APIS.CREATE_RULES_INDEX( 'rdfs_rix_family_cs345_XXX', SEM_Models('family_cs345_XXX'), SEM_Rulebases('RDFS')); END; / -- Select all males from the family model, without inferencing. SELECT m FROM TABLE(SEM_MATCH( '(?m rdf:type :Male)', SEM_Models('family_cs345_XXX'), null, SEM_ALIASES(SEM_ALIAS('','http://www.example.org/family/')), null)); -- Select all males from the family model, with RDFS inferencing. SELECT m FROM TABLE(SEM_MATCH( '(?m rdf:type :Male)', SEM_Models('family_cs345_XXX'), SDO_RDF_Rulebases('RDFS'), SEM_ALIASES(SEM_ALIAS('','http://www.example.org/family/')), null));

  33. Family Tree Example - Inferencing -- General inferencing in the family model EXECUTE SEM_APIS.CREATE_RULEBASE('family_rb_cs345_XXX'); INSERT INTO mdsys.semr_family_rb_cs345_XXX VALUES( 'grandparent_rule', '(?x :parentOf ?y) (?y :parentOf ?z)', NULL, '(?x :grandParentOf ?z)', SEM_ALIASES(SEM_ALIAS('','http://www.example.org/family/'))); COMMIT; -- Select all grandfathers and their grandchildren from the family model, -- without inferencing. (With no inferencing, no results are returned.) SELECT x grandfather, y grandchild FROM TABLE(SEM_MATCH( '(?x :grandParentOf ?y) (?x rdf:type :Male)', SEM_Models('family_cs345_XXX'), null, SEM_ALIASES(SEM_ALIAS('','http://www.example.org/family/')), null)); -- Select all grandfathers and their grandchildren from the family model. -- Use inferencing from both the RDFS and family_rbrulebases. SELECT x grandfather, y grandchild FROM TABLE(SEM_MATCH( '(?x :grandParentOf ?y) (?x rdf:type :Male)', SEM_Models('family_cs345_XXX'), SEM_Rulebases('RDFS','family_rb_cs345_XXX'), SEM_ALIASES(SEM_ALIAS('','http://www.example.org/family/')), null))

  34. Solaris kstats converted to triple store inserts(Name-Value Pair data has a Perfect Fit with RDF Triples) module: hermon instance: 0 name: 2c903000ac562-1_data_stats class: hca crtime 145706.727450275 hca hermon0 link_state 4 obytes 4425443730752 INSERT INTO OBSERV_RDF_DATA VALUES (…nextval, SDO_RDF_TRIPLE_S('OBSERV_RDF_MODEL', ':6611-1-hca-0', ':module', ':hermon')) ; INSERT INTO OBSERV_RDF_DATA VALUES (...nextval, SDO_RDF_TRIPLE_S('OBSERV_RDF_MODEL', ':6611-1-hca-0', ':instance', ':0')); INSERT INTO OBSERV_RDF_DATA VALUES (...nextval, SDO_RDF_TRIPLE_S('OBSERV_RDF_MODEL', ':6611-1-hca-0', ':name', ':2c903000ac562-1_data_stats')) ; INSERT INTO OBSERV_RDF_DATA VALUES (...nextval, SDO_RDF_TRIPLE_S('OBSERV_RDF_MODEL', ':6611-1-hca-0', ':class', ':hca')) ; INSERT INTO OBSERV_RDF_DATA VALUES (...nextval, SDO_RDF_TRIPLE_S('OBSERV_RDF_MODEL', ':6611-1-hca-0', ':crtime', ':145706.727450275')) ; INSERT INTO OBSERV_RDF_DATA VALUES (...nextval, SDO_RDF_TRIPLE_S('OBSERV_RDF_MODEL', ':6611-1-hca-0', ':hca', ':hermon0')) ; INSERT INTO OBSERV_RDF_DATA VALUES (...nextval, SDO_RDF_TRIPLE_S('OBSERV_RDF_MODEL', ':6611-1-hca-0', ':link_state', ':4')) ; INSERT INTO OBSERV_RDF_DATA VALUES (...nextval, SDO_RDF_TRIPLE_S('OBSERV_RDF_MODEL', ':6611-1-hca-0', ':obytes', ':4425443730752')) ; RDF Triple

  35. Able to Query RDF Triples with SPARQL/SQL select null link, round(log(2, message_size)) label, ((obytes*8)/1000000)/nvl(kstat_dur, 10) "kstat 64 Stream" from (SELECT distinct eid, rid, -- select the 2nd average which thereby excludes the average containing the first point NTH_VALUE(obytes, 2) OVER (PARTITION BY rid ORDER BY snaptime ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) obytes from (SELECT eid, rid, snaptime, avg(obytes) OVER (PARTITION BY rid ORDER BY snaptime ROWS BETWEEN 0 PRECEDING AND UNBOUNDED FOLLOWING) obytes from (SELECT eid, rid, snaptime, obytes - LAG(obytes, 1, 0) OVER (ORDER BY snaptime) AS obytes FROM (SELECT to_number(ltrim(eid, ':')) eid, to_number(ltrim(rid, ':')) rid, to_number(ltrim(snaptime, ':')) snaptime, to_number(ltrim(obytes, ':')) obytes FROM TABLE(SEM_MATCH( '(?sub :rid ?rid) (?sub :eid ?eid) (?sub :snaptime ?snaptime) (?sub :obytes ?obytes) (?sub :name :2c903000ac562-1_data_stats) (?sub :class :hca)', SEM_Models('OBSERV_RDF_MODEL'), null, SEM_ALIASES(SEM_ALIAS('',':')), null))) where eid = :P10_EXP) order by rid, snaptime)) k, ibdatarun d where d.eid = :P10_EXP and d.rid = k.rid and streams = 64 order by label Regular SQL SPARQL Join to another table

  36. SPARQL/SQL Results as APEX Chart Red is throughput from qperf, Yellow is throughput from kstatobytes This is a Web-based Chart made using Oracle Application Express (APEX)

  37. SPARQL/SQL Results as APEX Report Report for kstat ib0 module

More Related