Skip to content

test_text_fields validator ignores dataProperties and annotationProperties #89

@matentzn

Description

@matentzn

dosdp.validator.test_text_fields builds the owl_entities set from only classes: and relations:. Any quoted reference to a data property (or annotation property) in a logical axiom is therefore reported as not found, even when the property is correctly declared under dataProperties:.

Context

In validator.py:

owl_entities = set()
if 'classes' in pattern.keys(): owl_entities.update(set(pattern['classes'].keys()))
if 'relations' in pattern.keys(): owl_entities.update(set(pattern['relations'].keys()))

dataProperties and annotationProperties are silently dropped. Hit while adding dpoIncreasedMortality.yaml to drosophila-phenotype-ontology — a pattern that needs a data-property range restriction on RO:0002029 (age-specific mortality rate).

Example

Pattern fragment:

dataProperties:
  age_specific_mortality_rate: RO:0002029

data_vars:
  rate_min: xsd:short

logical_axioms:
  - axiom_type: equivalentTo
    text: "'has_part' some (('characteristic_of' some 'population_of_drosophila') and ('age_specific_mortality_rate' some xsd:short[>= %s]))"
    vars:
      - rate_min

Output:

UserWarning: logical_axioms.[0].text has values ({'age_specific_mortality_rate'}) not found in owl entity dictionaries t ({'population_of_drosophila', 'has_part', 'characteristic_of'})
Validation completed with issues to be fixed.

dosdp-tools generates the expected DataSomeValuesFrom(RO:0002029 ...) axioms without complaint — only the Python validator is wrong.

Expected behaviour

Quoted data-property and annotation-property names declared under dataProperties: / annotationProperties: should be recognised as valid owl entities by test_text_fields.

Suggested approach

Extend the entity dict in test_text_fields:

for key in ('classes', 'relations', 'dataProperties', 'annotationProperties'):
    if key in pattern: owl_entities.update(pattern[key].keys())

Workaround

Drop the single quotes around the data-property name in the text expression. Manchester syntax accepts unquoted tokens without special characters, and dosdp-tools resolves them via the dataProperties dict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions