Boolean expressions and linkml:Any
#2926
-
|
The LinkML docs say:
from https://linkml.io/linkml/schemas/advanced.html#boolean-constraints and
from https://linkml.io/linkml/schemas/advanced.html#unions-as-ranges However, personinfo.yaml (e.g. in linkml/tests/test_transformers/input/personinfo.yaml), everyone’s favourite test staple, contains the following: > slots:
> type:
> [...]
> slot_usage:
> type:
> any_of:
> - range: FamilialRelationshipType
> - range: NonFamilialRelationshipType
> required: truewith no When is
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Yes, the docs need to be clearer on this. Strictly speaking, assuming that the This should be avoided for two reasons:
Reason 2 may not be super-apparent. It is formally encoded in the compliance tests linkml/tests/test_compliance/test_boolean_slot_compliance.py Lines 148 to 152 in 5863045 Which still lack a nice report Now, it could be argued that the expectation is for any_of to work more like python or json-schema rather than OWL, and I think this is perfectly reasonable. If there is consensus, then we can codify the following:
Formally, we would treat the Comments on the above welcome Note that regardless, the recommendation is still to be explicit for now to avoid nasty json-schema surprises (either via |
Beta Was this translation helpful? Give feedback.
-
|
I've implemented fairly comprehensive tests for re: SchemaView slot ranges, default ranges, and monotonicity I would like to add in an The endgame here is having a function that can work out the possible types for a slot, which would be used by generators that map linkml to other formats. |
Beta Was this translation helpful? Give feedback.
-
|
For the sake of record keeping, I link to a related issue (that I misfiled in cookiecutter repo): linkml/linkml-project-cookiecutter#144 |
Beta Was this translation helpful? Give feedback.
Yes, the docs need to be clearer on this. Strictly speaking, assuming that the
default_rangeis string, andtypeinherits it, then this is non-monotonic.This should be avoided for two reasons:
Reason 2 may not be super-apparent. It is formally encoded in the compliance tests
linkml/tests/test_compliance/test_boolean_slot_compliance.py
Lines 148 to 152 in 5863045
Which still lack…