简体   繁体   English

如何使用D2RQ合并多个MySQL数据库?

[英]How to combine multiple MySQL databases using D2RQ?

I have four different MySQL databases that I need to convert into Linked Data and then run queries on the aggregated data. 我有四个不同的MySQL数据库,需要将它们转换为链接数据,然后对聚合数据运行查询。 I have generated the D2RQ maps separately and then manually copied them together into a single file. 我已经分别生成了D2RQ映射,然后将它们手动复制到一个文件中。 I have read up some material on customizing the maps but am finding it hard to do so in my case because: 我已阅读了一些有关自定义地图的材料,但由于这种情况,我发现很难这样做:

  1. The ontology classes do not correspond to table names. 本体类与表名不对应。 In fact, most classes are column headers. 实际上,大多数类都是列标题。
  2. When I open the combined mapping in Protege, it generates only 3 classes (ClassMap, Database, and PropertyBridge) and lists all the column headers as instances of these. 当我在Protege中打开组合映射时,它仅生成3个类(ClassMap,Database和PropertyBridge),并列出所有列标题作为这些实例的实例。
  3. If I import this file into my ontology, everything becomes annotation. 如果我将此文件导入到本体中,则所有内容都将成为注释。

Please suggest an efficient way to generate a single graph that is formed by mapping these databases to my ontology. 请提出一种有效的方法来生成通过将这些数据库映射到我的本体而形成的单个图形。

Here is an example. 这是一个例子。 I am using the EEM ontology to refine the mapping file generated by D2RQ. 我正在使用EEM本体来完善D2RQ生成的映射文件。 This is a section from the mapping file: 这是映射文件中的一部分:

map:scan_event_scanDate a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:scan_event;
    d2rq:property vocab:scan_event_scanDate;
    d2rq:propertyDefinitionLabel "scan_event scanDate";
    d2rq:column "scan_event.scanDate";
    # Manually added
    d2rq:datatype xsd:int;
    .
map:scan_event_scanTime a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:scan_event;
    d2rq:property vocab:scan_event_scanTime;
    d2rq:propertyDefinitionLabel "scan_event scanTime";
    d2rq:column "scan_event.scanTime";
    # Manually added
    d2rq:datatype xsd:time;

The ontology I am interested in has the following: 我感兴趣的本体具有以下特征:

Data property: eventOccurredAt
Domain: EPCISevent
Range: datetime

Now, how should I modify the mapping file so that the date and time are two different relationships? 现在,我应该如何修改映射文件,以便日期和时间是两个不同的关系?

I think the best way to generate a single graph of your 4 databases is to convert them one by one to a Jena Model using D2RQ, and then use the Union method to create a global model. 我认为生成4个数据库的单个图形的最佳方法是使用D2RQ将它们一个一转换为Jena模型,然后使用Union方法创建全局模型。 For your D2RQ mapping file, you should read carefully The mapping language , it's not normal to have classes corresponding to columns. 对于D2RQ映射文件,您应该仔细阅读映射语言 ,拥有与列相对应的类是不正常的。 If you give an example of your table structure, I can give you an illustration of a mapping file. 如果您举一个表结构的例子,我可以给您一个映射文件的例子。 Good luck 祝好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM