Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Sunitha Ramanujam 1, Anubha Gupta 1, Latifur Khan 1, Steven Seida 2, Bhavani Thuraisingham 1 1 The University of Texas at Dallas 2 Raytheon Company *Funded.

Similar presentations


Presentation on theme: "1 Sunitha Ramanujam 1, Anubha Gupta 1, Latifur Khan 1, Steven Seida 2, Bhavani Thuraisingham 1 1 The University of Texas at Dallas 2 Raytheon Company *Funded."— Presentation transcript:

1 1 Sunitha Ramanujam 1, Anubha Gupta 1, Latifur Khan 1, Steven Seida 2, Bhavani Thuraisingham 1 1 The University of Texas at Dallas 2 Raytheon Company *Funded by Chris Bizer, Richard Cyganiak, Christian Becker, Andreas Langegger, Herwig Leimer Freie Universität Berlin

2 Agenda D2RQ Basics R2D (RDF-to-Database) Research Motivation R2D System Architecture R2D Modules RDFMapFileGenerator DBSchemaGenerator SQL-to-SPARQL Translation Exper imental Results Conclusions & Future Work 2

3 Why D2RQ… Semantic Web Technologies are maturing Growing need for RDF applications to access legacy database content without replicating the entire database into RDF What you can do with D2RQ… Query a non-RDF database using SPARQL Access information in a non-RDF database using the Jena API Access the contents of a non-RDF database as Linked Data over the Web

4 What D2RQ is… Tool for publishing content of relational databases on the Semantic Web Consists of D2RQ Mapping Language D2RQ Engine D2RQ Server

5 D2RQ Mapping Language Declarative language to express mappings between a given RDF schemata and a relational schemata

6 D2RQ ClassMap Represents a class or a group of similar classes of an OWL ontology or RDFS Schema map:employee a d2rq:ClassMap; d2rq:dataStorage map:database; d2rq:uriPattern "employee/@@employee.empid@@"; d2rq:class vocab:employee; EmpidEnameDeptid 12345Nisha10 23456Meera10

7 D2RQ PropertyBridge Relates database table columns to RDF properties Used to attach properties to the RDF resource created by a class map map:employee_empid a d2rq:PropertyBridge; d2rq:belongsToClassMap map:employee; d2rq:property vocab:employee_empid; d2rq:column "employee.empid"; d2rq:datatype xsd:int;

8 D2RQ Joins Used to join tables in an n:m relationship map:employee_deptid a d2rq:PropertyBridge; d2rq:belongsToClassMap map:employee; d2rq:property vocab:employee_deptid; d2rq:refersToClassMap map:department; d2rq:join "employee.deptid = department.deptid"; EmpidEnameDeptid 12345Nisha10 23456Meera10 DeptidDname 10Research 20Accounts

9 Other Features of D2RQ Conditional Mappings map:Paper a d2rq:ClassMap; d2rq:class :Paper; d2rq:uriPattern "http://www.conference.org/conf02004/paper#Paper@@Papers.PaperID@@"; d2rq:condition "Papers.Publish = 1"; d2rq:dataStorage map:Database1. Translation Tables :red a :Color; :green a :Color; :blue a :Color; map:ColorBridge a d2rq:PropertyBridge; d2rq:belongsToClassMap map:ShinyObjectMap; d2rq:property :color; d2rq:uriColumn "ShinyObject.Color"; d2rq:translateWith map:ColorTable. map:ColorTable a d2rq:TranslationTable; d2rq:translation [ d2rq:databaseValue "R"; d2rq:rdfValue :red; ]; d2rq:translation [ d2rq:databaseValue "G"; d2rq:rdfValue :green; ]; d2rq:translation [ d2rq:databaseValue "B"; d2rq:rdfValue :blue; ].

10 D2RQ Command Line Tools Auto-Generate Mapping Files: “generate-mapping” script Creates a default mapping file by analyzing the schema of an existing database Usage: generate-mapping [-u username] [-p password] [-d driverclass] [-o outfile.n3] jdbcURL Example: generate-mapping -u root -p deekvish123 -d com.mysql.jdbc.Driver -o test.n3 jdbc:mysql://localhost/test

