`test_text_fields` validator ignores `dataProperties` and `annotationProperties`

Open Beginner friendly
#89 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
tooling

Research direction

Start in validator.py at dosdp.validator.test_text_fields and inspect how owl_entities is built from the pattern dictionaries. Confirm the validator's handling of the provided data-property example, then make declared dataProperties and annotationProperties count as valid entities. Done means quoted references to those properties no longer produce the not-found warning.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
49
Forks
5
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from INCATools/dead_simple_owl_design_patterns

All issues in INCATools/dead_simple_owl_design_patterns

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.