Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with QueryReasoner #4

Open
hmqq opened this issue Apr 13, 2022 · 13 comments
Open

Problem with QueryReasoner #4

hmqq opened this issue Apr 13, 2022 · 13 comments

Comments

@hmqq
Copy link

hmqq commented Apr 13, 2022

I am trying to create a query reasoner (for testing purposes) and I have written 2 lines for it but I am getting the below exception if I pass query reasoner the ontology file.
2022-04-13 16:09:33 PagodaProperties - Unable to find user-defined configuration file ("pagoda.properties" in classpath) 2022-04-13 16:09:33 PagodaProperties - Using default configuration 2022-04-13 16:09:33 PagodaProperties - Debugging mode is enabled 2022-04-13 16:09:33 PagodaProperties - The directory where statistics are saved is: "statistics" Exception in thread "main" java.lang.NoSuchFieldError: NarrowParallelHead at uk.ac.ox.cs.pagoda.reasoner.light.RDFoxQueryEngine.createDataStore(RDFoxQueryEngine.java:35) at uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine.<init>(BasicQueryEngine.java:30) at uk.ac.ox.cs.pagoda.reasoner.RLQueryReasoner.<init>(RLQueryReasoner.java:22) at uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.getInstance(QueryReasoner.java:65) at uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.getInstance(QueryReasoner.java:53) at testingModularity.test0.checkPagoda(test0.java:113) at testingModularity.test0.main(test0.java:107)
And if I pass the pagoda.properties file then I get the following below error. even though the class is able to find the .properties file. I have used the "pagoda.properties" from your repository with some changes to value but the syntax is the same. But the changes like debugging are off etc I don't see as it is unable to read the new property files. Also, I tried using a different name for the property file but of no use.
2022-04-13 16:14:17 PagodaProperties - Unable to find user-defined configuration file ("pagoda.properties" in classpath) 2022-04-13 16:14:17 PagodaProperties - Using default configuration 2022-04-13 16:14:17 PagodaProperties - Debugging mode is enabled 2022-04-13 16:14:17 PagodaProperties - The directory where statistics are saved is: "statistics" Exception in thread "main" java.lang.NullPointerException at java.io.File.<init>(File.java:277) at uk.ac.ox.cs.pagoda.owl.OWLHelper.loadOntology(OWLHelper.java:69) at uk.ac.ox.cs.pagoda.owl.OWLHelper.loadOntology(OWLHelper.java:81) at uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.getInstance(QueryReasoner.java:36) at testingModularity.test0.checkPagoda(test0.java:113) at testingModularity.test0.main(test0.java:107)

I am using the Pagoda jar file without dependencies (also I get the same error on the jar with dependency as well). I am also attaching the code that i i am trying to execute.
public static void checkPagoda(OWLOntology ontology) throws IOException { PagodaProperties properties = new PagodaProperties("../chainsawTesting/src/main/java/resource/pagoda.properties"); QueryReasoner pagoda = QueryReasoner.getInstance(properties); System.out.println("Done" + pagoda); }
I don't know what is going wrong. Any help would be appreciated. Thank you!

@dyamon
Copy link
Member

dyamon commented Apr 13, 2022

I might need some more info to help you but here are my 2 cents from quickly looking at this.
The problem with the first error is not the pagoda.properties file. The error part is:

java.lang.NoSuchFieldError: NarrowParallelHead at
uk.ac.ox.cs.pagoda.reasoner.light.RDFoxQueryEngine.createDataStore(RDFoxQueryEngine.java:35) at
uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine.<init>(BasicQueryEngine.java:30) at
uk.ac.ox.cs.pagoda.reasoner.RLQueryReasoner.<init>(RLQueryReasoner.java:22) at
uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.getInstance(QueryReasoner.java:65) at
uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.getInstance(QueryReasoner.java:53) at
testingModularity.test0.checkPagoda(test0.java:113) at testingModularity.test0.main(test0.java:107)

As far as I can tell (mind that I was not the main developer of PAGOdA) NarrowParallelHead is not found in the DataStore class, which is something declared by JRDFox. Are you providing the JRDFox library? Is the first error returned even when you use the pagoda-with-dependencies.jar as a library?

Also, can you try an run the example?

@hmqq
Copy link
Author

hmqq commented Apr 13, 2022

Are you providing the JRDFox library? Yes, I am providing it the JRDFox library.
With pagoda-with-dependencies.jar i get the following error
withdependencyError
Also, when I try the given example without-pagoda-dependecnies. jar. I get the same error attached below.
withoutdependecy

I know "NarrowParallelHead" is not found but how can I change it.

@hmqq
Copy link
Author

hmqq commented Apr 13, 2022

Okay if i try the Pagoda-Master then the error changed attached below. Now the error is related to linking some .dll files
pagoda--masterError
the line in picture is trimmed so I am pasting it here
Can't load this .dll (machine code=0x727c) on a AMD 64-bit platform
What to do with this now?

@dyamon
Copy link
Member

dyamon commented Apr 14, 2022

Thanks for the additional info!

Where did you find that particular version of RDFox? What happens if you use the copy shipped with PAGOdA, instead? With this I mean to copy the repo folder in this repository to your project. At the moment PAGOdA is shipped with RDFox 1.0 (last version to be open source iirc) but yours is marked as build2213.
I wonder if this is the explaination behind all the problems you are reporting.

@hmqq
Copy link
Author

hmqq commented Apr 14, 2022

If i used the copy of RDFox shipped with PAGOdA then I get the following error.
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\AppData\Local\Temp\CppRDFox1552507528037278959.dylib: Can't load this .dll (machine code=0xZXXY) on a AMD 64-bit platform at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817) at java.lang.Runtime.load0(Runtime.java:810) at java.lang.System.load(System.java:1086) at uk.ac.ox.cs.JRDFox.store.DataStore.loadRDFoxFromJar(Unknown Source) at uk.ac.ox.cs.JRDFox.store.DataStore.<clinit>(Unknown Source) at uk.ac.ox.cs.pagoda.reasoner.light.RDFoxQueryEngine.createDataStore(RDFoxQueryEngine.java:35) at uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine.<init>(BasicQueryEngine.java:30) at uk.ac.ox.cs.pagoda.reasoner.RLQueryReasoner.<init>(RLQueryReasoner.java:22) at uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.getInstance(QueryReasoner.java:65) at uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.getInstance(QueryReasoner.java:53) at testingModularity.example.test(example.java:24) at testingModularity.example.main(example.java:49)

The other copy of RDFox build2213 I get it from MoRE repository and I use this because it also uses PAGodA and for testing purpose. But failed to do so. I don't know what I am doing wrong?

@dyamon
Copy link
Member

dyamon commented Apr 14, 2022

If this is not a problem, would you mind sharing the project here? If this is in a public repo, even better.

I'll try and find some time to reproduce the error. This might take a bit since I am a bit busy atm and only have access to linux machines (while you seem to be running things under Windows)

@hmqq
Copy link
Author

hmqq commented Apr 14, 2022

Yes, sure. I have attached 2 projects (1) pagoda with all dependencies and (2) pagoda with no dependency, files I am using.

PagodawithDependencies.zip
PagodaWithoutDependency.zip

Currently, I am trying Pagoda with Linux to see whether it's a problem with OS or not.

@hmqq
Copy link
Author

hmqq commented Apr 29, 2022

Hi. I have tested with Linux and I get the same issue as before. Did you find some time to reproduce the error?

@dyamon
Copy link
Member

dyamon commented Apr 30, 2022

Sorry, I have been a quite busy these weeks but this is still on my radar. I'll get back to you asap.

@dyamon
Copy link
Member

dyamon commented May 20, 2022

Hey, sorry for the delay (had to submit my thesis 😬)
I could not reproduce the error you are showing.

I tried the following:

  1. Download your PagodawithDependencies.zip
  2. Get a copy of pagoda-2.1.2-jar-with-dependencies.jar from PAGOdA, added under a folder lib/ in your project directory
  3. Add the following to your pom.xml dependences. I don't know how you are providing the OWLAPI library but this lets Maven take care of it.
