1

I intended to use the Openllet reasoner, as suppose to the other available reasoners. But this reasoner is compatible only with the OWL API 5.X.X distribution. I have a xxx.owl file which contains SWRL rules. Since the existing SWRL API is not compatible with OWL API 5, Ignazio Palmisano had kindly put up a forked repository with required changes, so that it is compatible with the OWL API 5.X.X distribution. Consequently, I removed the dependencies related to SWRL API and drools engine. Instead, I built them locally by downloading the 'zip' files.

Now, with ".jar" files of the SWRL API and Drools loaded into the project in intelliJ, I am presented with this following error:

Exception in thread "main" org.swrlapi.exceptions.SWRLRuleEngineException: Error creating rule engine Drools. Exception: java.lang.NoClassDefFoundError. Message: org/drools/runtime/rule/AgendaFilter
    at org.swrlapi.factory.DefaultSWRLRuleAndQueryEngineFactory.createSWRLRuleEngine(DefaultSWRLRuleAndQueryEngineFactory.java:71)
    at org.swrlapi.factory.DefaultSWRLRuleAndQueryEngineFactory.createSWRLRuleEngine(DefaultSWRLRuleAndQueryEngineFactory.java:41)
    at org.swrlapi.factory.SWRLAPIFactory.createSWRLRuleEngine(SWRLAPIFactory.java:38)
    at SWRLrules.main(SWRLrules.java:61)

Caused by: java.lang.NoClassDefFoundError: org/drools/runtime/rule/AgendaFilter
    at org.swrlapi.drools.core.DroolsSWRLRuleEngineCreator.create(DroolsSWRLRuleEngineCreator.java:27)
    at org.swrlapi.factory.DefaultSWRLRuleAndQueryEngineFactory.createSWRLRuleEngine(DefaultSWRLRuleAndQueryEngineFactory.java:59)
    ... 3 more

Caused by: java.lang.ClassNotFoundException: org.drools.runtime.rule.AgendaFilter
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 5 more code here

Here I am also attaching the dependencies in pom.xml file:

<dependencies>

    <dependency>
        <groupId>net.sourceforge.owlapi</groupId>
        <artifactId>owlapi-osgidistribution</artifactId>
        <version>5.1.4</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
    </dependency>
    <dependency>
        <groupId>com.github.galigator.openllet</groupId>
        <artifactId>openllet-owlapi</artifactId>
        <version>2.6.3</version>
    </dependency>

</dependencies>

<build>

    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>org.swrlapi.example.SWRLAPIExample</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>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>java</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <mainClass>org.swrlapi.example.SWRLAPIExample</mainClass>
            </configuration>
        </plugin>

    </plugins>

</build>

P.S: I built the swrl api and drools engine locally and imported the jar file into the project.

Sreekar
  • 43
  • 6
  • NB, swrlapi allow SQWRL rules that aren't standard SWRL rules. This kind of rules isn't supported by Openllet. So make sure to not have SQWRL rules before solving an complexe dependency problem. – Galigator Feb 27 '18 at 21:16
  • @Galligator `SQWRL` is just a query language for SWRL as part of the SWRL API, this, aren't even rules at all. Besides this, clearly, not all of the extensions of SWRL API are supported, but this should be clear. Pellet doesn'T even support full SWRL, as mentioned in the FAQ – UninformedUser Feb 28 '18 at 08:09
  • @AKSW limits are mainly on some date/list builtins that aren't implemented. – Galigator Feb 28 '18 at 08:29

1 Answers1

2

You do not need to remove the dependencies from the pom file (the error you're seeing is caused by some jar having been missed in the manual process).

If you use my swrlapi fork and change the version to, say, 2.0.6-SNAPSHOT, then running locally

mvn clean install

will put a 2.0.6-SNAPSHOT jar in your local maven repository. At that point, change your pom to require swrlapi 2.0.6-SNAPSHOT and you'll get the updated version in your application.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • I did do all the things suggested by you and it resolved the above-mentioned error, but it resulted in a new error: **Exception in thread "main" org.swrlapi.exceptions.SWRLRuleEngineException: Error creating rule engine Drools. Exception: java.lang.NoSuchMethodError. Message: org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom.getProperty()Lorg/semanticweb/owlapi/model/OWLPropertyExpression;** – Sreekar Mar 01 '18 at 07:21
  • 1
    I have the same problem, it seems that SWRL-API 2.0.5 is not compatible with OWL-API 5.1.0 – user3781976 Jul 05 '18 at 14:43