psychoinformatics-de / datalad-concepts

Other
3 stars 2 forks source link

LinkML dynamic enum for constraining slot value to a list of terms #59

Closed jsheunis closed 3 months ago

jsheunis commented 7 months ago

In the context of https://github.com/mih/datalad-mihextras/issues/44, I have created a basic LinkML model for a datalad dataset. One slot that I'm having trouble with is the license slot for a Dataset class. Based on their documentation (https://linkml.io/linkml/schemas/enums.html#dynamic-enums and https://linkml.io/linkml/faq/modeling.html#how-do-i-constrain-the-value-of-a-slot-using-an-ontology-or-vocabulary) it should be possible to define the slot's range as an enum which references an ontology. But I am unfamiliar with which properties to use and what they actually mean (source_ontology, source_nodes, relationship_types, etc) in order to get this to work. The documentation doesn't provide enough background or more information here, or I guess it assumes some knowledge about ontology queries that I don't have.

I also think my problem has to do with the specific meaning of an ontology vs a list of terms. In this case, our list of terms comes from the prefix: https://spdx.org/licenses/. I guess this isn't an ontology per se, but rather a base URI against which specific terms (here, licenses) can be resolved?

Is this why I get this error:

> gen-jsonld-context tools/metadata/dataset-schema.yaml

ValueError:  Unknown argument: source_ontology = 'spdx'

Note: might be worth investigating the use of https://github.com/INCATools/ontology-access-kit

jsheunis commented 7 months ago

Some possible sources for the list of licenses (all supplied by the spdx organization):

in the MD doc it also suggests:

A list of license ID's can be accessed by querying the RDFa located at http://spdx.org/licenses/index.html for resource license ID (http://spdx.org/rdf/terms#licenseId).

mih commented 3 months ago

I am closing this. There is nothing to do about this aspect ATM. We can reopen as necessary in the future.

The pattern used ATM is direct linkage of license definitions via a dedicated licenses prefix.