如何将关系数据库映射到OWL? [英] How to map relational database to OWL?

查看:95
本文介绍了如何将关系数据库映射到OWL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将关系数据库映射到OWL 这是我的两张桌子 学生(学生编号,学生姓名,课程编号)
课程(课程ID,课程名称)

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       |  
+-----------+-------------+

现在course_id是学生表引用中的外键 课程表中的course_id.我使用Protege 4.3创建了本体(定义了架构)

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

我正在尝试使用Jena API将数据作为实例插入到OWL文件中. 在本体中,不是外键的列被映射到数据类型 属性和外键根据本文映射到对象属性(与OWL相关的映射(第4.4.4节)). 我将元组作为实例添加到耶拿的学生和课程课程中. 如果外键是对象属性,我该如何使用它唯一地确定关系. 这是我用来在Protege中创建的猫头鹰文件中将数据作为实例添加的耶拿代码.

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();
    }

这里"reln"是对象属性(功能),为此我要添加作为外键的course_id(值). 但这会有助于关联两个实例,意思是 假设我需要推断亚当参加了WebIR课程".

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.

推荐答案

" D2RQ 平台是用于访问的系统关系数据库作为虚拟的只读RDF图".

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

您可能想看看

这篇关于如何将关系数据库映射到OWL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