11 Sample Mapping File: test.n3 @ prefix map:. @prefix db: <>. @prefix vocab:. @prefix rdf:. @prefix rdfs:. @prefix xsd:. @prefix d2rq:. map:database a d2rq:Database; d2rq:jdbcDriver "com.mysql.jdbc.Driver"; d2rq:jdbcDSN "jdbc:mysql://localhost/test"; d2rq:username "root"; d2rq:password "deekvish123";. # Table department map:department a d2rq:ClassMap; d2rq:dataStorage map:database; d2rq:uriPattern "department/@@department.deptid@@"; d2rq:class vocab:department;. map:department__label a d2rq:PropertyBridge; d2rq:belongsToClassMap map:department; d2rq:property rdfs:label; d2rq:pattern "department #@@department.deptid@@";. map:department_deptid a d2rq:PropertyBridge; d2rq:belongsToClassMap map:department; d2rq:property vocab:department_deptid; d2rq:column "department.deptid"; d2rq:datatype xsd:int;. map:department_dname a d2rq:PropertyBridge; d2rq:belongsToClassMap map:department; d2rq:property vocab:department_dname; d2rq:column "department.dname";. # Table employee map:employee a d2rq:ClassMap; d2rq:dataStorage map:database; d2rq:uriPattern "employee/@@employee.empid@@"; d2rq:class vocab:employee;. map:employee__label a d2rq:PropertyBridge; d2rq:belongsToClassMap map:employee; d2rq:property rdfs:label; d2rq:pattern "employee #@@employee.empid@@";. map:employee_empid a d2rq:PropertyBridge; d2rq:belongsToClassMap map:employee; d2rq:property vocab:employee_empid; d2rq:column "employee.empid"; d2rq:datatype xsd:int;. map:employee_ename a d2rq:PropertyBridge; d2rq:belongsToClassMap map:employee; d2rq:property vocab:employee_ename; d2rq:column "employee.ename";. map:employee_deptid a d2rq:PropertyBridge; d2rq:belongsToClassMap map:employee; d2rq:property vocab:employee_deptid; d2rq:refersToClassMap map:department; d2rq:join "employee.deptid = department.deptid";.

12 D2RQ Command Line Tools (Cont’d) Dumping the Database to an RDF File: “dump-rdf” script Used to dump the contents of the entire database into a single RDF file Usage: dump-rdf -u username [-p password] -d driverclass -j jdbcURL [output parameters] Example – With Mapping File: dump-rdf –m test.n3 –o test.rdf Without Mapping File: dump-rdf -u root -p deekvish123 -d com.mysql.jdbc.Driver -j jdbc:mysql://localhost/test –o test.rdf

13 Sample Dumped RDF File <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:map="file:///C:/SUNITHA/D2RQ/D2RSER4/test.n3#" xmlns:vocab="file:///C:/SUNITHA/D2RQ/D2RSER4/vocab/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:db="file:///C:/SUNITHA/D2RQ/D2RSER4/test2.rdf" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > Accounts 20 department #20 HRGuy 45678 employee #45678 Nisha 12345 employee #12345

14 Sample Dumped RDF File (Cont’d) HR 30 department #30 AccountantGuy 34567 employee #34567 Meera 23456 employee #23456 Research 10 department #10

15 D2RQ Server Tool for publishing the content of relational databases on the Semantic Web Has a Linked Data Interface and allows RDF data to be browsed and searched SPARQL interface enables applications to search and query the database using the SPARQL Query Language Traditional HTML interface offers access to the familiar Web browsers

16 Running the D2RQ Server Generate the mapping file for the database schema Start the server Command: d2r-server mapping.n3 Example: d2r-server test.n3 Test the server Open http://localhost:2020/ in a Web browserhttp://localhost:2020

17 Screenshot of Example D2RQ Server

18 More Screenshots

19

20 Background Server Activity

21 Agenda D2RQ Basics R2D (RDF-to-Database) Research Motivation R2D System Architecture R2D Modules RDFMapFileGenerator DBSchemaGenerator SQL-to-SPARQL Translation Exper imental Results Conclusions & Future Work 21

22 R2D – Research Motivation & Objectives Current Trend: Semantic Web initiative for automated storage, exchange, and usage of machine-readable information. Effects of current trend: Resource Description Framework and RDF Graph data model to realize the Semantic Web Initiative. Challenges due to current trend: Demand for RDF data modeling and visualization tools. Addressing these challenges:  Readily available mature relational data modeling and visualization tools are leveraged for RDF data models by reusing the same.  We propose R2D, a JDBC wrapper around RDF stores that bridges the gap between RDF and RDBMS concepts and presents a relational view of the RDF store to the modeling and visualization tools. 22

23 R2D System Architecture R2D’s Modules 1. RDFMapFileGenerator: Automatic RDF-to-Relational Schema mapping file generator utility. 2. DBSchemaGenerator: Parser that takes the above map file as input and generates a domain-specific, normalized, virtual relational schema for the corresponding RDF store. 3. SQL-to-SPARQL Translation: Utility that takes an SQL statement as input, parses & converts it to a corresponding SPARQL statement, executes the same, & returns the results in a tabular format. 23 Fig. 1: R2D’s Architecture

