461 likes | 690 Views
RDF. 10. High Level Languages. Java (Object Oriented) ASP RDF (Horn Clause Deduction, Semantic Web). This Course. Jython in Java. Relation. SQL. uses. Schaum's Outline of Fundamentals of SQL Programming by Ramon Mata-Toledo and Pauline Cushman (Sep 28, 2000) $13.00
E N D
10 High Level Languages Java (Object Oriented) ASP RDF (Horn Clause Deduction, Semantic Web) This Course Jython in Java Relation
SQL uses • Schaum's Outline of Fundamentals of SQL Programming by Ramon Mata-Toledo and Pauline Cushman (Sep 28, 2000) $13.00 • Schaum's Outline of Fundamentals of Relational Databases by Ramon Mata-Toledo and Pauline Cushman (Nov 15, 2000) $32.00 • "Oracle SQL By Example (4th Edition)" by Alice Rischert (Paperback - Aug 22, 2009) $42.00 • "Semantic Web for the Working Ontologist, Second Edition: Effective Modeling in RDFS and OWL" by Dean Allemang and James Hendler (Paperback- Jun 3, 2011) $43.50
select * from ( select empno, ename, job, to_char(mgr) mgr, to_char(sal) sal, to_char(comm) comm, -- all datatypes need to be the same to_char(deptno) deptno, to_char(hiredate) hiredate -- so convert all non-strings to strings from emp ) unpivot (value for x in (ename, job, mgr, sal, comm, deptno, hiredate)) order by empno, x Returns (i.e., converts the emp table to a triple store)EMPNO X VALUE ----- ------ ---------------------------------------- 7369 MGR 7902 7369 SAL 800 7499 COMM 300 7499 DEPTNO 30 7499 ENAME ALLEN 7499 JOB SALESMAN 7499 MGR 7698 7499 SAL 1600 7521 COMM 500 7521 DEPTNO 30 7521 ENAME WARD 7521 JOB SALESMAN 7521 MGR 7698 7521 SAL 1250 7566 DEPTNO 20 7566 ENAME JONES 7566 JOB MANAGER 7566 MGR 7839 7566 SAL 2975 7654 COMM 1400 7654 DEPTNO 30 7654 ENAME MARTIN 7654 JOB SALESMAN EMPNO X VALUE ----- ------ ---------------------------------------- 7654 MGR 7698 7654 SAL 1250 7698 DEPTNO 30 7698 ENAME BLAKE 7698 JOB MANAGER 7698 MGR 7839 7698 SAL 2850 7782 DEPTNO 10 7782 ENAME CLARK 7782 JOB MANAGER 7782 MGR 7839 7782 SAL 2450 7788 DEPTNO 20 7788 ENAME SCOTT 7788 JOB ANALYST 7788 MGR 7566 7788 SAL 3000 7839 DEPTNO 10 7839 ENAME KING 7839 JOB PRESIDENT 7839 SAL 5000 7844 DEPTNO 30 7844 ENAME TURNER 7844 JOB SALESMAN EMPNO X VALUE ----- ------ ---------------------------------------- 7844 MGR 7698 7844 SAL 1500 7876 DEPTNO 20 7876 ENAME ADAMS 7876 JOB CLERK 7876 MGR 7788 7876 SAL 1100 7900 DEPTNO 30 7900 ENAME JAMES 7900 JOB CLERK 7900 MGR 7698 7900 SAL 950 7902 DEPTNO 20 7902 ENAME FORD 7902 JOB ANALYST 7902 MGR 7566 7902 SAL 3000 7934 DEPTNO 10 7934 ENAME MILLER 7934 JOB CLERK 7934 MGR 7782 7934 SAL 1300
Figure 1–3 Family Tree for RDF Example (see Monday February, 20 link - Oracle Semantic Tutorial examples on 1-28 and 1-29)
select Person from person where BrotherOf = ‘Cathy’ select x from rts where ?x BrotherOf ‘Cathy’
Figure 1–3 Family Tree for RDF Sample (see Monday February, 20 link - Family Tree RDF Examplefor 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'));
-- 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'));
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));
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_rb rulebases. 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))
Semantic Web – RDFS and OWL Namespaces or Vocabularies or Ontologies or Semantics
Semantic Web in Austin: http://www.semanticwebaustin.org/http://juansequeda.blogspot.com/ Juan Sequeda, Ph.D StudentResearch AssistantDept. of Computer SciencesThe University of Texas at Austinhttp://www.cs.utexas.edu/~jsequedajsequeda@cs.utexas.eduhttp://www.juansequeda.com/
http://www.w3.org/People/Ivan/CorePresentations/SWTutorial/Slides.pdfhttp://www.w3.org/People/Ivan/CorePresentations/SWTutorial/Slides.pdf
ReL SIM Classes, DVAs, and EVAs CLASS PERSONT "Persons related to the company" ( personid : INTEGERDATA, REQUIRED; firstname : STRINGDATA, REQUIRED; lastname : STRINGDATA, REQUIRED; zipcode : INTEGERDATA; spouse "spouse if married" : PERSONT, INVERSE IS spouse; children "children optional" : PERSONT, INVERSE IS parents; parents "Persons parents optional" : PERSONT, MV(DISTINCT, MAXVAL 2), INVERSE IS children; ); INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#PERSONT', 'rdf:type', 'rdfs:Class')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#PERSONT', 'rdfs:comment', '"Persons related to the company"')) Adding dvaAttribute: personid INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#personid', 'rdf:type', 'owl:DatatypeProperty')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#personid', 'rdfs:domain', 'http://www.example.org/people.owl#PERSONT')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#personid', 'rdf:range', 'rdfs:xsd:integer')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', '_:m1', 'rdf:type', 'owl:Restriction')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', '_:m1', 'owl:onProperty', 'http://www.example.org/people.owl#personid')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', '_:m1', 'owl:qualifiedCardinality', '"1"')) *INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', '_:m1', 'owl:onDataRange', 'xsd:nonNegativeInteger')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#PERSONT', 'rdfs:subClassOf', '_:m1')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#personid', 'rdf:type', 'owl:FunctionalProperty'))
ReL SIM Classes, DVAs, and EVAs CLASS PERSONT "Persons related to the company" ( personid : INTEGERDATA, REQUIRED; firstname : STRINGDATA, REQUIRED; lastname : STRINGDATA, REQUIRED; zipcode : INTEGERDATA; spouse "spouse if married" : PERSONT, INVERSE IS spouse; children "children optional" : PERSONT, INVERSE IS parents; parents "Persons parents optional" : PERSONT, MV(DISTINCT, MAXVAL 2), INVERSE IS children; ); INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#PERSONT', 'rdf:type', 'rdfs:Class')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#PERSONT', 'rdfs:comment', '"Persons related to the company"')) Inserting evaAttribute: spouse INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#spouse', 'rdf:type', 'owl:ObjectProperty')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#spouse', 'rdfs:domain', 'http://www.example.org/people.owl#PERSONT')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#spouse', 'rdfs:range', 'http://www.example.org/people.owl#PERSONT')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#INVERSEIS=spouse', 'owl:inverseOf', 'http://www.example.org/people.owl#spouse')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#spouse', 'owl:inverseOf', 'http://www.example.org/people.owl#spouse')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#spouse', 'rdf:type', 'owl:FunctionalProperty')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#children', 'rdfs:comment', '"children optional"'))
ReL SIM SubClasses SUBCLASS EMPLT "Current employees of the company" OF PERSONT ( employeeid "Unique employee identification" : INTEGERDATA,REQUIRED; salary "Current yearly salary" : INTEGERDATA, REQUIRED; employeemanager "Employee's current manager" : PERSONT,INVERSE IS employeesmanaging; ); INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#EMPLT', 'rdf:type', 'rdfs:Class')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#EMPLT', 'rdfs:subClassOf', 'http://www.example.org/people.owl#PERSONT')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#EMPLT', 'rdfs:comment', '"Current employees of the company"')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#employeeid', 'rdfs:comment', '"Unique employee identification"'))
ReL SIM DVA Inserts #dva inserts for num in range(1, 5): if num == 1: fn = 'Bill' ln = 'Dawer' elif num == 2: fn = 'DummyBill' ln = 'DummyDawer' elif num == 3: fn = 'Kid1' ln = 'DummyDawer' elif num == 4: fn = 'Kid2' ln = 'DummyDawer' INSERT PERSONT ( personid := num , firstname := fn , lastname := ln , zipcode := 78700 + num); INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i6', 'rdf:type', 'http://www.example.org/people.owl#PERSONT')) Inserting attributes INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i6', 'http://www.example.org/people.owl#personid', '"1"^^xsd:integer')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i6', 'http://www.example.org/people.owl#firstname', '"Bill"^^xsd:string')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i6', 'http://www.example.org/people.owl#lastname', '"Dawer"^^xsd:string')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i6', 'http://www.example.org/people.owl#zipcode', '"78701"^^xsd:integer'))
ReL SIM EVA Inserts #eva inserts INSERT PERSONT ( personid := 15 , firstname := "Alice" , lastname := "Dawer" , zipcode := 78705, spouse := PERSONT WITH (firstname = "Bill" AND lastname = "Dawer"), children := PERSONT WITH (firstname = "SQLKid")); INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'rdf:type', 'http://www.example.org/people.owl#PERSONT')) Inserting attributes INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'http://www.example.org/people.owl#personid', '"15"^^xsd:integer')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'http://www.example.org/people.owl#firstname', '"Alice"^^xsd:string')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'http://www.example.org/people.owl#lastname', '"Dawer"^^xsd:string')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'http://www.example.org/people.owl#zipcode', '"78705"^^xsd:integer')) Continued on next page
ReL SIM EVA Inserts #eva inserts INSERT PERSONT ( personid := 15 , firstname := "Alice" , lastname := "Dawer" , zipcode := 78705, spouse := PERSONT WITH (firstname = "Bill" AND lastname = "Dawer"), children := PERSONT WITH (firstname = "SQLKid")); getMembersWithAttrValues: query= select indiv from table(sem_match( 'select * where { ?indiv rdf:type :PERSONT . ?indiv :lastname "Dawer" . ?indiv :firstname "Bill" . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) getMembersWithAttrValues: query= select obj from table(sem_match( 'select * where { :spouse rdf:type ?obj . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) GET ALL DVA ATTRS QUERY: select attr from table(sem_match( 'select * where { :spouse owl:inverseOf ?attr . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'http://www.example.org/people.owl#spouse', 'http://www.example.org/people.owl#i6')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i6', 'http://www.example.org/people.owl#spouse', 'http://www.example.org/people.owl#i11')) Continued on next page
ReL SIM EVA Inserts #eva inserts INSERT PERSONT ( personid := 15 , firstname := "Alice" , lastname := "Dawer" , zipcode := 78705, spouse := PERSONT WITH (firstname = "Bill" AND lastname = "Dawer"), children := PERSONT WITH (firstname = "SQLKid")); getMembersWithAttrValues: query= select indiv from table(sem_match( 'select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname "SQLKid" . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) getMembersWithAttrValues: query= select obj from table(sem_match( 'select * where { :children rdf:type ?obj . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) GET ALL DVA ATTRS QUERY: select attr from table(sem_match( 'select * where { :children owl:inverseOf ?attr . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'http://www.example.org/people.owl#children', 'http://www.example.org/people.owl#i10')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i10', 'http://www.example.org/people.owl#parents', 'http://www.example.org/people.owl#i11'))
ReL SIM DVA Modify #dva modify MODIFY LIMIT = 1 PERSONT ( zipcode := 61511 ) WHERE firstname = "Alice" AND lastname = "Dawer"; getMembersWithAttrValues: query= select indiv from table(sem_match( 'select * where { ?indiv rdf:type :PERSONT . ?indiv :lastname "Dawer" . ?indiv :firstname "Alice" . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) DELETE FROM RDF_DATA_TABLE WHERE TRIPLE = SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'http://www.example.org/people.owl#zipcode', '"78705"') INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'http://www.example.org/people.owl#zipcode', '"61511"'))
ReL SIM EVA Modify #eva modify MODIFY LIMIT = 1 PERSONT ( spouse := PERSONT WITH (firstname = "Bill" AND lastname = "Dawer") ) WHERE firstname = "Alice"; getMembersWithAttrValues: query= select indiv from table(sem_match( 'select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname "Alice" . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) getMembersWithAttrValues: query= select indiv from table(sem_match( 'select * where { ?indiv rdf:type :PERSONT . ?indiv :lastname "Dawer" . ?indiv :firstname "Bill" . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) GET ALL DVA ATTRS QUERY: select attr from table(sem_match( 'select * where { :spouse owl:inverseOf ?attr . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i11', 'http://www.example.org/people.owl#spouse', 'http://www.example.org/people.owl#i6')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i6', 'http://www.example.org/people.owl#spouse', 'http://www.example.org/people.owl#i11'))
ReL SIM Query 1 output=FROM PERSONT RETRIEVE * WHERE TRUE; neatPrintTable(output) GET ALL DVA ATTRS QUERY: select attr from table(sem_match( 'select * where { ?attr rdf:type owl:DatatypeProperty . ?attr rdfs:domain :PERSONT }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) SELECT firstname, lastname, zipcode, personid from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname ?firstname . ?indiv :lastname ?lastname . ?indiv :zipcode ?zipcode . ?indiv :personid ?personid . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- ---------------- ---------------- ---------------- | FIRSTNAME | LASTNAME | ZIPCODE | PERSONID | | -------------- + -------------- + -------------- + -------------- | | Bill | Dawer | 78701 | 1 | | DummyBill | DummyDawer | 78702 | 2 | | Alice | Dawer | 61511 | 15 | | Alice | Dawer | 78705 | 15 | | Kid2 | DummyDawer | 78704 | 4 | | SQLKid | DummyDawer | 78710 | 5 | | Kid1 | DummyDawer | 78703 | 3 | ---------------- ---------------- ---------------- ----------------
ReL SIM Query 2 output=FROM PERSONT RETRIEVE *, firstname OF spouse WHERE TRUE; neatPrintTable(output) GET ALL DVA ATTRS QUERY: select attr from table(sem_match( 'select * where { ?attr rdf:type owl:DatatypeProperty . ?attr rdfs:domain :PERSONT }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) SELECT firstname, lastname, zipcode, personid, x0_1 from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname ?firstname . ?indiv :lastname ?lastname . ?indiv :zipcode ?zipcode . ?indiv :personid ?personid . OPTIONAL { ?indiv :spouse ?x0_0 . ?x0_0 :firstname ?x0_1 . } }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- ---------------- ---------------- ---------------- ---------------- | FIRSTNAME | LASTNAME | ZIPCODE | PERSONID | X0_1 | | -------------- + -------------- + -------------- + -------------- + -------------- | | Alice | Dawer | 78705 | 15 | Bill | | Alice | Dawer | 61511 | 15 | Bill | | Bill | Dawer | 78701 | 1 | Alice | | Kid2 | DummyDawer | 78704 | 4 | None | | DummyBill | DummyDawer | 78702 | 2 | None | | Kid1 | DummyDawer | 78703 | 3 | None | | SQLKid | DummyDawer | 78710 | 5 | None | ---------------- ---------------- ---------------- ---------------- ----------------
ReL SIM Query 3 output=FROM PERSONT RETRIEVE firstname, firstname OF children WHERE firstname = "Bill" ; neatPrintTable(output) SELECT firstname, x0_1 from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname ?firstname . ?indiv :firstname "Bill" . OPTIONAL { ?indiv :children ?x0_0 . ?x0_0 :firstname ?x0_1 . } }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- ---------------- | FIRSTNAME | X0_1 | | -------------- + -------------- | | Bill | None | ---------------- ----------------
ReL SIM Query 4 output=FROM PERSONT RETRIEVE firstname, firstname OF children WHERE firstname = "Alice"; neatPrintTable(output) SELECT firstname, x0_1 from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname ?firstname . ?indiv :firstname "Alice" . OPTIONAL { ?indiv :children ?x0_0 . ?x0_0 :firstname ?x0_1 . } }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- ---------------- | FIRSTNAME | X0_1 | | -------------- + -------------- | | Alice | Kid2 | | Alice | SQLKid | ---------------- ----------------
ReL SIM Query 5 output=FROM PERSONT RETRIEVE firstname, firstname OF parents WHERE TRUE; neatPrintTable(output) SELECT firstname, x0_1 from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname ?firstname . OPTIONAL { ?indiv :parents ?x0_0 . ?x0_0 :firstname ?x0_1 . } }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- ---------------- | FIRSTNAME | X0_1 | | -------------- + -------------- | | Kid2 | Alice | | SQLKid | Alice | | Kid1 | None | | Bill | None | | Alice | None | | DummyBill | None | ---------------- ----------------
ReL SIM Query 6 output=FROM PERSONT RETRIEVE firstname OF children WHERE firstname="Alice"; neatPrintTable(output) SELECT x0_1 from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname "Alice" . OPTIONAL { ?indiv :children ?x0_0 . ?x0_0 :firstname ?x0_1 . } }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- | X0_1 | | -------------- | | Kid2 | | SQLKid | ----------------
ReL SIM Query 7 output=FROM PERSONT RETRIEVE firstname OF children OF spouse WHERE firstname="Bill"; neatPrintTable(output) SELECT x0_2 from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname "Bill" . OPTIONAL { ?indiv :spouse ?x0_0 . ?x0_0 :children ?x0_1 . ?x0_1 :firstname ?x0_2 . } }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- | X0_2 | | -------------- | | Kid2 | | SQLKid | ----------------
ReL SIM Query 8 output=FROM PERSONT RETRIEVE firstname OF children OF spouse OF spouse OF spouse WHERE firstname="Bill"; neatPrintTable(output) SELECT x0_4 from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname "Bill" . OPTIONAL { ?indiv :spouse ?x0_0 . ?x0_0 :spouse ?x0_1 . ?x0_1 :spouse ?x0_2 . ?x0_2 :children ?x0_3 . ?x0_3 :firstname ?x0_4 . } }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- | X0_4 | | -------------- | | Kid2 | | SQLKid | ----------------
ReL SIM Query 9 output=FROM PERSONT RETRIEVE firstname OF children OF spouse , lastname OF children OF spouse OF spouse OF spouse WHERE firstname="Bill"; neatPrintTable(output) SELECT x0_2, x1_4 from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname "Bill" . OPTIONAL { ?indiv :spouse ?x0_0 . ?x0_0 :children ?x0_1 . ?x0_1 :firstname ?x0_2 . ?indiv :spouse ?x1_0 . ?x1_0 :spouse ?x1_1 . ?x1_1 :spouse ?x1_2 . ?x1_2 :children ?x1_3 . ?x1_3 :lastname ?x1_4 . } }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- ---------------- | X0_2 | X1_4 | | -------------- + -------------- | | Kid2 | DummyDawer | | SQLKid | DummyDawer | | Kid2 | DummyDawer | | SQLKid | DummyDawer | ---------------- ----------------
ReL SQL Query 1 output=SELECT firstname, lastname, zipcode, personid FROM PERSONT ; neatPrintTable(output) SELECT firstname_PERSONT firstname, lastname_PERSONT lastname, zipcode_PERSONT zipcode, personid_PERSONT personid from table( SEM_MATCH('SELECT * WHERE { ?thisPERSONT rdf:type :PERSONT . ?thisPERSONT :firstname ?firstname_PERSONT . ?thisPERSONT :lastname ?lastname_PERSONT . ?thisPERSONT :zipcode ?zipcode_PERSONT . ?thisPERSONT :personid ?personid_PERSONT . }', SEM_MODELS('RDF_MODEL_CS345_PROF1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) )| ---------------- ---------------- ---------------- ---------------- | FIRSTNAME | LASTNAME | ZIPCODE | PERSONID | | -------------- + -------------- + -------------- + -------------- | | Bill | Dawer | 78701 | 1 | | DummyBill | DummyDawer | 78702 | 2 | | Alice | Dawer | 61511 | 15 | | Alice | Dawer | 78705 | 15 | | Kid2 | DummyDawer | 78704 | 4 | | SQLKid | DummyDawer | 78710 | 5 | | Kid1 | DummyDawer | 78703 | 3 | ---------------- ---------------- ---------------- ----------------
ReL SQL Insert INSERT INTO PERSONT ( personid, firstname, lastname, zipcode ) VALUES ( 5, 'SQLKid2', 'DummyDawer', (lambda x: 78700 + x)(5)); INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i12', 'rdf:type', 'http://www.example.org/people.owl#PERSONT')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i12', 'http://www.example.org/people.owl#personid', '"5"^^xsd:integer')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i12', 'http://www.example.org/people.owl#firstname', '"SQLKid2"^^xsd:string')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i12', 'http://www.example.org/people.owl#lastname', '"DummyDawer"^^xsd:string')) INSERT INTO RDF_DATA_TABLE VALUES ( RDF_DATA_TABLE_SQNC.nextval, SDO_RDF_TRIPLE_S('RDF_MODEL_CS345_PROF1:<http://www.example.org/people.owl>', 'http://www.example.org/people.owl#i12', 'http://www.example.org/people.owl#zipcode', '"78705"^^xsd:integer'))
ReL SQL Query 2 output=SELECT firstname, lastname, zipcode, personid FROM PERSONT ; neatPrintTable(output) SELECT firstname_PERSONT firstname, lastname_PERSONT lastname, zipcode_PERSONT zipcode, personid_PERSONT personid from table( SEM_MATCH('SELECT * WHERE { ?thisPERSONT rdf:type :PERSONT . ?thisPERSONT :firstname ?firstname_PERSONT . ?thisPERSONT :lastname ?lastname_PERSONT . ?thisPERSONT :zipcode ?zipcode_PERSONT . ?thisPERSONT :personid ?personid_PERSONT . }', SEM_MODELS('RDF_MODEL_CS345_PROF1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) )| ---------------- ---------------- ---------------- ---------------- | FIRSTNAME | LASTNAME | ZIPCODE | PERSONID | | -------------- + -------------- + -------------- + -------------- | | Bill | Dawer | 78701 | 1 | | DummyBill | DummyDawer | 78702 | 2 | | SQLKid2 | DummyDawer | 78705 | 5 | | Alice | Dawer | 61511 | 15 | | Alice | Dawer | 78705 | 15 | | Kid2 | DummyDawer | 78704 | 4 | | SQLKid | DummyDawer | 78710 | 5 | | Kid1 | DummyDawer | 78703 | 3 | ---------------- ---------------- ---------------- ----------------
ReL SIM Query 10 output=FROM PERSONT RETRIEVE * WHERE TRUE; neatPrintTable(output) GET ALL DVA ATTRS QUERY: select attr from table(sem_match( 'select * where { ?attr rdf:type owl:DatatypeProperty . ?attr rdfs:domain :PERSONT }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) SELECT firstname, lastname, zipcode, personid from table( sem_match('select * where { ?indiv rdf:type :PERSONT . ?indiv :firstname ?firstname . ?indiv :lastname ?lastname . ?indiv :zipcode ?zipcode . ?indiv :personid ?personid . }', SEM_MODELS('RDF_MODEL_CS345_prof1'), null, SEM_ALIASES( SEM_ALIAS('', 'http://www.example.org/people.owl#')), null) ) ---------------- ---------------- ---------------- ---------------- | FIRSTNAME | LASTNAME | ZIPCODE | PERSONID | | -------------- + -------------- + -------------- + -------------- | | Bill | Dawer | 78701 | 1 | | DummyBill | DummyDawer | 78702 | 2 | | SQLKid2 | DummyDawer | 78705 | 5 | | Alice | Dawer | 61511 | 15 | | Alice | Dawer | 78705 | 15 | | Kid2 | DummyDawer | 78704 | 4 | | SQLKid | DummyDawer | 78710 | 5 | | Kid1 | DummyDawer | 78703 | 3 |