Skip to content

Instantly share code, notes, and snippets.

@arademaker
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arademaker/fb5e151591046af7ba86 to your computer and use it in GitHub Desktop.
Save arademaker/fb5e151591046af7ba86 to your computer and use it in GitHub Desktop.
$ java -jar /usr/local/HermiT/HermiT.jar --classify test-complet.ttl
Exception in thread "main" org.semanticweb.owlapi.reasoner.InconsistentOntologyException: Inconsistent ontology
at org.semanticweb.HermiT.Reasoner.throwInconsistentOntologyExceptionIfNecessary(Unknown Source)
at org.semanticweb.HermiT.Reasoner.checkPreConditions(Unknown Source)
at org.semanticweb.HermiT.Reasoner.precomputeInferences(Unknown Source)
at org.semanticweb.HermiT.cli.CommandLine$ClassifyAction.run(Unknown Source)
at org.semanticweb.HermiT.cli.CommandLine.main(Unknown Source)
$ java -jar /usr/local/HermiT/HermiT.jar --classify test-complet.rdf
SubClassOf( <https://w3id.org/own-pt/wn30/schema/AdjectiveSynset> <https://w3id.org/own-pt/wn30/schema/Synset> )
SubClassOf( <https://w3id.org/own-pt/wn30/schema/NounSynset> <https://w3id.org/own-pt/wn30/schema/Synset> )
SubClassOf( <https://w3id.org/own-pt/wn30/schema/AdverbSynset> <https://w3id.org/own-pt/wn30/schema/Synset> )
SubClassOf( <https://w3id.org/own-pt/wn30/schema/VerbSynset> <https://w3id.org/own-pt/wn30/schema/Synset> )
SubClassOf( <https://w3id.org/own-pt/wn30/schema/AdjectiveSatelliteSynset> <https://w3id.org/own-pt/wn30/schema/AdjectiveSynset> )
SubClassOf( <https://w3id.org/own-pt/wn30/schema/AdverbWordSense> <https://w3id.org/own-pt/wn30/schema/WordSense> )
SubClassOf( <https://w3id.org/own-pt/wn30/schema/NounWordSense> <https://w3id.org/own-pt/wn30/schema/WordSense> )
SubClassOf( <https://w3id.org/own-pt/wn30/schema/AdjectiveWordSense> <https://w3id.org/own-pt/wn30/schema/WordSense> )
SubClassOf( <https://w3id.org/own-pt/wn30/schema/VerbWordSense> <https://w3id.org/own-pt/wn30/schema/WordSense> )
SubClassOf( <https://w3id.org/own-pt/wn30/schema/AdjectiveSatelliteWordSense> <https://w3id.org/own-pt/wn30/schema/AdjectiveWordSense> )
;; rdfpro does not parse/write ttl files right
$ rapper -i turtle -o rdfxml wn30.ttl > wn30.rdf ; rapper -i turtle -o rdfxml test.ttl > test.rdf; rdfpro @r wn30.rdf test.rdf @w test-complet.rdf
rapper: Parsing URI file:///Users/arademaker/work/openWordnet-PT/wn30.ttl with parser turtle
rapper: Serializing with serializer rdfxml
rapper: Parsing returned 570 triples
rapper: Parsing URI file:///Users/arademaker/work/openWordnet-PT/test.ttl with parser turtle
rapper: Serializing with serializer rdfxml
rapper: Parsing returned 6 triples
01:03:26(I) 576 triples read (48000 tr/s avg)
01:03:26(I) 576 triples written (48000 tr/s avg)
01:03:26(I) Done in 0 s
$ java -jar /usr/local/HermiT/HermiT.jar -k test-complet.ttl
$ java -jar /usr/local/HermiT/HermiT.jar -c test-complet.ttl
$ java -jar /usr/local/HermiT/HermiT.jar --consistency=wn30:Word test-complet.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix wn30: <https://w3id.org/own-pt/wn30/schema/> .
@prefix nomlex: <https://w3id.org/own-pt/nomlex/schema/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix : <http://w3id.org/own-pt/example/> .
:ws a wn30:WordSense ;
wn30:word :w1 ;
wn30:word :w2 .
:w1 a wn30:Word .
:w2 a wn30:Word .
:w1 wn30:lexicalForm "w1 form" ;
wn30:lexicalForm "w2 form" .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix wn30: <https://w3id.org/own-pt/wn30/schema/> .
@prefix nomlex: <https://w3id.org/own-pt/nomlex/schema/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix : <http://w3id.org/own-pt/example/> .
:ws a wn30:WordSense ;
wn30:word :w1 ;
wn30:word :w2 .
:w1 a wn30:Word .
:w2 a wn30:Word .
:w1 owl:differentFrom :w2 .
:w1 wn30:lexicalForm "w1 form" ;
wn30:lexicalForm "w2 form" .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix wn30: <https://w3id.org/own-pt/wn30/schema/> .
@prefix nomlex: <https://w3id.org/own-pt/nomlex/schema/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix : <http://w3id.org/own-pt/example/> .
:ws a wn30:WordSense ;
wn30:word :w1 ;
wn30:word :w2 .
:w1 a wn30:Word .
:w2 a wn30:Word .
:w1 wn30:lexicalForm "w1 form"^^xsd:string .
@arademaker
Copy link
Author

Hermit was accepting test1.ttl with no complains because of the default semantics of DL/OWL. A model that satisfy this ontology is one with w1 and w2 being different names of the same entity. In test2.ttl we explicit say that the names refer to different entities and the ontology now is inconsistent.

Nevertheless, the paragraph above doesn't explain why the test1.ttl was accepted even if it fails to guarantee the constraint on the Literal:

wn30:Word
    a rdfs:Class, owl:Class ;
    rdfs:subClassOf [
        a owl:Restriction ;
        owl:onProperty wn30:sense ;
        owl:someValuesFrom wn30:WordSense
    ], [
        a owl:Restriction ;
    owl:onProperty wn30:lexicalForm ;
        owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
        owl:onDataRange rdfs:Literal 
    ] ;
    owl:disjointWith wn30:WordSense .

More:

@arademaker
Copy link
Author

I didn't find explanation for the fail of Hermit in any documentation, but I finnaly managed to make Hermit reject the test1.ttl by simply removing the axiom below from the ontology.

wn30:lexicalForm rdfs:subPropertyOf rdfs:label .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment