0

I am using SWLR API in Eclipse so as to be able to execute sqwrl queries about a data base ontology I created. When trying to run commands of the type 'abox', specifically I have tried with 'abox:hasClass(IndividualName, ?c) -> sqwrl:select(?x)', I obtain the following error:

org.swrlapi.parser.SWRLParseException: Invalid SWRL atom predicate 'abox:hasClass' at org.swrlapi.parser.SWRLParser.generateEndOfRuleException(SWRLParser.java:488) at org.swrlapi.parser.SWRLParser.parseSWRLAtom(SWRLParser.java:219) at org.swrlapi.parser.SWRLParser.parseSWRLRule(SWRLParser.java:115) at org.swrlapi.factory.DefaultSWRLAPIOWLOntology.createSQWRLQuery(DefaultSWRLAPIOWLOntology.java:265) at org.swrlapi.factory.DefaultSWRLAPIOWLOntology.createSQWRLQuery(DefaultSWRLAPIOWLOntology.java:259) at org.swrlapi.factory.DefaultSWRLRuleAndQueryEngine.createSQWRLQuery(DefaultSWRLRuleAndQueryEngine.java:145) at org.swrlapi.factory.DefaultSWRLRuleAndQueryEngine.runSQWRLQuery(DefaultSWRLRuleAndQueryEngine.java:154) at predict_maint.OntologyDataBase.main(OntologyDataBase.java:358)

The commands of 'tbox', on the contrary, work perfectly, and both corresponding packages are included in the libraries of the project (org.swrlapi.builtins.abox and org.swrlapi.builtins.abox respectively).

Thank you for your help.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
HugoMH
  • 51
  • 1
  • To execute the query I am simply using SQWRLQueryEngine queryEngine = SWRLAPIFactory.createSQWRLQueryEngine(o); result=queryEngine.runSQWRLQuery("q1", "abox:hasClass(IndividualName, ?c) -> sqwrl:select(?x)"); – HugoMH Apr 06 '21 at 10:29
  • not sure what exactly you're doing, but from where do you have `abox:hasClass` ? I mean, you cannot simply invent some predicates ... did you read about the built-ins of the ABox lib? https://github.com/protegeproject/swrlapi/wiki/SWRLABoxBuiltInLibrary - so, your using a non existing predicate, and moreover, `?x` is also not bound in your rule - what would you expect as result for `?x`? – UninformedUser Apr 06 '21 at 11:56
  • after reading the docs more carefully next time, you should be able to understand that the query `abox:caa(?cls, ?i) -> sqwrl:select(?cls)` is supposed to return the classes – UninformedUser Apr 06 '21 at 11:59
  • Hello. Actually I have never used this language before and I was just trying to find how other people had managed to do it and I copied that command from someone in the internet. I just want to make some simple queries but it seems that this is more complicated that I expected, thank you for the documentation you sent, I am a bit lost about the reference to follow. – HugoMH Apr 06 '21 at 12:02
  • that must be an outdated then, at least I cannot find it in the official SWRLAPI documentation. I showed you the query, so what else doesn't work? – UninformedUser Apr 06 '21 at 12:05
  • Your command actually works, thank you. The only problem now is that apparently it requires a lot of memory to run the query and I get the OutOfMemoryError constantly. I tried increasing the size of the java heap but it does not work either. I think is the size of the data base, as it is working with a smaller test ontology. But I did not expect that it was so easy to find memory problems like this.... – HugoMH Apr 06 '21 at 14:18

0 Answers0