How to combine multiple MySQL databases using D2RQ?

176 Views Asked by At

I have four different MySQL databases that I need to convert into Linked Data and then run queries on the aggregated data. I have generated the D2RQ maps separately and then manually copied them together into a single file. 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.
  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. 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?

1

There are 1 best solutions below

1
On

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. For your D2RQ mapping file, you should read carefully The mapping language, it's not normal to have classes corresponding to columns. If you give an example of your table structure, I can give you an illustration of a mapping file. Good luck