24 Introduction –RDF 101 Resource Description Framework (RDF) is a language for: Representing information about resources on the WWW Presenting metadata about web resources (such as title and author of a web page) RDF is computer readable and understandable RDF is W3C’s answer to realization of the Semantic Web – a framework that allows data to be shared and reused across applications. Achieved through the reuse of appropriate concepts, thereby avoiding concept matching issues across rival formalizations

25 Introduction –RDF 101 Every RDF statement is a triple of the form RDF model is a graph – the object of one statement can be the subject of another Sample RDF Graph

26 R2D In Action 26

27 RDFMapFileGenerator First component in the R2D Transformation Framework Generates a map file containing the correlations between an RDF store’s meta-data and its relational equivalents Mapping constructs and map file generation process: R2d:TableMap: Construct used to map rdfs:class objects to an equivalent relational table R2d:BelongsToTableMap: Construct that connects property column bridge to the r2d:TableMap corresponding to the “subject” of the property node R2d:Predicate: Construct that keeps track of the fully qualified predicate name of the property comprising the r2d:ColumnBridge. R2d:ColumnBridge: Construct that maps single-valued simple properties to relational database columns R2d:MultiValuedColumnBridge: Construct that maps those predicates that have multiple object values for the same subject R2d:RefersToTableMap: Construct that establishes a foreign key relationship between the source r2d:TableMap and the parent r2d:TableMap corresponding to the resource object of a triple EmpURI/EmpA Link to Project1 Works On Link to Project2 Link to ProjectN Works On NickName R2d:TableMap R2d:KeyField: Construct that attaches a dummy primary key field to the r2d:TableMap associated with a resource. R2d:KeyField (Value) R2d:ColumnBridge R2d:MultiValuedColumnBridge R2d:BelongsToTableMap R2d:Predicate R2D:RefersToTableMap R2D:TableMap corresponding to “Project” Resources 27

28 RDFMapFileGenerator R2d:SimpleLiteralBlankNode (SLBN): Construct used to relate blank nodes with distinct simple literal objects to relational database columns R2d:SimpleLiteralBlankNode EmpURI/EmpA City Street Address State R2d:ComplexLiteralBlankNode (CLBN): Construct used to relate blank nodes containing repeating predicates (with simple literal objects)to relational database columns EmpURI/EmpA Phone Cell Work R2d:ComplexLiteralBlankNode R2d:MultiValuedPredicate: Construct used when there are multiple predicate names that refer to the same overall object type R2d:BelongsToBlankNode: Construct used relate the property column bridges to their parent blank node R2d:SimpleLiteralBlankNode EmpURI/EmpA City Street Address State EmpURI/EmpA Phone Cell Work R2d:ComplexLiteralBlankNode R2d:MultiValuedPredicate R2d:BelongsToBlankNode EmpURI/EmpA Home Address State City Street Work Address State City Street R2d:MultiValuedSimpleLiteral BlankNode (MVSLBN): Construct used to relate duplicate SLBNs to relational database columns R2d:MultiValuedComplexLiteral BlankNode (MVCLBN): Construct used to relate duplicate CLBNs to relational database columns EmpURI/EmpA Present Phone Numbers Work Cell Past Phone Numbers Work Cell R2d:SimpleResourceBlankNode (SRBN): Construct used to map blank nodes that have multiple predicates leading to resource objects belonging to the same object class EmpURI/EmpA Projects Link to Project1 Link to Project2 Link to Project3 Works On R2d:ComplexResourceBlankNode (CRBN): Construct used to map blank nodes leading to objects belonging to difference object classes EmpURI/EmpA Other Activities Link to Training1 Link to Course1 Training Teaching R2d:MultiValuedSimple LiteralBlankNode R2d:MultiValuedPredicate R2d:MultiValuedCom- plexLiteralBlankNode R2d:SimpleResourceBlankNode R2d:ComplexResourceBlankNode R2d:MultiValuedPredicate

