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

SWRL Rule using built-in atom not supported #856

Closed
thomakl opened this issue Jun 17, 2019 · 6 comments
Closed

SWRL Rule using built-in atom not supported #856

thomakl opened this issue Jun 17, 2019 · 6 comments
Labels

Comments

@thomakl
Copy link

thomakl commented Jun 17, 2019

Hi,

I'm using OWLAPI 5.1.0 and I'm trying to use the Hermit reasoner on my swrl rule (created with Protégé). Those rules are made with a built-in with SWRL. I need to create rules that can add, pow, sqrt or make comparison (greater than).
Here's an example of my rules:
swrlb:add(?x, 2, 2) -> sqwrl:select(?x)

I've got this issue :
Exception in thread "main" java.lang.IllegalArgumentException: A SWRL rule uses a built-in atom, but built-in atoms are not supported yet.

I found out that the SWRLAPI 2.0.6 (the most recent at this time), does not support the OWLAPI 5.1.0.

How do you bypass those constraints ?

Thank you for your time,

@ignazio1977
Copy link
Contributor

What's the rest of the stack trace? Which library is throwing this exception, HermiT or SWRL API?

@thomakl
Copy link
Author

thomakl commented Jun 18, 2019

Hi,

Sorry. It's Exception made by SWRL API.
Here's the full trace:

Exception in thread "main" org.swrlapi.exceptions.SWRLRuleEngineException: Error creating query engine Drools. Exception: java.lang.NoSuchMethodError. Message: org.semanticweb.owlapi.model.OWLDocumentFormat.isPrefixOWLOntologyFormat()Z at org.swrlapi.factory.DefaultSWRLRuleAndQueryEngineFactory.createSQWRLQueryEngine(DefaultSWRLRuleAndQueryEngineFactory.java:111) at org.swrlapi.factory.DefaultSWRLRuleAndQueryEngineFactory.createSQWRLQueryEngine(DefaultSWRLRuleAndQueryEngineFactory.java:82) at org.swrlapi.factory.SWRLAPIFactory.createSQWRLQueryEngine(SWRLAPIFactory.java:61) at msc.OntologyManager.SWRLRuleAPI(OntologyManager.java:373) at msc.DecisionSWRLRule.main(DecisionSWRLRule.java:24) Caused by: java.lang.NoSuchMethodError: org.semanticweb.owlapi.model.OWLDocumentFormat.isPrefixOWLOntologyFormat()Z at org.swrlapi.factory.DefaultIRIResolver.updatePrefixes(DefaultIRIResolver.java:165) at org.swrlapi.factory.DefaultSWRLAPIOWLOntology.<init>(DefaultSWRLAPIOWLOntology.java:163) at org.swrlapi.factory.SWRLAPIInternalFactory.createSWRLAPIOntology(SWRLAPIInternalFactory.java:266) at org.swrlapi.factory.DefaultSWRLRuleAndQueryEngineFactory.createSQWRLQueryEngine(DefaultSWRLRuleAndQueryEngineFactory.java:92) ... 4 more

I saw a fork of the SWRL API made by you @ignazio1977 . Is this fork running with OWL API 5.x and up to date ?

I tried to edit the PrefixOWLOntologyFormat by PrefixOWLDocumentFormat (as it's implemented in the OWL API 5.x) but the classes are read-only ?

@ignazio1977
Copy link
Contributor

My fork is an experiment and it has not been released, so it's not straightforward to use and needs updating.

I was referring to the exception saying built ins are not supported - which library is that?

Not sure what you mean by read only.

@thomakl
Copy link
Author

thomakl commented Jun 18, 2019

I understand.

My bad, the previous trace is for another issue I have.
Here's the rest of the trace for this actual built-in are not supported yet.
As I understand, it's an Hermit issue.

Exception in thread "main" java.lang.IllegalArgumentException: A SWRL rule uses a built-in atom, but built-in atoms are not supported yet. at org.semanticweb.HermiT.structural.OWLNormalization$RuleNormalizer.visit(OWLNormalization.java:1332) at org.semanticweb.owlapi.model.SWRLBuiltInAtom.accept(SWRLBuiltInAtom.java:82) at org.semanticweb.HermiT.structural.OWLNormalization$RuleNormalizer.visit(OWLNormalization.java:1221) at org.semanticweb.HermiT.structural.OWLNormalization.processAxioms(OWLNormalization.java:180) at org.semanticweb.HermiT.structural.OWLNormalization.processOntology(OWLNormalization.java:163) at org.semanticweb.HermiT.structural.OWLClausification.lambda$preprocessAndClausify$0(OWLClausification.java:80) at java.util.TreeMap$KeySpliterator.forEachRemaining(TreeMap.java:2746) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at org.semanticweb.HermiT.structural.OWLClausification.preprocessAndClausify(OWLClausification.java:80) at org.semanticweb.HermiT.Reasoner.loadOntology(Reasoner.java:210) at org.semanticweb.HermiT.Reasoner.<init>(Reasoner.java:201) at org.semanticweb.HermiT.Reasoner.<init>(Reasoner.java:175) at org.semanticweb.HermiT.ReasonerFactory.createHermiTOWLReasoner(ReasonerFactory.java:51) at org.semanticweb.HermiT.ReasonerFactory.createReasoner(ReasonerFactory.java:19) at msc.OntologyManager.InferReasonerHermit(OntologyManager.java:299) at msc.DecisionSWRLRule.main(DecisionSWRLRule.java:23)

How do you recommend creating and managing rules with the OWL API 5.x ?

@ignazio1977
Copy link
Contributor

I have updated my fork, you can check it out and build it locally. mvn clean install will put a copy in your local maven repository.
To use it, use version 2.0.6.5-1-11 (the group is net.sourceforge.owlapi, artifact name swrlapi).

SWRL creation has not changed between OWLAPI 4 and 5.

I can't add SWRL functionality to HermiT, unfortunately. I don't have the time and expertise to extend the reasoner that way.

@thomakl
Copy link
Author

thomakl commented Jun 26, 2019

I'm sorry for my late answer.
Thank you a lot @ignazio1977 for your time.

Have a nice day.

@thomakl thomakl closed this as completed Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants