@@ -449,3 +449,58 @@ def test_relationship_symmetric(self):
449
449
)
450
450
self .assertIn ("TST:001" , ont .relationships ())
451
451
self .assertTrue (ont .get_relationship ("TST:001" ).symmetric )
452
+
453
+ def test_existing_synonym_type_extraction (self ):
454
+ ont = self .get_ontology (
455
+ """
456
+ <owl:Ontology rdf:about="http://purl.obolibrary.org/obo/chebi.owl"/>
457
+
458
+ <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/chebi#BRAND_NAME">
459
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">BRAND NAME</rdfs:label>
460
+ <rdfs:subPropertyOf rdf:resource="http://www.geneontology.org/formats/oboInOwl#SynonymTypeProperty"/>
461
+ </owl:AnnotationProperty>
462
+
463
+ <owl:Class rdf:about="http://purl.obolibrary.org/obo/CHEBI_4508">
464
+ <oboInOwl:hasRelatedSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Cataflam</oboInOwl:hasRelatedSynonym>
465
+ <oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">CHEBI:4508</oboInOwl:id>
466
+ </owl:Class>
467
+ <owl:Axiom>
468
+ <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/CHEBI_4508"/>
469
+ <owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
470
+ <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Cataflam</owl:annotatedTarget>
471
+ <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">DrugBank</oboInOwl:hasDbXref>
472
+ <oboInOwl:hasSynonymType rdf:resource="http://purl.obolibrary.org/obo/chebi#BRAND_NAME"/>
473
+ </owl:Axiom>
474
+ """
475
+ )
476
+ syntype , = ont .metadata .synonymtypedefs
477
+ synonym , = ont ["CHEBI:4508" ].synonyms
478
+ self .assertEqual (synonym .scope , "RELATED" )
479
+ self .assertEqual (synonym .type , syntype )
480
+
481
+ def test_missing_synonym_type_extraction (self ):
482
+ ont = self .get_ontology (
483
+ """
484
+ <owl:Ontology rdf:about="http://purl.obolibrary.org/obo/chebi.owl"/>
485
+
486
+ <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/chebi#BRAND_NAME">
487
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">BRAND NAME</rdfs:label>
488
+ <rdfs:subPropertyOf rdf:resource="http://www.geneontology.org/formats/oboInOwl#SynonymTypeProperty"/>
489
+ </owl:AnnotationProperty>
490
+
491
+ <owl:Class rdf:about="http://purl.obolibrary.org/obo/CHEBI_4508">
492
+ <oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">CHEBI:4508</oboInOwl:id>
493
+ </owl:Class>
494
+ <owl:Axiom>
495
+ <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/CHEBI_4508"/>
496
+ <owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
497
+ <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Cataflam</owl:annotatedTarget>
498
+ <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">DrugBank</oboInOwl:hasDbXref>
499
+ <oboInOwl:hasSynonymType rdf:resource="http://purl.obolibrary.org/obo/chebi#BRAND_NAME"/>
500
+ </owl:Axiom>
501
+ """
502
+ )
503
+ syntype , = ont .metadata .synonymtypedefs
504
+ synonym , = ont ["CHEBI:4508" ].synonyms
505
+ self .assertEqual (synonym .scope , "RELATED" )
506
+ self .assertEqual (synonym .type , syntype )
0 commit comments