<dependency>
      <groupId>net.sourceforge.owlapi</groupId>
      <artifactId>owlapi-distribution</artifactId>
      <version>5.1.20</version>
</dependency>
<dependency>
      <groupId>uk.ox.ac.uk.pagoda</groupId>
      <artifactId>pagoda</artifactId>
      <version>2.1.2</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/lib/pagoda-2.1.2-jar-with-dependencies.jar</systemPath>
</dependency>

This also tells Maven where to find the local PAGOdA library. Note that there are better ways to do it...we can discuss that later.

  1. I also removed the first line from App.java. It was giving me some problem and didn't really want to deal with that atm
package com.hmq.aau.PagodawithDependencies;
  1. Also under Linux I had to change the hardcoded paths to LUBM data and ontology. Mainly "\\" -> "/".
  2. Note that QueryReasoner.evaluate(String) takes a query, but you are passing a query file instead. Something like this should work for a quick example
String query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
    + "PREFIX ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>\n"
    + "SELECT ?X\n"
    + "WHERE {\n"
    + " ?X rdf:type ub:GraduateStudent .\n"
    + " ?X ub:takesCourse <http://www.Department0.University0.edu/GraduateCourse0>\n"
    + "}\n";
String[] queryTexts = { query };
  1. Now this compiles with
mvn compile
mvn package
  1. I execute the program with
java -cp lib/pagoda-2.1.2-jar-with-dependencies.jar:target/PagodawithDependencies-0.0.1-SNAPSHOT.jar App

passing both PAGOdA's JAR and the generated one in the classpath (-cp). Note that under Windows the separator might not be :.

Can you reproduce these steps? If you can try under Linux, that would be great. I don't have a Windows machine available.

@hmqq
Copy link
Author

hmqq commented Jun 20, 2022

Sorry I couldn't get back to you. As I am occupied with some deadlines. Thank you for your response. I will try and get back to you as soon as possible.

@hmqq
Copy link
Author

hmqq commented Aug 4, 2022

Sorry for the delay. I had two paper deadlines to meet. Anyway, I have tried to follow your suggestion but on windows, because this is what is available to me. I could not make it run and get this error now
Exception in thread "main" java.lang.ExceptionInInitializerError at uk.ac.ox.cs.pagoda.reasoner.light.RDFoxQueryEngine.createDataStore(RDFoxQueryEngine.java:35) at uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine.<init>(BasicQueryEngine.java:30) at uk.ac.ox.cs.pagoda.reasoner.MyQueryReasoner.setup(MyQueryReasoner.java:262) at uk.ac.ox.cs.pagoda.reasoner.MyQueryReasoner.<init>(MyQueryReasoner.java:61) at uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.getInstance(QueryReasoner.java:76) at uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.getInstance(QueryReasoner.java:53) at com.hmq.aau.PagodawithDependencies.App.test(App.java:31) at com.hmq.aau.PagodawithDependencies.App.main(App.java:56) Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: loadedLibraryNames at uk.ac.ox.cs.JRDFox.store.DataStore.<clinit>(Unknown Source) ... 8 more Caused by: java.lang.NoSuchFieldException: loadedLibraryNames at java.base/java.lang.Class.getDeclaredField(Class.java:2416) ... 9 more
Can you share your project with me with a copy of pagoda-2.1.2-jar-with-dependencies.jar?

@dyamon
Copy link
Member

dyamon commented Aug 26, 2022

Here is the project I'm using: https://mega.nz/file/HwMQUaaA#1O-vQQrq3MbsYJnGxUW1zTsQw9tWg-kYvxMe4YAY738

java -cp lib/pagoda-2.1.2-jar-with-dependencies.jar:target/PagodawithDependencies-0.0.1-SNAPSHOT.jar com.hmq.aau.PagodawithDependencies.App

Compiled and packaged with

mvn compile
mvn package

For reference

> java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants