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

Run HermiT on the command line #8

Closed
mikael1234 opened this issue Apr 2, 2020 · 15 comments
Closed

Run HermiT on the command line #8

mikael1234 opened this issue Apr 2, 2020 · 15 comments

Comments

@mikael1234
Copy link

When reading OWL document and server returns HTTP 301 gives now an error

    at uk.ac.manchester.cs.owl.owlapi.ParsableOWLOntologyFactory.loadOWLOntology(ParsableOWLOntologyFactory.java:236)
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:880)
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:800)
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadImports(OWLOntologyManagerImpl.java:1278)
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.makeLoadImportRequest(OWLOntologyManagerImpl.java:1309)

Would be an easy fix to follow the location in this case?

@ignazio1977
Copy link
Collaborator

Sounds to me like this is HermiT 1.3.8, am I right? If so, it's a fairly old build of the library and uses an even older OWLAPI version. It's possible that the best fix is to use a recent HermiT build (e.g., https://search.maven.org/artifact/net.sourceforge.owlapi/org.semanticweb.hermit/1.4.5.456)

The most recent builds include the same command line interface as the old HermiT but I haven't tried it with the -jar option; it might need more classpath setup.

@mikael1234
Copy link
Author

mikael1234 commented Apr 3, 2020 via email

@ignazio1977
Copy link
Collaborator

It's a matter of command line arguments, nothing should be broken. I'll experiment and let you know.

@ignazio1977
Copy link
Collaborator

ignazio1977 commented Apr 3, 2020

I can get HermiT to run on the command line but it requires manually downloading some libraries and adding them to the classpath.

So, to explain what's going on: HermiT 1.3.8 was packaged as an uber jar, meaning all the dependencies were included - making it impossible to update a dependency without rebuilding the jar, and making conflicts with other libraries common. However, that was convenient for command line use. Stuck with OWLAPI 3, though, which is where a lot of the issues you've found are rooted.

The builds on this fork only include in HermiT a subset of dependencies - the ones not available as Maven dependencies. This simplifies replacing the OWLAPI version but requires more work to run it from the command line.

Specifically, you need to download:

Also the following libraries (for convenience I've put them in the same lib folder as the OWLAPI files; also moved the HermiT jar in there)

The folder looks like this:

  • org.semanticweb.hermit-1.4.5.519.jar
  • lib folder, contains all OWLAPI jars and dependencies, trove, slf4j, getopt

In this folder, this command line will run HermiT:

java -cp org.semanticweb.hermit-1.4.5.519.jar:lib/* org.semanticweb.HermiT.cli.CommandLine -V

(If you're on Windows, use ; to separate the entries in the classpath parameter instead of :)

@ignazio1977
Copy link
Collaborator

Actually, this process is needlessly complex. I'll write a pom file for creating HermiT builds that work with the same command line as the original.

@ignazio1977
Copy link
Collaborator

I've documented the solution here https://github.com/owlcs/hermit-reasoner/wiki/HermiT-FAQ

@ignazio1977 ignazio1977 changed the title Follow HTTP 301 Run HermiT on the command line Apr 4, 2020
@ignazio1977 ignazio1977 transferred this issue from owlcs/owlapi Apr 4, 2020
@mikael1234
Copy link
Author

-V works now, but when doing entailment check, there is this error

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.semanticweb.owlapi.utilities.Injector.(Injector.java:43)
at org.semanticweb.owlapi.apibinding.OWLManager.(OWLManager.java:101)
at org.semanticweb.HermiT.cli.CommandLine.main(CommandLine.java:360)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more

So maybe still need some LoggerFactory jar? Thanks for the help!

@ignazio1977
Copy link
Collaborator

Odd, the file is included in the jar.

@ignazio1977
Copy link
Collaborator

There were bugs on the command line tool - some options were badly set up. Not sure if that was the problem you've seen, I could not replicate the error. 'm updating the fine in the releases project.

@mikael1234
Copy link
Author

mikael1234 commented Apr 8, 2020 via email

@ignazio1977
Copy link
Collaborator

That's the old build. Use the file in the releases project (name contains -packaged and -SNAPSHOT). You should be able to use the original command line, same as the instructions on the hermit web site.

@mikael1234
Copy link
Author

mikael1234 commented Apr 8, 2020 via email

@ignazio1977
Copy link
Collaborator

It's explained in the link I posted above (last question on the list) https://github.com/owlcs/hermit-reasoner/wiki/HermiT-FAQ

@mikael1234
Copy link
Author

mikael1234 commented Apr 8, 2020 via email

@pbouda
Copy link

pbouda commented May 11, 2020

FYI, I was not aware of the FAQ (and not to familiar with Java ...) so I searched a lot until I could build a jar with all dependencies. I cloned this repo and added the following to pom.xml:

<plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
                <archive>
                <manifest>
                        <mainClass>org.semanticweb.HermiT.cli.CommandLine</mainClass>
                </manifest>
                </archive>
                <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
        </configuration>
        <executions>
                <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                        <goal>single</goal>
                </goals>
                </execution>
        </executions>
</plugin>

Then you can build the jar with everything:

mvn clean compile assembly:single

Run the command line:

 java -jar org.semanticweb.hermit-1.4.6.519-SNAPSHOT-jar-with-dependencies.jar YOUR.owl

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

3 participants