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

Feature request: Add a parameter that enables merging multiple instances of the same axiom with different sets of axiom annotations #1099

Closed
1 task
areleu opened this issue Feb 24, 2023 · 6 comments · Fixed by #1194

Comments

@areleu
Copy link

areleu commented Feb 24, 2023

Derived from #1098

When terms are defined in two different inputs, the act of merging may lead to duplicate annotations. It would be nice to have a quick way of removing such duplicates when is clear that the annotation is indeed the same.

EDIT BY @matentzn

@jamesaoverton
Copy link
Member

Sorry, I don't understand. It would be good to have some concrete examples.

  1. An OWL annotation such as OBI:0000070 rdfs:label "assay". is an RDF triple where the predicate is an OWL Annotation Property. You should never see duplicates of these -- OWLAPI or any RDF library will merge them.
  2. An OWL axiom annotation using reification <OBI:0000070 rdfs:label "assay"> rdfs:comment "Comment". This is trickier, but I would not expect to see duplicates of these either.
  3. From the context of ROBOT annotate with provencance duplicates annotations. #1098, the problem seems to be "duplicates" from --annotate-derived-from or --annotate-defined-by, but are they really duplicates or just more information than you want?

@matentzn matentzn changed the title There is no way of removing duplicated annotations Feature request: Add a parameter that enables merging multiple instances of the same axiom with different sets of axiom annotations Feb 24, 2023
@matentzn
Copy link
Contributor

Test ontology:

Prefix(:=<http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12/>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)


Ontology(<http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>

Declaration(Class(<http://purl.obolibrary.org/obo/TMP_A>))
Declaration(Class(<http://purl.obolibrary.org/obo/TMP_B>))


############################
#   Classes
############################

# Class: <http://purl.obolibrary.org/obo/TMP_A> (B)

AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/TMP_A> "B"@en)
SubClassOf(Annotation(rdfs:comment "A") Annotation(owl:versionInfo "old") <http://purl.obolibrary.org/obo/TMP_A> <http://purl.obolibrary.org/obo/TMP_B>)
SubClassOf(Annotation(rdfs:comment "B") Annotation(owl:versionInfo "new") <http://purl.obolibrary.org/obo/TMP_A> <http://purl.obolibrary.org/obo/TMP_B>)


# Class: <http://purl.obolibrary.org/obo/TMP_B> (A)

AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/TMP_B> "A"@en)


)

Command:

robot merge -i axiom-annotations-merged.ofn --annotate-derived-from true -o test.ofn

Output:

codePrefix(:=<http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)


Ontology(<http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>

Declaration(Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) Class(<http://purl.obolibrary.org/obo/TMP_A>))
Declaration(Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) Class(<http://purl.obolibrary.org/obo/TMP_B>))
Declaration(AnnotationProperty(<http://www.w3.org/ns/prov#wasDerivedFrom>))


############################
#   Classes
############################

# Class: <http://purl.obolibrary.org/obo/TMP_A> (B)

AnnotationAssertion(Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) rdfs:label <http://purl.obolibrary.org/obo/TMP_A> "B"@en)
SubClassOf(Annotation(rdfs:comment "A") Annotation(owl:versionInfo "old") Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) <http://purl.obolibrary.org/obo/TMP_A> <http://purl.obolibrary.org/obo/TMP_B>)
SubClassOf(Annotation(rdfs:comment "B") Annotation(owl:versionInfo "new") Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) <http://purl.obolibrary.org/obo/TMP_A> <http://purl.obolibrary.org/obo/TMP_B>)

# Class: <http://purl.obolibrary.org/obo/TMP_B> (A)

AnnotationAssertion(Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) rdfs:label <http://purl.obolibrary.org/obo/TMP_B> "A"@en)


)

It would be somehow better if we could do instead with a nice parameter output:

codePrefix(:=<http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)


Ontology(<http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>

Declaration(Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) Class(<http://purl.obolibrary.org/obo/TMP_A>))
Declaration(Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) Class(<http://purl.obolibrary.org/obo/TMP_B>))
Declaration(AnnotationProperty(<http://www.w3.org/ns/prov#wasDerivedFrom>))


############################
#   Classes
############################

# Class: <http://purl.obolibrary.org/obo/TMP_A> (B)

AnnotationAssertion(Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) rdfs:label <http://purl.obolibrary.org/obo/TMP_A> "B"@en)
SubClassOf(Annotation(rdfs:comment "A") Annotation(owl:versionInfo "old") Annotation(rdfs:comment "B") Annotation(owl:versionInfo "new") Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) <http://purl.obolibrary.org/obo/TMP_A> <http://purl.obolibrary.org/obo/TMP_B>)

# Class: <http://purl.obolibrary.org/obo/TMP_B> (A)

AnnotationAssertion(Annotation(<http://www.w3.org/ns/prov#wasDerivedFrom> <http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12>) rdfs:label <http://purl.obolibrary.org/obo/TMP_B> "A"@en)


)

@jamesaoverton
Copy link
Member

Is this just an artifact of the Manchester syntax renderer? Does it also happen in RDF/XML format?

@matentzn
Copy link
Contributor

I think this is part of the owl api object model, I.E will be reflected by all renderes. I know it does for OBO, OFN and RDF XML.

@jamesaoverton
Copy link
Member

Does robot repair --merge-annotation-axioms true address this issue?

It's currently undocumented, so I didn't realize it was in the code already: https://github.com/ontodev/robot/blob/master/robot-core/src/main/java/org/obolibrary/robot/RepairOperation.java#L123

@matentzn
Copy link
Contributor

matentzn commented Mar 21, 2023

robot merge -i test.owl repair --merge-axiom-annotations true -o teste.owl

Unfortunately does not work, for two reasons:

  1. It is tied in with repair, which I may or may not want to run. I just want to merge axiom annotations
  2. In the test ontology provided in this issue here, it drops the axiom annotations for new reason I can understand
Resulting ontology of the above command, and the test in the third comment of this issue
<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12#"
     xml:base="http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
    <owl:Ontology rdf:about="http://www.semanticweb.org/matentzn/ontologies/2023/1/untitled-ontology-12"/>
    


    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Classes
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->

    


    <!-- http://purl.obolibrary.org/obo/TMP_A -->

    <owl:Class rdf:about="http://purl.obolibrary.org/obo/TMP_A">
        <rdfs:label xml:lang="en">B</rdfs:label>
    </owl:Class>
    


    <!-- http://purl.obolibrary.org/obo/TMP_B -->

    <owl:Class rdf:about="http://purl.obolibrary.org/obo/TMP_B">
        <rdfs:label xml:lang="en">A</rdfs:label>
    </owl:Class>
</rdf:RDF>

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

Successfully merging a pull request may close this issue.

3 participants