Skip to content

validate.py accepts ontology documents with undeclared concepts, relationships and prefixes #488

Closed

Description

@kayemkim

Problem

validate.py is what the repo documents for checking an ontology document (--schema ontology/ontology.json) and what the validation CI runs. For core documents it checks unique names, references, column arity and SQL on top of the schema. For ontology documents it stops at the schema, since each of those checks is guarded by the presence of datasets.

A small ontology document with any one of the following passes on main (adfa9e4):

  • the same concept name declared twice
  • extends naming a concept that is not declared
  • identify_by naming a relationship the concept does not have
  • a role played by a concept that is not declared
  • a QName iri whose prefix is not in prefixes, which ontology.md says is invalid

The reference parser in converters/ontology rejects four of them. The duplicate concept goes through there as well, the later declaration silently replacing the earlier one. So the rules exist, but only for people who run the converter, and CI runs validate.py. The validation CI also only validates the TPC-DS core example, so examples/flights.yaml is not exercised either.

Proposal

Add the checks to validate.py, scoped to the ontology section: unique concept and relationship names, extends, identify_by and role references (built-in concepts included), a cycle check on extends, and QName prefixes against prefixes, with tests under validation/tests and a CI step validating flights.yaml against the ontology schema. ontology_mappings can wait for #458 to settle where they live.

Discussed on dev@ (https://lists.apache.org/thread/lltdz30fryypzgvgc0ldd2tbbbhrqt10), where the built-ins, the cycle check and the CI step were suggested as additions. PR follows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue needs triage by a maintainer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions