-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
136 changed files
with
3,432 additions
and
2,250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
*.old | ||
venv/ | ||
target/ | ||
Pipfile | ||
target/ | ||
site/ | ||
venv/ | ||
docs/*md | ||
docs/types/ | ||
*/my_schema.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,109 @@ | ||
SHELL=/bin/bash -o pipefail | ||
SRC_DIR = src | ||
SCHEMA_DIR = $(SRC_DIR)/schema | ||
SOURCE_FILES := $(shell find $(SCHEMA_DIR) -name '*.yaml') | ||
SCHEMA_NAMES = $(patsubst $(SCHEMA_DIR)/%.yaml, %, $(SOURCE_FILES)) | ||
|
||
EXTS = _datamodel.py .graphql .schema.json .owl -docs .shex | ||
SCHEMA_NAME = kgcl | ||
SCHEMA_SRC = $(SCHEMA_DIR)/$(SCHEMA_NAME).yaml | ||
TGTS = graphql jsonschema docs shex owl csv graphql python | ||
|
||
all: $(patsubst %,src/schema/ocl%, $(EXTS)) | ||
#GEN_OPTS = --no-mergeimports | ||
GEN_OPTS = | ||
|
||
all: gen stage | ||
gen: $(patsubst %,gen-%,$(TGTS)) | ||
clean: | ||
rm -rf target/ | ||
rm -rf docs/ | ||
|
||
t: | ||
echo $(SCHEMA_NAMES) | ||
|
||
echo: | ||
echo $(patsubst %,gen-%,$(TGTS)) | ||
|
||
test: all | ||
|
||
OUT = > $@.tmp && mv $@.tmp $@ | ||
|
||
src/schema/%_datamodel.py: src/schema/%.yaml | ||
gen-py-classes $< $(OUT) | ||
src/schema/%.graphql: src/schema/%.yaml | ||
gen-graphql $< $(OUT) | ||
src/schema/%.schema.json: src/schema/%.yaml | ||
gen-json-schema -t transaction $< $(OUT) | ||
src/schema/%.shex: src/schema/%.yaml | ||
gen-shex $< $(OUT) | ||
src/schema/%.csv: src/schema/%.yaml | ||
gen-csv $< $(OUT) | ||
src/schema/%.owl: src/schema/%.yaml | ||
gen-owl $< $(OUT) | ||
src/schema/%.ttl: src/schema/%.owl | ||
cp $< $@ | ||
src/schema/%-docs: src/schema/%.yaml | ||
pipenv run gen-markdown --dir $@ $< | ||
|
||
deploy-docs: | ||
cp src/schema/ocl-docs/*md docs/ | ||
install: | ||
. environment.sh | ||
pip install -r requirements.txt | ||
|
||
tdir-%: | ||
mkdir -p target/$* | ||
docs: | ||
mkdir $@ | ||
|
||
stage: $(patsubst %,stage-%,$(TGTS)) | ||
stage-%: gen-% | ||
cp -pr target/$* . | ||
|
||
|
||
### -- MARKDOWN DOCS -- | ||
# Generate documentation ready for mkdocs | ||
# TODO: modularize imports | ||
gen-docs: target/docs/index.md copy-src-docs | ||
.PHONY: gen-docs | ||
copy-src-docs: | ||
cp $(SRC_DIR)/docs/*md target/docs/ | ||
target/docs/%.md: $(SCHEMA_SRC) tdir-docs | ||
gen-markdown $(GEN_OPTS) --dir target/docs $< | ||
stage-docs: gen-docs | ||
cp -pr target/docs . | ||
|
||
### -- MARKDOWN DOCS -- | ||
# TODO: modularize imports | ||
gen-python: $(patsubst %, target/python/%.py, $(SCHEMA_NAMES)) | ||
.PHONY: gen-python | ||
target/python/%.py: $(SCHEMA_DIR)/%.yaml tdir-python | ||
gen-py-classes --no-mergeimports $(GEN_OPTS) $< > $@ | ||
|
||
### -- MARKDOWN DOCS -- | ||
# TODO: modularize imports. For now imports are merged. | ||
gen-graphql:target/graphql/$(SCHEMA_NAME).graphql | ||
target/graphql/%.graphql: $(SCHEMA_DIR)/%.yaml tdir-graphql | ||
gen-graphql $(GEN_OPTS) $< > $@ | ||
|
||
### -- JSON schema -- | ||
# TODO: modularize imports. For now imports are merged. | ||
gen-jsonschema: target/jsonschema/$(SCHEMA_NAME).schema.json | ||
target/jsonschema/%.schema.json: $(SCHEMA_DIR)/%.yaml tdir-jsonschema | ||
gen-json-schema $(GEN_OPTS) -t transaction $< > $@ | ||
|
||
### -- Shex -- | ||
# one file per module | ||
gen-shex: $(patsubst %, target/shex/%.shex, $(SCHEMA_NAMES)) | ||
target/shex/%.shex: $(SCHEMA_DIR)/%.yaml tdir-shex | ||
gen-shex --no-mergeimports $(GEN_OPTS) $< > $@ | ||
|
||
### -- CSV -- | ||
# one file per module | ||
gen-csv: $(patsubst %, target/csv/%.csv, $(SCHEMA_NAMES)) | ||
target/csv/%.csv: $(SCHEMA_DIR)/%.yaml tdir-csv | ||
gen-csv $(GEN_OPTS) $< > $@ | ||
|
||
### -- OWL -- | ||
# TODO: modularize imports. For now imports are merged. | ||
gen-owl: target/owl/$(SCHEMA_NAME).owl.ttl | ||
.PHONY: gen-owl | ||
target/owl/%.owl.ttl: $(SCHEMA_DIR)/%.yaml tdir-owl | ||
gen-owl $(GEN_OPTS) $< > $@ | ||
|
||
### -- RDF (direct mapping) -- | ||
# TODO: modularize imports. For now imports are merged. | ||
gen-rdf: target/rdf/$(SCHEMA_NAME).ttl | ||
target/rdf/%.ttl: $(SCHEMA_DIR)/%.yaml tdir-rdf | ||
gen-rdf $(GEN_OPTS) $< > $@ | ||
|
||
### -- LinkML -- | ||
# linkml (copy) | ||
# one file per module | ||
gen-linkml: target/linkml/$(SCHEMA_NAME).yaml | ||
target/linkml/%.yaml: $(SCHEMA_DIR)/%.yaml tdir-limkml | ||
cp $< > $@ | ||
|
||
# test docs locally. | ||
docserve: | ||
mkdocs serve | ||
|
||
gh-deploy: | ||
mkdocs gh-deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,8 @@ | ||
# Ontology Change Language | ||
|
||
This repo includes schema and code for an Ontology Change Language | ||
This repo includes schema and code for an Ontology Change Language. | ||
|
||
The overall idea is laid out in: | ||
For full documentation, see: | ||
|
||
https://docs.google.com/document/d/1__7p64FOI5ZhiZ6F2TXtUc8JN1XXGwglOiVRrlg9G_c/edit#heading=h.xadk0a3ee8g | ||
[http://cmungall.github.io/knowledge-graph-change-language](http://cmungall.github.io/knowledge-graph-change-language) | ||
|
||
The goal is to provide a high level abstracted graph-oriented change | ||
language that is intended for describing changes in ontologies and | ||
ontology-like artefacts. The level of abstraction is intentionally at | ||
a higher level than either RDF or OWL. It currently does not attempt | ||
to encapsulate all of OWL. Instead it focuses on the majority of | ||
operations performed on ontologies. | ||
|
||
## Schema | ||
|
||
Browse the schema here: [http://cmungall.github.io/ontology-change-language](http://cmungall.github.io/ontology-change-language) | ||
|
||
See the [schema/](schema/) folder | ||
|
||
The source is in YAML (biolinkml) | ||
|
||
Currently the main derived artefacts of interest are: | ||
|
||
- [JSON Schema](src/schema/ocl.schema.json) | ||
- [Python dataclasses](src/schema/ocl_datamodel.py) | ||
- [GraphQL](src/schema/ocl.graphql) | ||
|
||
Note there is also an OWL vocabulary rendering, and a schema in ShEx (TODO: fix issues with namespaces) | ||
|
||
- [JSON Schema](src/schema/ocl.schema.json) | ||
- [Python dataclasses](src/schema/ocl_datamodel.py) | ||
|
||
|
||
It is likely we will bind this into [owl-diff](https://github.com/balhoff/owl-diff) so compilation to scala traits likely in future. | ||
|
||
Note that transactions can themselves be represented in RDF. This can | ||
be either JSON-LD following the schema above or native. The [ShEx | ||
Schema](src/schema/ocl.shex) constrains the shape of the RDF graph. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.