-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow arbitrary annotation properties as qualifier tags in OBO #1099
Allowing arbitrary defined annotation properties as qualifier tags. Use oboInOWL as the default namespace when looking up tag IRIs. This helps with backwards compatibility for undeclared annotation properties. Enforce oio namespace for created_by and creation_date.
- Loading branch information
Showing
10 changed files
with
203 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
contract/src/test/java/org/obolibrary/oboformat/TagIRIsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.obolibrary.oboformat; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.semanticweb.owlapi.api.test.baseclasses.TestBase; | ||
import org.semanticweb.owlapi.model.IRI; | ||
import org.semanticweb.owlapi.model.OWLAnnotation; | ||
import org.semanticweb.owlapi.model.OWLAnnotationProperty; | ||
import org.semanticweb.owlapi.model.OWLAxiom; | ||
import org.semanticweb.owlapi.model.OWLClass; | ||
import org.semanticweb.owlapi.model.OWLLiteral; | ||
import org.semanticweb.owlapi.model.OWLOntology; | ||
import org.semanticweb.owlapi.vocab.OWL2Datatype; | ||
|
||
class TagIRIsTest extends TestBase { | ||
|
||
@Test | ||
void testTagIRIMapping() { | ||
OWLAnnotationProperty definition = | ||
df.getOWLAnnotationProperty(IRI.create("http://purl.obolibrary.org/obo/IAO_0000115")); | ||
OWLAnnotationProperty oioCreatedBy = df.getOWLAnnotationProperty( | ||
IRI.create("http://www.geneontology.org/formats/oboInOwl#created_by")); | ||
OWLAnnotationProperty oioInventedBy = df.getOWLAnnotationProperty( | ||
IRI.create("http://www.geneontology.org/formats/oboInOwl#invented_by")); | ||
OWLAnnotationProperty source = | ||
df.getOWLAnnotationProperty(IRI.create("http://purl.obolibrary.org/obo/MYONT_20")); | ||
OWLOntology ont = load("obo/tag_iris.obo", m); | ||
Set<OWLAxiom> axioms = ont.getAxioms(); | ||
OWLClass term1 = df.getOWLClass(IRI.create("http://purl.obolibrary.org/obo/MYONT_1")); | ||
OWLClass term2 = df.getOWLClass(IRI.create("http://purl.obolibrary.org/obo/MYONT_2")); | ||
OWLClass term3 = df.getOWLClass(IRI.create("http://purl.obolibrary.org/obo/MYONT_3")); | ||
OWLClass term4 = df.getOWLClass(IRI.create("http://purl.obolibrary.org/obo/MYONT_4")); | ||
Set<OWLAnnotation> annotations = Stream | ||
.of(df.getOWLAnnotation(df.getRDFSComment(), string("Here is a sub-annotation.")), | ||
df.getOWLAnnotation(df.getRDFSSeeAlso(), string("A nested see also value."))) | ||
.collect(Collectors.toSet()); | ||
assertTrue(axioms.contains(df.getOWLAnnotationAssertionAxiom(definition, term1.getIRI(), | ||
string("Definition of term one."), annotations))); | ||
assertTrue(axioms.contains(df.getOWLAnnotationAssertionAxiom(df.getRDFSSeeAlso(), | ||
term1.getIRI(), string("See also value.")))); | ||
assertTrue(axioms.contains(df.getOWLAnnotationAssertionAxiom(definition, term2.getIRI(), | ||
string("Definition of term two."), Collections | ||
.singleton(df.getOWLAnnotation(source, string("A nested annotation value.")))))); | ||
assertTrue(axioms.contains(df.getOWLAnnotationAssertionAxiom(definition, term3.getIRI(), | ||
string("Definition of term three."), Collections | ||
.singleton(df.getOWLAnnotation(source, string("A definition source value.")))))); | ||
assertTrue( | ||
axioms.contains( | ||
df.getOWLAnnotationAssertionAxiom(oioCreatedBy, term3.getIRI(), string("goc:bro"))), | ||
"created_by is built in and should not be overridden by a typedef"); | ||
assertTrue( | ||
axioms.contains(df.getOWLAnnotationAssertionAxiom(definition, term4.getIRI(), | ||
string("Definition of term four."), | ||
Collections | ||
.singleton(df.getOWLAnnotation(oioInventedBy, string("An inventor value."))))), | ||
"An undeclared tag should have oio namespace"); | ||
|
||
} | ||
|
||
protected OWLLiteral string(String l) { | ||
return df.getOWLLiteral(l, OWL2Datatype.XSD_STRING); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
format-version: 1.2 | ||
ontology: myont | ||
|
||
[Term] | ||
id: MYONT:1 | ||
name: term one | ||
def: "Definition of term one." [] {comment="Here is a sub-annotation.", seeAlso="A nested see also value."} | ||
property_value: seeAlso "See also value." xsd:string | ||
|
||
[Term] | ||
id: MYONT:2 | ||
name: term two | ||
def: "Definition of term two." [] {MYONT:20="A nested annotation value."} | ||
property_value: MYONT:21 "A top level annotation value." xsd:string | ||
|
||
[Term] | ||
id: MYONT:3 | ||
name: term three | ||
def: "Definition of term three." [] {source="A definition source value."} | ||
intersection_of: MYONT:2 ! term two | ||
intersection_of: results_in_transport_across GO:0005739 ! mitochondrion | ||
created_by: goc:bro | ||
|
||
[Term] | ||
id: MYONT:4 | ||
name: term four | ||
def: "Definition of term four." [] {invented_by="An inventor value."} | ||
|
||
[Typedef] | ||
id: source | ||
name: source | ||
xref: MYONT:20 | ||
is_metadata_tag: true | ||
|
||
[Typedef] | ||
id: MYONT:21 | ||
name: source2 | ||
is_metadata_tag: true | ||
|
||
[Typedef] | ||
id: seeAlso | ||
name: see also | ||
xref: http://www.w3.org/2000/01/rdf-schema#seeAlso | ||
is_metadata_tag: true | ||
|
||
[Typedef] | ||
id: results_in_transport_across | ||
name: results in transport across | ||
namespace: external | ||
xref: RO:0002342 | ||
|
||
[Typedef] | ||
id: created_by | ||
name: created by | ||
namespace: external | ||
xref: http://purl.org/dc/terms/creator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters