usc-isi-i2 / Web-Karma

Information Integration Tool
http://www.isi.edu/integration/karma/
Apache License 2.0
585 stars 196 forks source link

Table name in published model #39

Closed FrenkT closed 10 years ago

FrenkT commented 10 years ago

Hi, I'm currently creating an R2RML model from karma web UI, publishing it and using it to periodically generate RDF in batch mode. My problem is that in the R2RML contains some reference about the name of the MySQL table that I used to generate it, but I would like to use it with tables that have different names but still the same content. For example, I published the model using a table named "sensors1", I would like to use the R2RML to publish RDF of a table named "sensors2" that has the same columns as "sensors1". Is this possible to to this? Maybe using some regular expressions in the R2RML? Thanks

szeke commented 10 years ago

Hi,

The offline mode supports using a single model to generate RDF from multiple table. Here is an example invocation.

mvn exec:java -Dexec.mainClass="edu.isi.karma.rdf.OfflineRdfGenerator" -Dexec.args="--sourcetype DB --modelfilepath .ttl --outputfile

--dbtype MySQL --hostname xxx.edu --username pedro --password szekely --portnumber 3306 --dbname mydb --tablename mytable" &> xxx.log You must execute this command in your Web-Karma installation directory. I think you just need to substitute the --tablename value. BTW, next week we will release an upgrade to the RDF generation that works almost 100 times faster and can generate about 1M triples per minute. Thanks for using Karma Pedro On Fri, Oct 25, 2013 at 3:57 AM, FrenkT notifications@github.com wrote: > Hi, I'm currently creating an R2RML model from karma web UI, publishing it > and using it to periodically generate RDF in batch mode. My problem is that > in the R2RML contains some reference about the name of the MySQL table that > I used to generate it, but I would like to use it with tables that have > different names but still the same content. > For example, I published the model using a table named "sensors1", I would > like to use the R2RML to publish RDF of a table named "sensors2" that has > the same columns as "sensors1". Is this possible to to this? Maybe using > some regular expressions in the R2RML? Thanks > > — > Reply to this email directly or view it on GitHubhttps://github.com/InformationIntegrationGroup/Web-Karma/issues/39 > .
FrenkT commented 10 years ago

I'm using that invocation, and it usually works. The problem is that in the R2RML file there is some reference to the name of the table that I used to generate it, for example in my model I can see entries like this: km-dev:sourceName "DB1" : rr:tableName "DB1"

I think that this makes me get an error if I call the offline RDF generation with --tablename DB2 , even if DB2 has the same columns as DB1. This is the error: edu.isi.karma.webserver.KarmaException: Resource not found in model for the source: DB2

szeke commented 10 years ago

We will try to replicate the problem. The idea is that the command line parameter should override the rr:tableName, and looks like this is not working properly.

Can you post the full stack trace of the error so we can be sure we are replicating your error.

FrenkT commented 10 years ago

This is the terminal message and error. The table park_replica exists and i replaced all the table reference in the R2RML with another name.

[INFO] Scanning for projects... [INFO]
[INFO] ------------------------------------------------------------------------ [INFO] Building ISI Karma Maven Webapp 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ webkarma >>> [INFO] [INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ webkarma <<< [INFO] [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ webkarma --- Loading the R2RML model file...done Generating RDF... ERROR edu.isi.karma.rdf.OfflineRdfGenerator.main() - Error occured while generating RDF! edu.isi.karma.webserver.KarmaException: Resource not found in model for the source: park_replica at edu.isi.karma.kr2rml.WorksheetR2RMLJenaModelParser.(WorksheetR2RMLJenaModelParser.java:107) at edu.isi.karma.rdf.DatabaseTableRDFGenerator.generateRDFFromWorksheet(DatabaseTableRDFGenerator.java:148) at edu.isi.karma.rdf.DatabaseTableRDFGenerator.generateRDF(DatabaseTableRDFGenerator.java:135) at edu.isi.karma.rdf.OfflineRdfGenerator.main(OfflineRdfGenerator.java:204) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:724) [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.454s [INFO] Finished at: Sun Oct 27 12:52:48 CET 2013 [INFO] Final Memory: 20M/210M [INFO] ------------------------------------------------------------------------

szeke commented 10 years ago

Thx for the stack trace. We will take a look.

dkapoor commented 10 years ago

Issue fixed and pushed to development branch

szeke commented 10 years ago

Pushed to master.