How to map relational database to OWL?

China☆狼群 提交于 2019-12-10 19:17:46

问题


I am trying to map relational database to OWL Here are my 2 tables student(student_id,student_name,course_id)
course(course_ID,course_name)

+----+--------+-----------+    
| id | name   | course_id |  
+----+--------+-----------+     
|  1 | Adam   |         5 |   
|  2 | Michael|         2 |    
+----+--------+-----------+   
+-----------+-------------+    
| course_id | course_name |   
+-----------+-------------+      
|         2 | DM          |    
|         5 | WEBIR       |  
+-----------+-------------+

Now course_id is the foreign key in student table referencing course_id in course table.I created ontology(defined the schema) using Protege 4.3

I am trying to insert data into the OWL file as instances using Jena API. In ontology, columns which are not foreign keys were mapped to datatype properties and foreign keys are mapped to object property as per this paper(mapping relational to OWL(section 4.4.4)). I am adding the tuples as instances to the student and course classes in Jena. If foreign key is object property how can i use it to uniquely determine relation. Here is the jena code I have used to add data as instances to owl file created in Protege.

    for (student std : studlist) {
        Individual stud = stud_ont.createIndividual(nspace + "student/"
                + std.getStudent_id());
        stud.addProperty(stud_id, std.getStudent_id());
        stud.addProperty(stud_name, std.getStudent_name());
        stud.addProperty(reln, std.getCourse_id());
        PrintStream p = new PrintStream(
                "/home/owlDM/newedu.owl");
        m.writeAll(p, "RDF/XML", null);
        p.close();
    }
    for (course crs : courselist) {

        Individual cour = course_ont.createIndividual(nspace + "course/"
                + crs.getCourse_name());
        cour.addProperty(course_course_name, crs.getCourse_name());
        PrintStream p = new PrintStream(
                "/home/owlDM/newedu.owl");
        m.writeAll(p, "RDF/XML", null);
        p.close();
    }

Here "reln" is the object property(functional) for which I am adding course_id(values) which is the foreign key. But would it help in relating two instances ,meaning Suppose I need to infer "Adam has taken WebIR Course".

How can my object property can replace foreign key value in relational to uniquely join two tuples of two classes?
Please suggest,Any help is greatly appreciated.


回答1:


"The D2RQ Platform is a system for accessing relational databases as virtual, read-only RDF graphs".

You might want to have a look at that



来源:https://stackoverflow.com/questions/22613404/how-to-map-relational-database-to-owl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!