Warning:
This wiki has been archived and is now read-only.
Example of SQL-Query based Approach (Part 2: Data): RDB (relational) Data and corresponding (virtual) RDF Graphs
From RDB2RDF
Sample data for the relational schema:
deptno | dname | loc | |
10 | APPSERVER | NEW YORK | |
20 | RESEARCH | TEXAS | |
30 | SALES | ILLINOIS | |
40 | OPERATIONS | CALIFORNIA | |
50 | DBSERVER | MASSACHUSETTS |
empno | ename | job | deptno | etype | |
7369 | SMITH | CLERK | 10 | PART_TIME | |
7499 | ALLEN | SALES | 30 | FULL_TIME | |
7521 | RAMIREZ | SALES | 20 | FULL_TIME | |
7566 | JONES | MANAGER | 20 | FULL_TIME | |
7654 | MARTIN | ENGINEER | 50 | PART_TIME | |
7698 | PATEL | SALES | 50 | PART_TIME | |
7782 | CLARK | MANAGER | 30 | FULL_TIME | |
7788 | SCOTT | ANALYST | 20 | FULL_TIME | |
7839 | KING | PRESIDENT | 40 | FULL_TIME | |
7844 | TURNER | ENGINEER | 50 | INTERN | |
7876 | ADAMS | CLERK | 30 | INTERN | |
7900 | CHANG | ENGINEER | 10 | FULL_TIME | |
7902 | FORD | ANALYST | 10 | PART_TIME | |
7934 | MILLER | CLERK | 40 | FULL_TIME |
Results for queries used in SQLdefStrings of the Mapping Specification:
Select '<xyz.com/dept/' || deptno || '>' AS deptURI , deptno , dname , loc from dept
deptURI | deptno | dname | loc | |
<xyz.com/dept/10> | 10 | APPSERVER | NEW YORK | |
<xyz.com/dept/20> | 20 | RESEARCH | TEXAS | |
<xyz.com/dept/30> | 30 | SALES | ILLINOIS | |
<xyz.com/dept/40> | 40 | OPERATIONS | CALIFORNIA | |
<xyz.com/dept/50> | 50 | DBSERVER | MASSACHUSETTS |
Select '<xyz.com/emp/' || empno || '>' AS empURI , empno , ename , '<xyz.com/emp/job/'|| job || '>' AS jobTypeURI , job , deptno , '<xyz.com/emp/etype/'|| etype || '>' AS empTypeURI , etype , '<xyz.com/graph/'|| job || '/' || etype || '>' AS graphURI from emp
empURI | empno | ename | jobTypeURI | job | deptno | empTypeURI | etype | graphURI | |
<xyz.com/emp/7369> | 7369 | SMITH | <xyz.com/emp/job/CLERK> | CLERK | 10 | <xyz.com/emp/etype/PART_TIME> | PART_TIME | <xyz.com/graph/CLERK/PART_TIME> | |
<xyz.com/emp/7499> | 7499 | ALLEN | <xyz.com/emp/job/SALES> | SALES | 30 | <xyz.com/emp/etype/FULL_TIME> | FULL_TIME | <xyz.com/graph/SALES/FULL_TIME> | |
<xyz.com/emp/7521> | 7521 | RAMIREZ | <xyz.com/emp/job/SALES> | SALES | 20 | <xyz.com/emp/etype/FULL_TIME> | FULL_TIME | <xyz.com/graph/SALES/FULL_TIME> | |
<xyz.com/emp/7566> | 7566 | JONES | <xyz.com/emp/job/MANAGER> | MANAGER | 20 | <xyz.com/emp/etype/FULL_TIME> | FULL_TIME | <xyz.com/graph/MANAGER/FULL_TIME> | |
<xyz.com/emp/7654> | 7654 | MARTIN | <xyz.com/emp/job/ENGINEER> | ENGINEER | 50 | <xyz.com/emp/etype/PART_TIME> | PART_TIME | <xyz.com/graph/ENGINEER/PART_TIME> | |
<xyz.com/emp/7698> | 7698 | PATEL | <xyz.com/emp/job/SALES> | SALES | 50 | <xyz.com/emp/etype/PART_TIME> | PART_TIME | <xyz.com/graph/SALES/PART_TIME> | |
<xyz.com/emp/7782> | 7782 | CLARK | <xyz.com/emp/job/MANAGER> | MANAGER | 30 | <xyz.com/emp/etype/FULL_TIME> | FULL_TIME | <xyz.com/graph/MANAGER/FULL_TIME> | |
<xyz.com/emp/7788> | 7788 | SCOTT | <xyz.com/emp/job/ANALYST> | ANALYST | 20 | <xyz.com/emp/etype/FULL_TIME> | FULL_TIME | <xyz.com/graph/ANALYST/FULL_TIME> | |
<xyz.com/emp/7839> | 7839 | KING | <xyz.com/emp/job/PRESIDENT> | PRESIDENT | 40 | <xyz.com/emp/etype/FULL_TIME> | FULL_TIME | <xyz.com/graph/PRESIDENT/FULL_TIME> | |
<xyz.com/emp/7844> | 7844 | TURNER | <xyz.com/emp/job/ENGINEER> | ENGINEER | 50 | <xyz.com/emp/etype/INTERN> | INTERN | <xyz.com/graph/ENGINEER/INTERN> | |
<xyz.com/emp/7876> | 7876 | ADAMS | <xyz.com/emp/job/CLERK> | CLERK | 30 | <xyz.com/emp/etype/INTERN> | INTERN | <xyz.com/graph/CLERK/INTERN> | |
<xyz.com/emp/7900> | 7900 | CHANG | <xyz.com/emp/job/ENGINEER> | ENGINEER | 10 | <xyz.com/emp/etype/FULL_TIME> | FULL_TIME | <xyz.com/graph/ENGINEER/FULL_TIME> | |
<xyz.com/emp/7902> | 7902 | FORD | <xyz.com/emp/job/ANALYST> | ANALYST | 10 | <xyz.com/emp/etype/PART_TIME> | PART_TIME | <xyz.com/graph/ANALYST/PART_TIME> | |
<xyz.com/emp/7934> | 7934 | MILLER | <xyz.com/emp/job/CLERK> | CLERK | 40 | <xyz.com/emp/etype/FULL_TIME> | FULL_TIME | <xyz.com/graph/CLERK/FULL_TIME> |
(Virtual) RDF Graphs (conceptually generated) based upon above relational data
Graph: xyz.com/graph/CLERK/PART_TIME
<xyz.com/emp/7369> rdf:type xyz:emp <xyz.com/emp/7369> emp:empno "7369"^^xsd:integer <xyz.com/emp/7369> emp:Name "SMITH" <xyz.com/emp/7369> emp:jobtype <xyz.com/emp/job/CLERK> <xyz.com/emp/7369> emp:job "CLERK" <xyz.com/emp/7369> emp:deptNum "10"^^xsd:integer <xyz.com/emp/7369> emp:emptype <xyz.com/emp/etype/PART_TIME> <xyz.com/emp/7369> emp:etype "PART_TIME"
Graph: xyz.com/graph/SALES/FULL_TIME
<xyz.com/emp/7499> rdf:type xyz:emp <xyz.com/emp/7499> emp:empno "7499"^^xsd:integer <xyz.com/emp/7499> emp:Name "ALLEN" <xyz.com/emp/7499> emp:jobtype <xyz.com/emp/job/SALES> <xyz.com/emp/7499> emp:job "SALES" <xyz.com/emp/7499> emp:deptNum "30"^^xsd:integer <xyz.com/emp/7499> emp:emptype <xyz.com/emp/etype/FULL_TIME> <xyz.com/emp/7499> emp:etype "FULL_TIME"
<xyz.com/emp/7521> rdf:type xyz:emp <xyz.com/emp/7521> emp:empno "7521"^^xsd:integer <xyz.com/emp/7521> emp:Name "RAMIREZ" <xyz.com/emp/7521> emp:jobtype <xyz.com/emp/job/SALES> <xyz.com/emp/7521> emp:job "SALES" <xyz.com/emp/7521> emp:deptNum "20"^^xsd:integer <xyz.com/emp/7521> emp:emptype <xyz.com/emp/etype/FULL_TIME> <xyz.com/emp/7521> emp:etype "FULL_TIME"
Graph: xyz.com/graph/MANAGER/FULL_TIME
<xyz.com/emp/7566> rdf:type xyz:emp <xyz.com/emp/7566> emp:empno "7566"^^xsd:integer <xyz.com/emp/7566> emp:Name "JONES" <xyz.com/emp/7566> emp:jobtype <xyz.com/emp/job/MANAGER> <xyz.com/emp/7566> emp:job "MANAGER" <xyz.com/emp/7566> emp:deptNum "20"^^xsd:integer <xyz.com/emp/7566> emp:emptype <xyz.com/emp/etype/FULL_TIME> <xyz.com/emp/7566> emp:etype "FULL_TIME"
<xyz.com/emp/7782> rdf:type xyz:emp <xyz.com/emp/7782> emp:empno "7782"^^xsd:integer <xyz.com/emp/7782> emp:Name "CLARK" <xyz.com/emp/7782> emp:jobtype <xyz.com/emp/job/MANAGER> <xyz.com/emp/7782> emp:job "MANAGER" <xyz.com/emp/7782> emp:deptNum "30"^^xsd:integer <xyz.com/emp/7782> emp:emptype <xyz.com/emp/etype/FULL_TIME> <xyz.com/emp/7782> emp:etype "FULL_TIME"
Graph: xyz.com/graph/ENGINEER/PART_TIME
<xyz.com/emp/7654> rdf:type xyz:emp <xyz.com/emp/7654> emp:empno "7654"^^xsd:integer <xyz.com/emp/7654> emp:Name "MARTIN" <xyz.com/emp/7654> emp:jobtype <xyz.com/emp/job/ENGINEER> <xyz.com/emp/7654> emp:job "ENGINEER" <xyz.com/emp/7654> emp:deptNum "50"^^xsd:integer <xyz.com/emp/7654> emp:emptype <xyz.com/emp/etype/PART_TIME> <xyz.com/emp/7654> emp:etype "PART_TIME"
Graph: xyz.com/graph/SALES/PART_TIME
<xyz.com/emp/7698> rdf:type xyz:emp <xyz.com/emp/7698> emp:empno "7698"^^xsd:integer <xyz.com/emp/7698> emp:Name "PATEL" <xyz.com/emp/7698> emp:jobtype <xyz.com/emp/job/SALES> <xyz.com/emp/7698> emp:job "SALES" <xyz.com/emp/7698> emp:deptNum "50"^^xsd:integer <xyz.com/emp/7698> emp:emptype <xyz.com/emp/etype/PART_TIME> <xyz.com/emp/7698> emp:etype "PART_TIME"
Graph: xyz.com/graph/ANALYST/FULL_TIME
<xyz.com/emp/7788> rdf:type xyz:emp <xyz.com/emp/7788> emp:empno "7788"^^xsd:integer <xyz.com/emp/7788> emp:Name "SCOTT" <xyz.com/emp/7788> emp:jobtype <xyz.com/emp/job/ANALYST> <xyz.com/emp/7788> emp:job "ANALYST" <xyz.com/emp/7788> emp:deptNum "20"^^xsd:integer <xyz.com/emp/7788> emp:emptype <xyz.com/emp/etype/FULL_TIME> <xyz.com/emp/7788> emp:etype "FULL_TIME"
Graph: xyz.com/graph/PRESIDENT/FULL_TIME
<xyz.com/emp/7839> rdf:type xyz:emp <xyz.com/emp/7839> emp:empno "7839"^^xsd:integer <xyz.com/emp/7839> emp:Name "KING" <xyz.com/emp/7839> emp:jobtype <xyz.com/emp/job/PRESIDENT> <xyz.com/emp/7839> emp:job "PRESIDENT" <xyz.com/emp/7839> emp:deptNum "40"^^xsd:integer <xyz.com/emp/7839> emp:emptype <xyz.com/emp/etype/FULL_TIME> <xyz.com/emp/7839> emp:etype "FULL_TIME"
Graph: xyz.com/graph/ENGINEER/INTERN
<xyz.com/emp/7844> rdf:type xyz:emp <xyz.com/emp/7844> emp:empno "7844"^^xsd:integer <xyz.com/emp/7844> emp:Name "TURNER" <xyz.com/emp/7844> emp:jobtype <xyz.com/emp/job/ENGINEER> <xyz.com/emp/7844> emp:job "ENGINEER" <xyz.com/emp/7844> emp:deptNum "50"^^xsd:integer <xyz.com/emp/7844> emp:emptype <xyz.com/emp/etype/INTERN> <xyz.com/emp/7844> emp:etype "INTERN"
Graph: xyz.com/graph/CLERK/INTERN
<xyz.com/emp/7876> rdf:type xyz:emp <xyz.com/emp/7876> emp:empno "7876"^^xsd:integer <xyz.com/emp/7876> emp:Name "ADAMS" <xyz.com/emp/7876> emp:jobtype <xyz.com/emp/job/CLERK> <xyz.com/emp/7876> emp:job "CLERK" <xyz.com/emp/7876> emp:deptNum "30"^^xsd:integer <xyz.com/emp/7876> emp:emptype <xyz.com/emp/etype/INTERN> <xyz.com/emp/7876> emp:etype "INTERN"
Graph: xyz.com/graph/ENGINEER/FULL_TIME
<xyz.com/emp/7900> rdf:type xyz:emp <xyz.com/emp/7900> emp:empno "7900"^^xsd:integer <xyz.com/emp/7900> emp:Name "CHANG" <xyz.com/emp/7900> emp:jobtype <xyz.com/emp/job/ENGINEER> <xyz.com/emp/7900> emp:job "ENGINEER" <xyz.com/emp/7900> emp:deptNum "10"^^xsd:integer <xyz.com/emp/7900> emp:emptype <xyz.com/emp/etype/FULL_TIME> <xyz.com/emp/7900> emp:etype "FULL_TIME"
Graph: xyz.com/graph/ANALYST/PART_TIME
<xyz.com/emp/7902> rdf:type xyz:emp <xyz.com/emp/7902> emp:empno "7902"^^xsd:integer <xyz.com/emp/7902> emp:Name "FORD" <xyz.com/emp/7902> emp:jobtype <xyz.com/emp/job/ANALYST> <xyz.com/emp/7902> emp:job "ANALYST" <xyz.com/emp/7902> emp:deptNum "10"^^xsd:integer <xyz.com/emp/7902> emp:emptype <xyz.com/emp/etype/PART_TIME> <xyz.com/emp/7902> emp:etype "PART_TIME"
Graph: xyz.com/graph/CLERK/FULL_TIME
<xyz.com/emp/7934> rdf:type xyz:emp <xyz.com/emp/7934> emp:empno "7934"^^xsd:integer <xyz.com/emp/7934> emp:Name "MILLER" <xyz.com/emp/7934> emp:jobtype <xyz.com/emp/job/CLERK> <xyz.com/emp/7934> emp:job "CLERK" <xyz.com/emp/7934> emp:deptNum "40"^^xsd:integer <xyz.com/emp/7934> emp:emptype <xyz.com/emp/etype/FULL_TIME> <xyz.com/emp/7934> emp:etype "FULL_TIME"