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

Does Owlery support datatype constraints in its queries? #167

Closed
rpgoldman opened this issue Oct 5, 2021 · 5 comments
Closed

Does Owlery support datatype constraints in its queries? #167

rpgoldman opened this issue Oct 5, 2021 · 5 comments

Comments

@rpgoldman
Copy link
Contributor

rpgoldman commented Oct 5, 2021

I have tried to query with this (somewhat cumbersome) formula:

(<https://sift.net/container-ontology/container-ontology#wellVolume> some (<http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue> only owl:real[>= "200"^^owl:real]))

and Owlery is giving me a 500 error. When I look at the logs, I see this:

[ERROR] [10/05/2021 21:58:17.865] [Main-akka.actor.default-dispatcher-34] [akka.actor.ActorSystemImpl(Main)] Error during processing of request: 'Literal "200"^^<http://www.w3.org/2002/07/owl#real> is malformed'. Completing with 500 Internal Server Error response. To change default exception handling behavior, provide a custom ExceptionHandler.
org.semanticweb.HermiT.datatypes.MalformedLiteralException: Literal "200"^^<http://www.w3.org/2002/07/owl#real> is malformed
	at org.semanticweb.HermiT.datatypes.owlreal.OWLRealDatatypeHandler.parseLiteral(OWLRealDatatypeHandler.java:118)
	at org.semanticweb.HermiT.datatypes.DatatypeRegistry.parseLiteral(DatatypeRegistry.java:105)
	at org.semanticweb.HermiT.model.Constant.create(Constant.java:111)
	at org.semanticweb.HermiT.structural.OWLClausification$DataRangeConverter.visit(OWLClausification.java:898)
	at uk.ac.manchester.cs.owl.owlapi.OWLLiteralImplNoCompression.accept(OWLLiteralImplNoCompression.java:270)
	at org.semanticweb.HermiT.structural.OWLClausification$DataRangeConverter.visit(OWLClausification.java:876)
	at uk.ac.manchester.cs.owl.owlapi.OWLDatatypeRestrictionImpl.accept(OWLDatatypeRestrictionImpl.java:136)
	at org.semanticweb.HermiT.structural.OWLClausification$DataRangeConverter.convertDataRange(OWLClausification.java:820)
	at org.semanticweb.HermiT.structural.OWLClausification$DataRangeConverter.visit(OWLClausification.java:850)
	at uk.ac.manchester.cs.owl.owlapi.OWLDataComplementOfImpl.accept(OWLDataComplementOfImpl.java:121)
	at org.semanticweb.HermiT.structural.OWLClausification$DataRangeConverter.convertDataRange(OWLClausification.java:820)
	at org.semanticweb.HermiT.structural.OWLClausification$NormalizedAxiomClausifier.visit(OWLClausification.java:639)
	at uk.ac.manchester.cs.owl.owlapi.OWLDataSomeValuesFromImpl.accept(OWLDataSomeValuesFromImpl.java:82)
	at org.semanticweb.HermiT.structural.OWLClausification.clausify(OWLClausification.java:235)
	at org.semanticweb.HermiT.Reasoner.createDeltaDLOntology(Reasoner.java:2194)
	at org.semanticweb.HermiT.Reasoner.getTableau(Reasoner.java:2039)
	at org.semanticweb.HermiT.Reasoner.getHierarchyNode(Reasoner.java:964)
	at org.semanticweb.HermiT.Reasoner.getInstances(Reasoner.java:1765)
	at org.phenoscape.owlery.Knowledgebase.$anonfun$queryInstances$1(Knowledgebase.scala:72)
	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:672)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:431)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

This is a HermiT problem: when I test this using Protege, I get an error with HermiT as reasoner, but everything is fine with Fact++. Any idea what is going wrong here?

And... am I right in thinking that the HermiT reasoner is moribund? The "nightly builds" page linked from hermit-reasoner.org has a set of releases that stops in 2015. Or has its version control system just moved somewhere else?

@rpgoldman
Copy link
Contributor Author

Oh, yes, it's coming back to me now. I tried resetting the reasoner to jfact and jfact thinks my ontology is inconsistent. Neither Hermit nor Fact++ (which I assume is the C++ version of Fact) agree with this.

Unfortunately, my ontology will provide no useful inferences if I am limited to EL. Any suggestions for what I might do?

Any chance there are more up-to-date versions of either Hermit or JFact that could be incorporated?

@balhoff
Copy link
Member

balhoff commented Oct 5, 2021

I haven't done much with literals in OWL, but could it be something to do with what it says here? https://www.w3.org/TR/2012/REC-owl2-syntax-20121211/#Real_Numbers.2C_Decimal_Numbers.2C_and_Integers

"The owl:real datatype does not directly provide any lexical forms."

Could you leave off the datatype? e.g. 200 instead of "200"^^owl:real? Or use xsd:decimal instead?

@balhoff
Copy link
Member

balhoff commented Oct 5, 2021

Another clue: protegeproject/protege#37

@rpgoldman
Copy link
Contributor Author

Another clue: protegeproject/protege#37

Thanks, that was it. Changing to

(<https://sift.net/container-ontology/container-ontology#wellVolume> some (<http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue> only xsd:float[>= "200"^^xsd:float]))

...makes it work. Note that both owl:real's have to be changed to a "real" primitive type.

What bothers me is what if I have an entry where the numerical value is specified as an integer? I don't believe that xsd:integer is a subtype of xsd:float. (see http://books.xmlschemata.org/relaxng/ch19-77095.html)

Wow. The numeric datatypes in OWL are bonkers. owl:real does not contain the floats, only the rationals. But I am going off-topic. Thanks for your help, @balhoff !!! I'll close this ticket now.

@balhoff
Copy link
Member

balhoff commented Oct 6, 2021

@rpgoldman HermiT is not very actively developed, but some maintenance happens here: https://github.com/owlcs/hermit-reasoner

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