linkml / linkml

Linked Open Data Modeling Language
https://linkml.io/linkml
Other
308 stars 95 forks source link

compare with cuelang and provide exporters #151

Open cmungall opened 3 years ago

cmungall commented 3 years ago

https://cuelang.org/

CUE is an open-source data validation language and inference engine with its roots in logic programming. Although the language is not a general-purpose programming language, it has many applications, such as data validation, data templating, configuration, querying, code generation and even scripting. The inference engine can be used to validate data in code or to include it as part of a code generation pipeline.

A key thing that sets CUE apart from its peer languages is that it merges types and values into a single concept. Whereas in most languages types and values are strictly distinct, CUE orders them in a single hierarchy (a lattice, to be precise). This is a very powerful concept that allows CUE to do many fancy things. It also simplifies matters. For instance, there is no need for generics and enums, sum types and null coalescing are all the same thing.

There are some similarities woith LinkML, as well as differences. We should explore these. Especially in the context of adding constraints to LinkML

We can also provide a cuelang exporter.

noelmcloughlin commented 3 years ago

I recently started playing around with CUE because I would like to Data Validate multiple YAML files. I'm a CUE newbie, but I see you could generate a Constraints file from YAML file.

$ cue import biolink-model.yaml

Edit the generated biolink-model.cue to exchange values (i.e. name: cow") for constraints (i.e. name: "^[a-z]{3}$") and then validate your YAML in your CI/CD workflow.

$ cue vet biolink-model.cue biolink-model.yaml

I have demo of this here: https://github.com/saltstack-formulas/template-formula/issues/232 and it may get traction in our community because "our schema" is not forced, users can choose to maintain the schema and data validate, or just ignore this cue stuff.