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

Adding annotations to synonym type declarations yields KeyError: '{http://www.w3.org/1999/02/22-rdf-syntax-ns#}resource #230

Open
cmungall opened this issue Aug 14, 2024 · 1 comment
Labels
bug Issues or pull requests that specify a bug.

Comments

@cmungall
Copy link

<?xml version="1.0"?>
<rdf:RDF xmlns="http://purl.obolibrary.org/obo/ncbitaxon.owl#"
     xml:base="http://purl.obolibrary.org/obo/ncbitaxon.owl"
     xmlns:OMO="http://purl.obolibrary.org/obo/OMO_"
     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#"
     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#"
     xmlns:terms="http://purl.org/dc/terms/"
     xmlns:oboInOwl="http://www.geneontology.org/formats/oboInOwl#"
     xmlns:NCBITaxon="http://purl.obolibrary.org/obo/NCBITaxon_"
     xmlns:ncbitaxon="http://purl.obolibrary.org/obo/ncbitaxon#">
    <owl:Ontology rdf:about="http://purl.obolibrary.org/obo/ncbitaxon.owl">
    </owl:Ontology>
    


    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Annotation properties
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->


    
    <!-- http://www.geneontology.org/formats/oboInOwl#SynonymTypeProperty -->
    <owl:AnnotationProperty rdf:about="http://www.geneontology.org/formats/oboInOwl#SynonymTypeProperty"/>

    <!-- http://www.geneontology.org/formats/oboInOwl#hasScope -->
    <owl:AnnotationProperty rdf:about="http://www.geneontology.org/formats/oboInOwl#hasScope">
        <rdfs:label>has scope</rdfs:label>    
    </owl:AnnotationProperty>

    <!-- http://purl.obolibrary.org/obo/ncbitaxon#genbank_synonym -->

    <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/ncbitaxon#genbank_synonym">
        <oboInOwl:hasScope>oio:hasRelatedSynonym</oboInOwl:hasScope>
        <rdfs:label>genbank synonym</rdfs:label>
        <rdfs:subPropertyOf rdf:resource="http://www.geneontology.org/formats/oboInOwl#SynonymTypeProperty"/>
    </owl:AnnotationProperty>
    

</rdf:RDF>

gives

  File "/Users/cjm/repos/ontology-access-kit/src/oaklib/implementations/pronto/pronto_implementation.py", line 177, in __post_init__
    ontology = Ontology(str(resource.local_path), **kwargs)
  File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/oaklib-OeQZizwE-py3.9/lib/python3.9/site-packages/pronto/ontology.py", line 283, in __init__
    cls(self).parse_from(_handle)  # type: ignore
  File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/oaklib-OeQZizwE-py3.9/lib/python3.9/site-packages/pronto/parsers/rdfxml.py", line 115, in parse_from
    self._extract_annotation_property(prop, curies)
  File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/oaklib-OeQZizwE-py3.9/lib/python3.9/site-packages/pronto/parsers/rdfxml.py", line 699, in _extract_annotation_property
    scope = _SYNONYMS.get(elem_scope.attrib[_NS["rdf"]["resource"]])
KeyError: '{http://www.w3.org/1999/02/22-rdf-syntax-ns#}resource'
@althonos
Copy link
Owner

althonos commented Sep 10, 2024

Okay that's because I was assuming the scope would be given as an IRI and a rdf:resource attribute:

<oboInOwl:hasScope rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>

I'll update the parser to fall back to a warning but I think that may also be a weird serialization from your end 👍

@althonos althonos added the bug Issues or pull requests that specify a bug. label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or pull requests that specify a bug.
Projects
None yet
Development

No branches or pull requests

2 participants