29 RDFMapFileGenerator – Map File Excerpts map:Employee a r2d:TableMap; r2d:keyField Employee_PK; map:Name a r2d:SimpleLiteralBlankNode; r2d:belongsToTableMap map:Employee; r2d:predicate ; map:Name_First a r2d:ColumnBridge; r2d:belongsToBlankNode map:Name; r2d:datatype xsd:String; r2d:predicate ; map:Employee_Nickname a r2d:ColumnBridge; r2d:belongsToTableMap map:Employee; r2d:datatype xsd:String; r2d:predicate ; map:Employee_Department a r2d:ColumnBridge; r2d:belongsToTableMap map:Employee; r2d:refersToTableMap map:Department; r2d:datatype xsd:String; r2d:predicate ; map:Phone a r2d:ComplexLiteralBlankNode; r2d:belongsToTableMap map:Employee; r2d:predicate ; map:Phone_Value a r2d:MultiValuedColumnBridge; r2d:belongsToBlankNode map:Phone; r2d:datatype xsd:String; r2d:MultiValuedPredicate Phone_Type; map:Phone_Type a r2d:MultiValuedPredicate; r2d:predicate ; map:Projects a r2d:SimpleResourceBlankNode; r2d:belongsToTableMap map:Employee; r2d:predicate ; map:Projects_WorksOn a r2d:MultiValuedColumnBridge; r2d:belongsToBlankNode map:Projects; r2d:refersToTableMap map:Project; r2d:datatype xsd:String; r2d:predicate ; 29 EmpURI/EmpA Middle First Name Last NickName Department Link to Department EmpURI/EmpA Cell Phone Work Projects WorksOn Link to Project1 Link to Project2 Link to Project3

30 R2D In Action 30

31 DBSchemaGenerator Second component in the R2D Transformation Framework Using the map file as input, generates the actual virtual normalized relational schema for the RDF store A new table is created in the equivalent relational schema in the following scenarios: (a) When a distinct resource class is encountered (i.e. when an r2d:TableMap construct is encountered in the Map File) (b) When duplicate predicates with literal objects are encountered (i.e. when an r2d:MultiValuedColumnBridge predicate is encountered) (d) When a blank node (or nodes) is encountered that has multiple predicates (some, but not all, distinct), each leading to literal values from the same object class (i.e. when an r2d:ComplexLiteralBlankNode (CLBN) or r2d:MultiValuedCLBN is encountered) (e) When N:M relationships between the subject and object resources are encountered (i.e. when r2d:MVCBs or SRBNs or CRBNs with appropriate mutually referencing r2d:RefersToTableMap constructs are encountered in both the subject as well as the object resources) EmpURI/EmpA Phone Cell Work R2d:ComplexLiteralBlankNode 31 R2d:MultiValuedColumnBridge EmpURI/EmpA Dependent Dependent SRBN referencing ProjectSRBN referencing Employee (c) When multiple similar blank nodes with distinct simple literal predicates are encountered (i.e. when an r2d:MultiValuedSimpleLiteralBlankNodes is encountered) R2d:TableMap R2d:MultiValuedSimple LiteralBlankNode

32 DBSchemaGenerator EmpURI/EmpA Name R2d:TableMap R2d:ColumnBridge Column All simple properties, i.e., simple r2d:ColumnBridges, become columns in the r2d:TableMap corresponding to the subject of the property Properties belonging to r2d:SimpleLiteralBlankNodes become columns in the r2d:TableMap corresponding to the subject of the blank node 32 EmpURI/EmpA City Street Address State R2d:SimpleLiteralBlankNode R2d:TableMap Columns

33 Sample RDF Graph with Reification & its Relational Equivalent 33

34 R2D In Action 34

35 SQL2SPARQL Translation Last stage in the R2D Transformation Framework Translates SQL statements issued against the virtual relational schema into equivalent SPARQL queries to be executed against the actual RDF store Obtained results are returned to the relational tool in tabular format Sample Query SELECT Name_First, Name_last, Phone_Value, department_name FROM employee, employee_Phone, department WHERE employee.employee_PK = employee_Phone.employee_PK and employee_Phone.Phone_Type = and employee.department_id = department.department_id AND (name_First LIKE ‘ABC%’ OR employee_pk = );

