ontodev / robot

ROBOT is an OBO Tool
http://robot.obolibrary.org
BSD 3-Clause "New" or "Revised" License
259 stars 73 forks source link

Rename fails for properties going from anonymous individuals #1015

Open psiotwo opened 2 years ago

psiotwo commented 2 years ago

Having the input.owl:

<?xml version="1.0"?>
<rdf:RDF
     xmlns:obo="http://purl.obolibrary.org/obo/"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <owl:Ontology rdf:about="https://test.org/test.owl"/>
    <rdf:Description>
        <obo:IAO_0000412 rdf:resource="https://test.org/test2.owl"/>
    </rdf:Description>
</rdf:RDF>

a mapping file mappings.csv:

Old IRI,New IRI
http://purl.obolibrary.org/obo/IAO_0000412,http://www.geneontology.org/formats/oboInOwl#hasExactSynonym

and running

java -jar robot.jar rename --input input.owl --output output.owl --mappings mappings.csv

ends up with a failure:

Cannot invoke "org.semanticweb.owlapi.util.RemappingIndividualProvider.getOWLAnonymousIndividual(String)" because "this.anonProvider" is null.

The reason seems to be the anonymous subject of the triple.

matentzn commented 2 years ago

Are you sure you can rename entities that are not OWLEntties according to OWL API, i.e. OWLNamedIndividual, OWLClass, OWLObjectProperty, OWLDataProperty, OWLAnnotationProperty?

psiotwo commented 2 years ago

I would like to get renamed the property, not the anonymous individual.

But anyway, I am more concerned about the fact that the command simply crashes - even just logging a warning for such case (when rename operation failed) would be acceptable IMO (e.g. st. like the global --strict switch)

matentzn commented 2 years ago

Yes, but I think it should be declared in the RDFXML as an AnnotationProperty for this to work. I think.

psiotwo commented 2 years ago

Nope, for this input.owl it does not work either.

<rdf:RDF
     xmlns:obo="http://purl.obolibrary.org/obo/"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <owl:Ontology rdf:about="https://test.org/test.owl"/>
    <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000412"/>
    <rdf:Description>
        <obo:IAO_0000412 rdf:resource="https://test.org/test2.owl"/>
    </rdf:Description>
</rdf:RDF>
psiotwo commented 2 years ago

Looks like it is connected to https://github.com/owlcs/owlapi/issues/892, which has been resolved in OWLAPI 5 https://github.com/owlcs/owlapi/blob/36dd926be09f0e9212e50eadc07af2c94ae19e4a/README.md#5113-27-january-2020

Seems to me that OWLAPI 4.x should have this patch included, but I cannot find it there - so inquiring OWLAPI.

ignazio1977 commented 1 year ago

It's a bug in OWLAPI 4, one of the OWLObjectDuplicator constructs leaves the anon remapper null. It's triggered when IRI renames are used, not OWLEntity renames. Unrelated to whether the IRIs are of entities or not.