You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ossie.apache.org by "RyutoYoda (via GitHub)" <gi...@apache.org> on 2026/09/28 02:56:01 UTC

[PR] fix(ontology): carry iri and prefixes through the converters [ossie]

RyutoYoda opened a new pull request, #479:
URL: https://github.com/apache/ossie/pull/479

   ## Summary
   
   `iri` on concepts and relationships, and the root `prefixes` map, are part of
   `ontology/ontology.json` and documented in `ontology/ontology.md`, but
   `converters/ontology` never learned about them. A document that uses them fails to parse,
   and once the DTOs accept it the values are still dropped on the way through `model.py`.
   
   This adds the fields to `spec.py`, gives `Concept`, `Relationship` and `OssieOntology`
   somewhere to hold them in `model.py`, and wires both converters so a document survives
   `parse -> convert -> dump_yaml` unchanged.
   
   `iri` sits next to `description` so the dumped YAML keeps it near the top of a concept
   rather than trailing a long `relationships:` block, which matches how the example in
   `ontology/ontology.md` is written. `prefixes` goes last on the root. All three are optional
   with the same defaults the schema implies, so a document that declares none of them dumps
   exactly as before.
   
   ### Not in this change
   
   `model.py` stores the `iri` string as written and does not expand a QName against
   `prefixes`. Expansion belongs to whichever converter emits IRIs (#431, #389); the model's
   job here is only to stop losing the input.
   
   While checking that, I noticed `ontology/ontology.md` states that a QName whose prefix is
   not declared in `prefixes` is invalid, but nothing enforces it: a document with
   `iri: nosuch:Person` and no `prefixes` map reports `Validation PASSED`. That is a
   validation gap rather than a converter one, so it is out of scope here. Happy to open a
   separate issue for it.
   
   ## Related Issues
   
   Closes #478
   
   ## Verification
   
   Run from `converters/ontology` on `dd694d9`.
   
   `uv run pytest` — 161 passed on Python 3.11, 3.12, 3.13 and 3.14 (the
   `converter-ontology-ci` matrix). 159 before, 2 new.
   
   Round trip of a document using both fields returns it unchanged:
   
   ```
   $ uv run python -c "...OssieToSpecConverter.convert(OssieParser().parse(Path('iri_probe.yaml'))).dump_yaml()"
   version: 0.2.0.dev0
   name: IriProbe
   ontology:
   - concept: Person
     type: EntityType
     iri: foaf:Person
     identify_by:
     - name
     relationships:
     - name: name
       iri: foaf:name
       roles:
       - concept: String
       verbalizes:
       - '{Person} is identified by {String}'
       multiplicity: OneToOne
   prefixes:
     foaf: http://xmlns.com/foaf/0.1/
   ```
   
   The output parses back to the same document and passes
   `validation/validate.py --schema ontology/ontology.json`.
   
   No change for documents that do not use the fields: the round-trip dump of
   `examples/flights.yaml` is byte-identical before and after this patch.
   
   I checked the two new tests are not vacuous by breaking each of the 15 value-carrying
   source edits one at a time and re-running the suite. All 15 are caught; none survives.
   
   ## Checklist
   
   Sections this change does not touch are left unchecked, with the reason below.
   
   ### Specification
   - [ ] Spec changes are included in `core-spec/` and follow the existing structure
   - [ ] Spec changes have been discussed on the mailing list or in a linked issue
   - [ ] Breaking changes to the spec are clearly called out in the summary
   
   No spec change. `core-spec/` is untouched, and `ontology/ontology.json` already defines
   these fields.
   
   ### Ontology
   - [ ] Ontology changes in `ontology/` are consistent with spec changes
   - [ ] New or modified terms are defined and documented
   
   No ontology change. `iri` and `prefixes` were defined in #332 and documented in #400; this
   only makes the converters match.
   
   ### Converters
   - [x] Converter logic in `converters/` is updated to reflect spec or ontology changes
   - [ ] New converters include tests under the converter's test directory
   - [ ] If adding a new converter, `.github/labeler.yml` is updated with the new path
   
   No new converter — the two existing ones are fixed, so there is no new path to label.
   
   ### Validation
   - [ ] Validation rules in `validation/` are updated if the spec changed
   - [ ] New validation cases are covered by tests
   
   `validation/validate.py` already accepts both fields; I confirmed a document using them
   reports `Validation PASSED` on `main`. The gap was only in the converters.
   
   ### Documentation
   - [ ] `docs/` is updated to reflect any user-facing changes
   - [ ] New features or behaviors are documented with examples where appropriate
   - [ ] `CONTRIBUTING.md` is updated if the contribution process changed
   
   Nothing to update. Both fields are already documented in `ontology/ontology.md`
   (Global identifiers), and `converters/ontology/README.md` does not list spec fields.
   
   ### Examples
   - [ ] `examples/` are added or updated for any new spec constructs or converter support
   
   No new construct, and `examples/flights.yaml` does not use IRIs. Coverage is in the unit
   tests instead, so the example stays focused on what it is there to show.
   
   ### Tests
   - [x] All existing tests pass (`pytest` / CI green)
   - [x] New functionality is covered by tests
   
   ### Compliance
   - [x] ASF license headers are present on all new source files
   - [x] No third-party dependencies are added without PMC/IPMC approval
   - [x] If third-party source code is vendored/copied (not just declared as a dependency), `NOTICE` and/or `LICENSE` have been updated per [ASF policy](https://infra.apache.org/licensing-howto.html)
   
   No new files (all five are modifications, headers intact), no dependency change, and
   nothing vendored.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ossie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(ontology): carry iri and prefixes through the converters [ossie]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre merged PR #479:
URL: https://github.com/apache/ossie/pull/479


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ossie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(ontology): carry iri and prefixes through the converters [ossie]

Posted by "RyutoYoda (via GitHub)" <gi...@apache.org>.
RyutoYoda commented on PR #479:
URL: https://github.com/apache/ossie/pull/479#issuecomment-5864468119

   Thanks for the thorough run — the non-ASCII prefix value and the `ex:고객번호` QName
   are cases I had not covered.
   
   Moved `prefixes` up to sit after `description` in e6b1873. The `ontology.md` example
   now round-trips with its original layout, `name` then `prefixes` then `ontology`.
   Field order only: `examples/flights.yaml` still dumps byte-identical to main
   (md5 `8a87f1a670971b73c1c0b1a54130acaa`), 161 pass on 3.11 through 3.14.
   
   On #412 you are right and I read it wrong at first — the file list shows the rename
   only under the new path. `git diff` gives
   `R073 tests/test_ossie_parser.py -> tests/spec/test_parser.py`, and a test merge
   conflicts there. Merging #412 into plain `main` conflicts only in
   `test_palantir_converter.py`, so that one is unrelated drift. Happy to carry the two
   tests over if #412 lands first.
   
   Confirmed on the format checker: `validate.py` builds
   `Draft202012Validator(schema, registry=registry)` with no `format_checker`, so
   `format: iri` is not enforced either. Both go in the follow-up issue.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ossie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org