36 SQL2SPARQL Translation SELECT Name_First, Name_last, Phone_Value, department_name FROM employee, employee_Phone, department WHERE employee.employee_PK = employee_Phone.employee_PK and employee_Phone.Phone_Type = and employee.department_id = department.department_id AND (name_First LIKE ‘ABC%’ OR employee_pk = ); SPARQL SELECT list – One variable for every field in the SQL SELECT list SparqlSELECT = SELECT ?name_First ?name_Last, ?Phone_Value ? department_name SPARQL WHERE clause – A clause of the form for every variable in the SPARQL SELECT list SparqlWHERE = WHERE { ?subject0 ?employee_name. ?employee_Name ?name_First. ?employee_Name ? name_Last. ?subject0 ?employee_department_id. ?subject1 ?department_name. ?subject0 http://empl/Phone ?employee_Phone. ?employee_Phone ?Phone_Type ?Phone_Value. SPARQL FILTER clause – A clause added for each SQL WHERE clause SparqlFILTER = FILTER ( ?Phone_Type = && employee_department_id = subject1 && (regex(?name_First, “^ABC”) || ?subject0 = http://empl/123) }

37 SQL2SPARQL Translation Processing of fields corresponding to blank nodes If field belongs to an r2d:SimpleLiteralBlankNode, the following clauses are added {?subject ?. ? ?. } Example: Clauses resulting from processing of the “Name_First” and “Name_Last” field ?subject0 ?employee_name. ?employee_Name ?name_First. ?employee_Name ? name_Last. EmpURI/EmpA Middle First Name Last

38 SQL2SPARQL Translation If field belongs to an r2d:ComplexLiteralBlankNode or other blank nodes consisting of r2d:MultiValuedPredicates, the following clauses are added to the SPARQL WHERE and FILTER clauses ?subject ? ? ? ? ? FILTER {? = } Example: Clauses resulting from processing of the “Phone_Value” field (corresponding to the “Cell” and “Work” predicates) belonging to the “Phone” SLBN ?subject0 http://empl/Phone ?employee_Phone. ?employee_Phone ?Phone_Type ?Phone_Value. FILTER {?Phone_Type = } EmpURI/EmpA Cell Phone Work

39 SQL2SPARQL Translation Transformed Equivalent SPARQL Query SELECT ?name_First ?name_Last, ?Phone_Value ? department_name WHERE { ?subject0 ?employee_name. ?employee_Name ?name_First. ?employee_Name ? name_Last. ?subject0 ?employee_department_id. ?subject1 ?department_name. ?subject0 http://empl/Phone ?employee_Phone. ?employee_Phone ?Phone_Type ?Phone_Value. FILTER ( ?Phone_Type = && employee_department_id = subject1 && (regex(?name_First, “^ABC”) || ?subject0 = http://empl/123) } Original SQL Query SELECT Name_First, Name_last, Phone_Value, department_name FROM employee, employee_Phone, department WHERE employee.employee_PK = employee_Phone.employee_PK and employee_Phone.Phone_Type = and employee.department_id = department.department_id AND (name_First LIKE ‘ABC%’ OR employee_pk = );

40 R2D In Action 40

41 Experimental Results RDF Schema used in the experiments 41

42 Map File Generation Times 42

43 Experimental Results Sample Query through Datavision

44 Query Processing Times 44

45 Conclusions A JDBC interface called R2D that bridges the gap between RDF data stores and relational databases has been introduced. Screenshots from a relational visualization tool called Datavision were presented as evidence of the feasibility of our research and the performance of queries against databases of various sizefss are also presented. Future Work Improving the normalization process for mixed blank nodes Support for translation of a richer selection of SQL statements including nested and correlated sub-queries 45

46 Related Publications 1) S.Ramanujam, A.Gupta, L.Khan, S.Seida, and B.Thuraisingham, “Relationalizing RDF Stores for Tools Reusability”, In 18 th International World Wide Web Conference, 2009, pp. 1059-1060. (Nominated for Best Poster Award) 2) S.Ramanujam, A.Gupta, L.Khan, S.Seida, and B.Thuraisingham, “R2D: Extracting Relational Structure from RDF Stores”, Accepted for publication in Proceedings of the International Conference on Web Intelligence, September 16-18, 2009. 3) S.Ramanujam, A.Gupta, L.Khan, S.Seida, and B.Thuraisingham, “A Relational Wrapper for RDF Reification”, Accepted for publication in Proceedings of the International Conference on Trust Management, June 16-19, 2009. 4) S.Ramanujam, A.Gupta, L.Khan, S.Seida, and B.Thuraisingham, “R2D: A Bridge between the Semantic Web and Relational Visualization Tools”, Accepted for publication in International Conference on Semantic Computing, September 14-16, 2009. 5) S.Ramanujam, A.Gupta, L.Khan, S.Seida, and B.Thuraisingham, “A Framework for the Relational Transformation of RDF Data”, Submitted to the International Journal on Semantic Computing (Invited Paper). 6) S.Ramanujam, A.Gupta, L.Khan, S.Seida, and B.Thuraisingham, “Relationalization of Provenance Data in Complex RDF Reification Nodes”, Submitted to the Electronic Commerce Research Journal - special issue on Trust and Privacy Aspects of Electronic Commerce (Invited Paper).

47 Thank You 47


Download ppt "1 Sunitha Ramanujam 1, Anubha Gupta 1, Latifur Khan 1, Steven Seida 2, Bhavani Thuraisingham 1 1 The University of Texas at Dallas 2 Raytheon Company *Funded."

Similar presentations


Ads by Google