Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and test single-stub generator script and Facet-by-IRI-pattern support #5

Merged
merged 9 commits into from
Sep 19, 2024

Conversation

ajnelson-nist
Copy link
Member

@ajnelson-nist ajnelson-nist commented Sep 19, 2024

This PR exports some of the functionality from /generate.py, adding a script to generate a JSON-LD stub for a single class.

Changes in behavior from generate.py are:

  • Cardinality for a property P on a class C is now reviewed for properties across the subclass hierarchy.
    • Cardinality bounds are checked in both owl:Restrictions and sh:PropertyShapes.
    • Upper bound is determined by taking min(...) of all sh:maxCount, owl:cardinality, and owl:maxCardinality across the subclass hierarchy between owl:Thing and C.
    • When a property is cardinality [n..m] at a class C, the stub for C now prints these "null-ish" values:
      • [ 0..0 ] : Property omitted.
      • [ 0..1 ] : null.
      • [ 0..* ] : [].
      • [ 1..* ] : Not currently handled. Default values need to be considered. This is not a change from the current implementation - see e.g. core:name on observable:Observation, which currently requires being bound to the string observe.
  • Stubs' keys are now sorted.
  • Facet stubs are now inlined under the list for uco-core:hasFacet. Which Facets are inlined is determined solely by a pattern-match, where if a class has IRI I, and I + "Facet" is the IRI of a subclass of uco-core:Facet, then the object is assumed to expect having an instance of I + "Facet". The OWL spelling for this is encoded with another generating script, and this general expression form will be proposed to UCO soon, with opportunity for further refinement when UcoObjects and Facets correspond outside of this pattern-match. The var/ directory has the generated file.

This PR includes CI updates to run the single-stub generating script on a few test classes as a smoke test, and adds type signature review to the supply chain check.

This PR does not include regenerating the stubs under /templates.

Disclaimer

Participation by NIST in the creation of the documentation of mentioned software is not intended to imply a recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that any specific software is necessarily the best available for the purpose.

@ajnelson-nist ajnelson-nist marked this pull request as ready for review September 19, 2024 15:03
@kchason kchason merged commit 4d834e2 into main Sep 19, 2024
2 checks passed
@kchason kchason deleted the add_new_single_stub_generator branch September 19, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants