Formalism (EARLY DRAFT)
THIS IS OUT OF DATE REGARDING THE CURRENT IMPLEMENTATION
A LinkML model M consists of:
- slots
MS = {s1, ...} - classes
MC = {c1,...} - enums
MEn = {En1, ...} - types
MT = {t1, ...} - subsets
MSu = {su1, ..}
Each slot s ∈ MS and each class c ∈ MC has an interpretation Δ:
Δ(s) ∈ P( {SubClassOf, ClassAssertion, SomeValuesFrom, AllValuesFrom, AnnotationAssertion, ObjectPropertyAssertion, AnnotationPropertyAssertion, UnionOf, DataOneOf, ObjectOneOf } )Δ(c) ∈ P( {Class, Individual, ObjectProperty, DataProperty, AnnotationAssertion} )
(here P denotes the powerset, i.e. Δ maps to class or slot to a set of valid terms)
The interpretation dictates how elements that instantiate the model are translated to OWL-DL
Informative note:
- any class
c ∈ MCwhereClass ∈ Δ(c)is considered a metaclass - any class
c ∈ MCwhere*Property ∈ Δ(c)is considered a metaproperty - in the linkml metamodel, the class
ClassDefinitionis a metaclass
A LinkML element e ∈ E is either:
- An instance of a class in
MC - A reference to an instance of a class in
MC - A literal taken from the universe of literals
L - A permissible value from the set of permissible values of a member of
MEn
Note that the distinction between 1 and 2 only holds for tree representations such as YAML and JSON serializations.
Each e has a set of slot-value assignments A(e),
where each assignment is a pair s, V
sis a slot inMS-
Vis a list of elementsv1, ..., vneach of which can be:- if
s.range ∈ MT:v_imust be aLiteral - if
s.range ∈ MC:v_imust be either:- another element in
IOR - a reference to an element in
I - (this distinction only holds for yaml/json tree representations)
- another element in
- if
s.range ∈ MEn:v_imust be a member of the permissible value inME
- if
-
A(i) ⊆ { (s,V) ∈ MS x I ∪ Ref(I) ∪ ME ∪ L }
Any slot marked as identifier is not considered among the list of slots.
- The identifier slot for a class
cis markedc.id - The identifier value for an element
eis markede.id
Only elements that instantiate classes in MC can have identifiers.
Not all instantiating elements have identifiers - instantiating elements without anonymous
Any linkml element can be translated using the rules below. The translation is recursive, i.e. mapping an element that has slot-value associations will invoke mappings on the values of these associations.
If the linkml element graph is a tree, then invoking mapping on the root will map the whole graph
Mapping elements
The function Tr(e) will translate an element e to an OWL entity, and as
a side-effect will generate OWL axioms
Table 1: Translation of elements to OWL entities
| condition | returns |
|---|---|
e.type ∈ MC and hasId(e) |
IRI(e.id) |
e.type ∈ MC and noId(e) |
BlankNode() |
e.type ∈ Ref(MC) |
IRI(e) |
e.type ∈ MEn |
IRI(e.meaning) |
e.type ∈ T |
Literal(e) |
Generation of OWL axioms
Invoking Tr(e) will additionally generate further OWL axioms:
- for all
(s,V) in A(e), a mappingTr(e,s,V)is applied
See mapping slot values below.
Generation of OWL declarations
TODO
| Function | Δ(e.type) |
generates | cond |
|---|---|---|---|
C(i) |
* | Class(IRI(i.id)) |
i.id exists |
OP(i) |
* | ObjectProperty(IRI(i.id)) |
i.id exists |
DP(i) |
* | DataProperty(IRI(i.id)) |
i.id exists |
AP(i) |
* | AnnotationProperty(IRI(i.id)) |
i.id exists |
*|*|BlankNode(i)|i.id` not exists |
Mapping slot values: Tr(i,s,V)
interpretation of an element i with slot s with values V=v1..vn
Table 2: single-valued or conjunctive lists
If s is not multivalued OR {UnionOf, DataOneOf, ObjectOneOf} ∩ Δ(s) = {}
then the following table generates an axiom for all v ∈ V
Δ(e.type) |
Δ(s) |
expression | cond |
|---|---|---|---|
| * | SubClassOf ∈ Δ |
C(e) ⊑ C(v) |
|
| * | SubObjectPropertyOf ∈ Δ |
OP(e) ⊑ OP(v) |
|
| * | ClassAssertion ∈ Δ |
I(e) : C(v) |
|
Class |
SomeValuesFrom ∈ Δ |
C(e) ⊑ ∃ OP(s) C(v) |
|
Class |
AllValuesFrom ∈ Δ |
C(e) ⊑ ∀ OP(s) C(v) |
|
Individual |
SomeValuesFrom ∈ Δ |
I(e) : ∃ OP(s) C(v) |
|
Individual |
AllValuesFrom ∈ Δ |
I(e) : ∀ OP(s) C(v) |
|
* |
AnnotationAssertion ∈ Δ OR Δ = {} |
Ann(P(s) IRI(e) Tr(v)) |
|
* |
ObjectPropertyAssertion ∈ Δ |
OPA(OP(s) IRI(e) Tr(v)) |
|
* |
DataPropertyAssertion ∈ Δ |
DPA(DP(s) IRI(e) Tr(v)) |
See DL article on Wikipedia for explanation of symbols
multi-valued or disjunctive lists
If s is multivalued AND {UnionOf, DataOneOf, ObjectOneOf} ∩ Δ(s) ≠ {}
then apply the following steps, and then apply table 2 rules
Δ(s) |
Tr(V) |
|---|---|
UnionOf ∈ Δ |
UnionOf(C(v1), ..., C(vn)) |
ObjectOneOf ∈ Δ |
ObjectOneOf(I(v1), ..., I(vn)) |
DataOneOf ∈ Δ |
DataOneOf(D(v1), ..., D(vn)) |
pre-processing
For uncommitted slots that have a slot iri with a pre-existing interpretation, these are used:
- If
s.iri = rdf:type, andΔ(s) = {}then setΔ(s) = {ClassAssertion} - If
s.iri = rdfs:subClassOf, andΔ(s) = {}then setΔ(s) = {SubClassOf} - etc TODO