Skip to content

Commit

Permalink
fix gen-project
Browse files Browse the repository at this point in the history
  • Loading branch information
sierra-moxon committed Aug 5, 2024
1 parent c5f5729 commit 13b32d2
Show file tree
Hide file tree
Showing 12 changed files with 558 additions and 570 deletions.
27 changes: 27 additions & 0 deletions .env.public
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is public in git. No sensitive info allowed.

###### schema definition variables, used by makefile

LINKML_SCHEMA_NAME="cmdr"
LINKML_SCHEMA_AUTHOR="LinkML Team <admin@linkml.org>"
LINKML_SCHEMA_DESCRIPTION="Core Model for Clinical Data Collection"
LINKML_SCHEMA_SOURCE_PATH="src/cmdr/schema/cmdr.yaml"

###### linkml generator variables, used by makefile

## gen-project configuration file
LINKML_GENERATORS_CONFIG_YAML= --config-file config.yaml

## pass args if gendoc ignores config.yaml (i.e. --no-mergeimports)
LINKML_GENERATORS_DOC_ARGS=

## pass args to workaround genowl rdfs config bug (linkml#1453)
## (i.e. --no-type-objects --no-metaclasses --metadata-profile rdfs)
LINKML_GENERATORS_OWL_ARGS=

## pass args to trigger experimental java/typescript generation
LINKML_GENERATORS_JAVA_ARGS=
LINKML_GENERATORS_TYPESCRIPT_ARGS=

LINKML_SCHEMA_GOOGLE_SHEET_ID="1wVoaiFg47aT9YWNeRfTZ8tYHN8s8PAuDx5i2HUcDpvQ"
LINKML_SCHEMA_GOOGLE_SHEET_TABS="personinfo enums"
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@ PYMODEL = $(SRC)/$(SCHEMA_NAME)/datamodel
DOCDIR = docs
EXAMPLEDIR = examples
SHEET_MODULE = from_sheets
SHEET_ID = $(shell ${SHELL} ./utils/get-value.sh google_sheet_id)
SHEET_TABS = $(shell ${SHELL} ./utils/get-value.sh google_sheet_tabs)
SHEET_ID = $(LINKML_SCHEMA_GOOGLE_SHEET_ID)
SHEET_TABS = $(LINKML_SCHEMA_GOOGLE_SHEET_TABS)
SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml
CONFIG_YAML = config.yaml

# environment variables

.EXPORT_ALL_VARIABLES:
ifdef LINKML_ENVIRONMENT_FILENAME
include ${LINKML_ENVIRONMENT_FILENAME}
else
include .env.public
endif

GEN_PARGS =
ifdef LINKML_COOKIECUTTER_GEN_PROJECT_ARGS
GEN_PARGS = ${LINKML_COOKIECUTTER_GEN_PROJECT_ARGS}
Expand Down Expand Up @@ -100,7 +109,7 @@ gen-examples:
# generates all project files

gen-project: $(PYMODEL)
$(RUN) gen-project ${CONFIG_YAML} -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL)
$(RUN) gen-project -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL)
$(RUN) gen-pydantic --pydantic-version 2 $(SOURCE_SCHEMA_PATH) > $(PYMODEL)/pydanticmodel_v2.py

# non-empty arg triggers owl (workaround https://github.com/linkml/linkml/issues/1453)
Expand Down
46 changes: 12 additions & 34 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,19 @@
# Configuration of generators (defaults illustrated)
---
generator_args:
excel:
mergeimports: true
jsonschema: {}
owl:
mergeimports: true
metaclasses: true
type_objects: true
# throws 'Cannot handle metadata profile: rdfs'
# metadata_profile: rdfs
markdown:
mergeimports: true
graphql:
mergeimports: true
java:
mergeimports: true
metadata: true
jsonld:
mergeimports: true
jsonschema:
mergeimports: true
jsonldcontext:
mergeimports: true
python:
mergeimports: true
prefixmap:
mergeimports: true
proto:
mergeimports: true
shacl:
mergeimports: true
shex:
mergeimports: true
sqlddl:
mergeimports: true
typescript:
mergeimports: true
metadata: true

...
includes:
- jsonschema
- python
- owl
- shex
- shacl
- prefixmap
excludes:
- graphql
- sqlschema
- protobuf
92 changes: 2 additions & 90 deletions project/jsonld/cmdr.context.jsonld
Original file line number Diff line number Diff line change
@@ -1,115 +1,27 @@
{
"comments": {
"description": "Auto generated by LinkML jsonld context generator",
"generation_date": "2023-03-07T15:54:05",
"generation_date": "2024-08-05T13:47:38",
"source": "cmdr.yaml"
},
"@context": {
"OBI": {
"@id": "http://purl.obolibrary.org/obo/OBI_",
"@prefix": true
},
"OBI": "http://example.org/UNKNOWN/OBI/",
"PATO": {
"@id": "http://purl.obolibrary.org/obo/PATO_",
"@prefix": true
},
"TEMP": "https://example.org/TEMP/",
"biolink": "https://w3id.org/biolink/",
"cmdr": "https://w3id.org/linkml/cmdr/",
"example": "https://example.org/",
"linkml": "https://w3id.org/linkml/",
"schema": "http://schema.org/",
"@vocab": "https://w3id.org/linkml/cmdr/",
"comparator": {
"@id": "TEMP:comparator"
},
"concentration": {
"@id": "TEMP:concentration"
},
"has_input": {
"@id": "TEMP:has_input"
},
"has_numeric_value": {
"@id": "TEMP:has_numeric_value"
},
"has_output": {
"@id": "TEMP:has_output"
},
"has_raw_value": {
"@id": "TEMP:has_raw_value"
},
"has_unit": {
"@id": "TEMP:has_unit"
},
"id": "@id",
"includes": {
"@id": "TEMP:includes"
},
"investigations": {
"@id": "TEMP:investigations"
},
"involved_in": {
"@id": "TEMP:involved_in"
},
"material_processings": {
"@id": "TEMP:material_processings"
},
"materials": {
"@id": "TEMP:materials"
},
"name": {
"@id": "TEMP:name"
},
"part_of": {
"@id": "TEMP:part_of"
},
"participations": {
"@id": "TEMP:participations"
},
"source": {
"@id": "TEMP:source"
},
"specimen_collection_processes": {
"@id": "TEMP:specimen_collection_processes"
},
"subjects": {
"@id": "TEMP:subjects"
},
"used_in": {
"@id": "TEMP:used_in"
},
"volume": {
"@id": "TEMP:volume"
},
"Container": {
"@id": "TEMP:Container"
},
"DataObject": {
"@id": "TEMP:DataObject"
},
"Investigation": {
"@id": "TEMP:Investigation"
},
"MaterialEntity": {
"@id": "TEMP:MaterialEntity"
},
"MaterialProcessing": {
"@id": "OBI:0000094"
},
"Participation": {
"@id": "TEMP:Participation"
},
"Process": {
"@id": "TEMP:Process"
},
"Quantity": {
"@id": "TEMP:Quantity"
},
"SpecimenCollectionProcess": {
"@id": "OBI:0000659"
},
"Subject": {
"@id": "TEMP:Subject"
}
}
}
Loading

0 comments on commit 13b32d2

Please sign in to comment.