To support complex logic or interoperability with ontology editors like Protege, you can include OWL (Web Ontology Language) annotations within your LinkML schema. This allows you to define how schema components relate to OWL syntax, such as mapping attributes to AnnotationProperty or ObjectProperty.
Key features for OWL integration include:
slot_uri: Defines the URI for the slot in existing vocabularies (e.g., rdfs:label, dcterms:description).annotations: Uses the owl key to specify OWL axiom types (e.g., owl: Class, owl: ObjectProperty).owl.template: Uses Jinja-style templating to define complex OWL axioms, such as EquivalentClasses. You can use the tr() function (e.g., {{tr(step)}}) to translate inputs into valid OWL entities.close_mappings: Indicates that a class is similar to, but not necessarily identical to, an existing ontology term.
Important: When using a schema with OWL annotations, you must export the results using the -O owl option to preserve this functionality.
classes:
Recipe:
tree_root: true
close_mappings:
- FOODON:00004081
attributes:
label:
description: the name of the recipe
slot_uri: rdfs:label
annotations:
owl: AnnotationProperty, AnnotationAssertion
ingredients:
description: a semicolon separated list of the ingredients
multivalued: true
range: Ingredient
slot_uri: FOODON:00002420
annotations:
owl: ObjectProperty, ObjectSomeValuesFrom
annotations:
owl: Class
owl.template: |
EquivalentClasses(
{{url}}
ObjectIntersectionOf(
recipe:Recipe
{% for step in steps %}
ObjectSomeValuesFrom(recipe:steps {{tr(step)}})
{% endfor %}
)
)