INCATools / INCATools/dead_simple_owl_design_patterns

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

Open Beginner friendly
#89 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
49
Forks
5
PR merge metrics
No merged PRs in 30d

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`:

```python
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:

```yaml
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`:

```python
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.

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.