Ontology: Add custom_properties (e.g. for OWL import)#146
Open
jochenchrist wants to merge 3 commits into
Open
Conversation
Importing an ontology from an external format such as OWL/RDF loses any data that the core OSI spec does not model (IRIs, rdfs:label, owl:equivalentClass, annotations, provenance, ...), because every ontology object is locked down with additionalProperties: false. Add an open `custom_properties` object to the ontology root, concepts, relationships, and roles. Keys are free-form and values may be any JSON, so tools can preserve foreign data and round-trip it. CURIEs like `owl:equivalentClass` are recommended for semantic-web sources. The rest of each object keeps additionalProperties: false, so custom_properties is the single, explicit escape hatch. Includes a FOAF/OWL import example and documents the field in the spec. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
RDF labels and comments are usually language-tagged and the previous example used a plain string, which is lossy. Recommend the readable `prefix:local@lang` key convention for language-tagged literals (the `@` cannot appear in a CURIE local name, so it parses unambiguously), and point at the JSON-LD value-object form for the multi-value and typed literal cases that the flat form cannot express. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kurtStirewalt
approved these changes
Jun 7, 2026
kurtStirewalt
left a comment
Contributor
There was a problem hiding this comment.
This is a nice addition!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Importing an ontology from an external format such as OWL/RDF currently loses any data that the core OSI spec does not model — IRIs,
rdfs:label,owl:equivalentClass, annotations, provenance, and so on — because every ontology object is locked down withadditionalProperties: false. There is no place to put it, so a round-trip (OWL → OSI → OWL) is lossy.This PR adds an open
custom_propertiesobject to the ontology root, concepts, relationships, and roles. Keys are free-form and values may be any JSON, so importers can preserve foreign data and round-trip it. The rest of each object keepsadditionalProperties: false, socustom_propertiesis the single, explicit escape hatch rather than letting arbitrary keys leak in anywhere.For semantic-web sources, CURIEs such as
owl:equivalentClassorrdfs:labelare recommended so the origin of each property stays clear.Design notes
The core spec (logical model) already has a
custom_extensions: [{vendor_name, data}]mechanism wheredatais a stringified JSON blob. I deliberately did not reuse that here:vendor_nameblob is an awkward fit.If maintainers would prefer to unify on one extensibility mechanism spec-wide, I'm happy to switch this to the
custom_extensionsshape instead — flagging the choice explicitly.Changes
ontology/ontology.json: add a reusableCustomProperties$defand reference it from the root,Concept,Relationship, andRole.ontology/ontology.md: add the field to the four schema tables, a new "Custom properties" section with an OWL example, and a version-history note.examples/foaf_owl_import.yaml: a small FOAF/OWL import example exercisingcustom_propertiesat the root, concept, relationship, and role levels.Validation
ontology/ontology.jsonis well-formed JSON.examples/flights.yamlboth validate against the updated schema (Draft 2020-12).custom_properties.Language-tagged literals
RDF literals are often language-tagged. The recommended convention is to append the BCP 47 tag to the key after an
@(rdfs:label@en,rdfs:label@fr);@is not legal in a CURIE local name, so this parses unambiguously. For the cases the flat form cannot express (multiple values in one language, or a non-language datatype such asxsd:date), the docs point at the lossless JSON-LD value-object form. This is convention only; OSI still treatscustom_propertiesas opaque.