Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create generateLecternJsonFromCustomLinkml.py #18

Merged
merged 4 commits into from
Feb 10, 2025

Conversation

edsu7
Copy link
Contributor

@edsu7 edsu7 commented Jan 22, 2025

  • generates lectern JSON from full linkML model

- generates lectern JSON from full linkML model
@edsu7 edsu7 requested review from lindaxiang and Buwujiu January 22, 2025 19:36
@edsu7 edsu7 self-assigned this Jan 22, 2025
@edsu7 edsu7 linked an issue Jan 22, 2025 that may be closed by this pull request
edsu7 added 2 commits January 31, 2025 14:39
- add missing unique field
- add missing foreign key logic
tmp['fields']=[]
lectern['schemas'].append(tmp)

def populateFieldProperties(model,lectern):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you consider how to handle the mapping of an array defined in LinkML to Lectern isArray?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LinkML's support for multivalue is not handled as cleanly as lectern

for example data is structured as so according to example:

www.hello.com/testJPEGf.jpeg	JPEG	pipelineF	Bob		1
www.hello.com/3.pdf	PDF	pipelineF		Unknown	[1]
www.hello.com/4.pdf	PDF	pipelineF	Bob		[1|2|3]

but will complain during validation:

  • example run
linkml-validate -s custom/example/example_full.yaml -C Imaging test_data/example/good_data/imaging.tsv
  • outcome
[ERROR] [test_data/example/good_data/imaging.tsv/11] 1 is not of type 'array' in /image_number
[ERROR] [test_data/example/good_data/imaging.tsv/12] '[1]' is not of type 'array' in /image_number
[ERROR] [test_data/example/good_data/imaging.tsv/13] '[1|2|3]' is not of type 'array' in /image_number

For the moment this is the implementation:

if model['slots'][slot]['multivalued'] is not None:
### Assume simple model and not dictionary https://linkml.io/linkml/schemas/inlining.html#no-inlining-reference-by-key
if model['slots'][slot]['multivalued']:
###
tmp['isArray']=True
tmp['delimiter']="|"

@edsu7 edsu7 merged commit bedfa95 into main Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create script to generateLecternJsonFromCustom
2 participants