Skip to content

generateSKOSInOwl skips prefixIRI for non-QName local parts #32

@jvendetti

Description

@jvendetti

Description

generateSKOSInOwl in OntologyParser.java (line 379) attempts to add identifier metadata for classes in prefix-aware OWL ontologies.

The method uses this fallback path:

  1. If the class already has skos:notation, do nothing
  2. Else if the class has oboInOwl:id, copy that value into skos:notation
  3. Else call prefixFormat.getPrefixIRI(cls.getIRI()) and store the result as BioPortal prefixIRI

This fails for some valid OWL class IRIs whose local part is not a valid XML QName local name.

Example from the Emotion Response Ontology (EMRO):

  • Class IRI: http://purl.bioontology.org/ontology/EMRO/0000000
  • Registered namespace prefix exists: EMRO -> http://purl.bioontology.org/ontology/EMRO/
  • skos:notation and oboInOwl:id are absent on that class
  • prefixFormat.getPrefixIRI(cls.getIRI()) returns null

As a result, the loop continues without adding either skos:notation or prefixIRI metadata for that class.

Why this happens

OWL API getPrefixIRI() is trying to generate a compact prefixed form such as EMRO:0000000.

That compacted value must be QName-safe. In this case the local part is 0000000, which starts with a digit, so it isn't a valid QName local name. OWLAPI therefore returns null.

Impact

Some classes in valid source ontologies do not receive BioPortal identifier metadata during parsing, even when their namespace prefix is known. This makes identifier normalization inconsistent across ontologies and across classes within the same ontology.

Expected behavior

If a class doesn't already have skos:notation and doesn't have oboInOwl:id, the parser should still derive a usable prefixIRI when the namespace prefix is known, even if the local part isn't QName-safe.

For the EMRO example, a reasonable derived value would be:

EMRO:0000000

... stored as BioPortal metadata prefixIRI.

Notes

The issue is specific to the prefixIRI fallback path in generateSKOSInOwl. It doesn't affect the OBO-specific path in generateSKOSInObo.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions