oeg-upm / morph-rdb

Virtual Knowledge Graph Creation from RDB with R2RML
https://morph.oeg.fi.upm.es/tool/morph-rdb
Other
41 stars 38 forks source link

Cannot execute a query from Berlin SPARQL Benchmark #34

Closed mchaloupka closed 4 years ago

mchaloupka commented 6 years ago

Hi, do you support queries from BSBM? I have tried to execute a query and it failed.

See attached files to see what happens. In general I was not able to query anything where a join is involved. Extension of the files was changed (or added) to .txt so it can be uploaded to github.

example.properties.txt Query_01.txt bsbm.txt log.txt

fpriyatna commented 6 years ago

hi Milos, Thanks for trying morph.

Yes, queries from BSBM are supported. I will check with the files that you provided.

Regards Freddy

mchaloupka commented 6 years ago

Thanks. By the way, for me it would be enough if you will give me enough information how to make it running for BSBM over MSSQL or MySQL. Ideally, if it would be possible even to run some SPARQL endpoint which can be accessed from BSBM test driver (I have not seen anywhere whether you support something like that or not).

Miloš

mchaloupka commented 6 years ago

By the way, I have update the log.txt attachment, originally it was empty because I have redirected only standard output to the file, not the error output.

fpriyatna commented 6 years ago

hi Miloš,

I have just uploaded a new release, please pull your repository, or use this jar: https://github.com/oeg-upm/morph-rdb/releases/download/v3.9.14/morph-rdb-dist-3.9.14.jar

Mapping document and query file can be found at: https://github.com/oeg-upm/morph-rdb/tree/master/morph-examples/examples-bsbm-mysql

Let me know if you still encounter problems.

Freddy

mchaloupka commented 6 years ago

Hi @fpriyatna, I have tried it but with no luck. I have used dependencies from 3.9.0 - could that be an issue?

Not sure whether I am executing it correctly. In the root folder (F:\Morph) I have all files needed for the query (.rq, .properties, .ttl) and a batch file to execute it.

This is the batch file I use to execute the query:

cd dist
java -cp morph-rdb.jar;dependency/* es.upm.fi.dia.oeg.morph.r2rml.rdb.engine.MorphRDBRunner "F:\Morph" example.properties
cd ..

Output of the run is as follows: log.txt

Do you have any idea what I am doing wrong? Thanks.

dachafra commented 4 years ago

Hi, I think you are not including the dependency jars, bc you have to move the generated morph-rdb jar file to the examples folder. We updated the documentation last year, could you take a look and see if it is resolved?

Thanks!

mchaloupka commented 4 years ago

Hi,

it is not resolved although in the newer version there is a different exception (previously there was a scala.MatchError, now there is NoSuchElementException.

Steps to reproduce: It requires docker and .NET Core SDK 3.1 or newer installed.

  1. Start a mysql database with BSBM data: clone https://github.com/mchaloupka/r2rml-benchmark, run dotnet fsi and it opens you a console where you should execute the following queries:
    1. #load "benchmark.fsx"
    2. Benchmark.generateData 20
    3. open Database
    4. open Docker
    5. createNetwork benchmarkNetwork
    6. startDatabaseContainer Databases.MySql
    7. ;;
  2. In a different console, start an ubuntu container with the following commands:
    1. docker run --net=benchmark-net --rm -it --name morph ubuntu:latest
    2. mkdir /morph
    3. cd /morph
  3. Using yet another console, copy the attached files into the docker image: Files.zip
    1. docker cp query.morph.properties morph:/morph/query.morph.properties
    2. docker cp Query_01.rq morph:/morph/Query_01.rq
  4. Back in the console with ubuntu container, perform the following commands:
    1. apt-get update
    2. apt-get install wget
    3. apt-get install unzip
    4. apt-get install default-jre
    5. wget https://github.com/oeg-upm/morph-rdb/releases/download/morph-RDB_v3.9.17/dependency.zip
    6. unzip dependency.zip
    7. wget https://github.com/oeg-upm/morph-rdb/releases/download/morph-RDB_v3.9.17/morph-rdb-dist-3.9.17.jar
    8. ln -s morph-rdb-dist-3.9.17.jar morph-rdb.jar
    9. wget https://raw.githubusercontent.com/mchaloupka/bsbm-r2rml/develop/src/main/dist/rdb2rdf/mapping.ttl
    10. java -cp .:morph-rdb.jar:dependency/* es.upm.fi.dia.oeg.morph.r2rml.rdb.engine.MorphRDBRunner . query.morph.properties

The last command should succeed, but it generates the following output itself:

log4j:WARN No appenders could be found for logger (es.upm.fi.dia.oeg.morph.r2rml.rdb.engine.MorphRDBRunner$).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
java.util.NoSuchElementException: next on empty iterator
        at scala.collection.Iterator$$anon$2.next(Iterator.scala:39)
        at scala.collection.Iterator$$anon$2.next(Iterator.scala:37)
        at es.upm.fi.dia.oeg.morph.base.querytranslator.MorphBaseQueryTranslator$$anonfun$22.apply(MorphBaseQueryTranslator.scala:1435)
        at es.upm.fi.dia.oeg.morph.base.querytranslator.MorphBaseQueryTranslator$$anonfun$22.apply(MorphBaseQueryTranslator.scala:1433)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
        at scala.collection.Iterator$class.foreach(Iterator.scala:891)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
        at scala.collection.MapLike$DefaultKeySet.foreach(MapLike.scala:174)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
        at scala.collection.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:47)
        at scala.collection.SetLike$class.map(SetLike.scala:92)
        at scala.collection.AbstractSet.map(Set.scala:47)
        at es.upm.fi.dia.oeg.morph.base.querytranslator.MorphBaseQueryTranslator.translate(MorphBaseQueryTranslator.scala:1433)
        at es.upm.fi.dia.oeg.morph.base.querytranslator.MorphBaseQueryTranslator.translate(MorphBaseQueryTranslator.scala:1483)
        at es.upm.fi.dia.oeg.morph.base.engine.MorphBaseRunner$$anonfun$1.apply(MorphBaseRunner.scala:213)
        at es.upm.fi.dia.oeg.morph.base.engine.MorphBaseRunner$$anonfun$1.apply(MorphBaseRunner.scala:211)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
        at scala.collection.immutable.List.foreach(List.scala:392)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
        at scala.collection.immutable.List.map(List.scala:296)
        at es.upm.fi.dia.oeg.morph.base.engine.MorphBaseRunner.translateSPARQLQueriesIntoSQLQueries(MorphBaseRunner.scala:211)
        at es.upm.fi.dia.oeg.morph.base.engine.MorphBaseRunner.run(MorphBaseRunner.scala:181)
        at es.upm.fi.dia.oeg.morph.r2rml.rdb.engine.MorphRDBRunner$.main(MorphRDBRunner.scala:78)
        at es.upm.fi.dia.oeg.morph.r2rml.rdb.engine.MorphRDBRunner.main(MorphRDBRunner.scala)

I have verified (using Ontop), that the query should return a result so it is definitely not correct that the result.nt output is empty and therefore it seems that the logged error is not just transient.

To shutdown the container with morph, you can just press Ctrl+D. To shutdown the database, just use the following commands in the console where you had it created (still inside of the fsi environment):

  1. Docker.stopAndRemoveContainer databaseDockerName
  2. removeNetwork benchmarkNetwork
  3. ;;
  4. #quit;;
dachafra commented 4 years ago

Thank you for your feedback. We've already the same issue and the reason is because the engine only searches in the rr:class mapping properties when a query asks about a type (in your case ProductType). We are currently working on it for extending the search to find this kind of predicates in the POM.

If you want to run morph-rdb in the current state you can substitute the predicate using other such as bsbm:productType (instead of rdf:type) and the problem should be resolved. This change may only impact in the case you perform query rewriting techniques over the query, but if you are only performing a query-translation/execution from SPARQL-to-SQL shouldn't have any impact in the total performance.

dachafra commented 4 years ago

After one month we don't receive any comment so it's assumed that issue is solved. Additionally, we try to reproduce the generation of the benchmark and we obtain errors in the output. Log added. issue clossed. log-benchmark.txt

mchaloupka commented 4 years ago

Hi @dachafra ,

thanks for providing the log. I will look into it, it should be fixed in few days, I have created a ticket on my side to handle it and ensure that you can run it.

Is the issue with supporting only rr:class already resolved? I have not found such issue in the list of either opened or closed, so I do not know what is the state of that.

Regards, Milos

dachafra commented 4 years ago

The engine supports rr:class but it has an issue solving rdf:type predicates in common POMs (we will open an issue soon as it is currently under our ToDo list). I'll mention you on that issue. Thanks for the feedback.