robot icon indicating copy to clipboard operation
robot copied to clipboard

Rename fails for properties going from anonymous individuals

Open psiotwo opened this issue 3 years ago • 6 comments

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.

psiotwo avatar Jun 21 '22 07:06 psiotwo

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

matentzn avatar Jun 21 '22 12:06 matentzn

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)

psiotwo avatar Jun 21 '22 13:06 psiotwo

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

matentzn avatar Jun 21 '22 14:06 matentzn

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 avatar Jun 21 '22 16:06 psiotwo

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.

psiotwo avatar Jul 06 '22 19:07 psiotwo

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.

ignazio1977 avatar Oct 02 '22 21:10 ignazio1977