Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
cmungall committed Feb 8, 2021
1 parent adff1cf commit ad10525
Show file tree
Hide file tree
Showing 136 changed files with 3,432 additions and 2,250 deletions.
7 changes: 7 additions & 0 deletions .gitignore
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.*
128 changes: 104 additions & 24 deletions Makefile
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
38 changes: 3 additions & 35 deletions README.md
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.
2 changes: 1 addition & 1 deletion docs/Activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

a provence-generating activity

URI: [ocl:Activity](http://w3id.org/oclActivity)
URI: [kgcl:Activity](http://w3id.org/kgclActivity)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[Agent],[Agent]<was%20associated%20with%200..1-++[Activity&#124;activity_id:string;started_at_time:string%20%3F;ended_at_time:string%20%3F;used:string%20%3F],[Activity]<was%20informed%20by%200..1-%20[Activity],[Change]-%20was%20generated%20by%200..1>[Activity],[Change])
Expand Down
10 changes: 8 additions & 2 deletions docs/AddNodeToSubset.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

Places a node inside a subset, by annotating that node

URI: [ocl:AddNodeToSubset](http://w3id.org/oclAddNodeToSubset)
URI: [kgcl:AddNodeToSubset](http://w3id.org/kgclAddNodeToSubset)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[NodeChange],[AddToSubset],[AddNodeToSubset&#124;about(i):string%20%3F;old_value(i):string%20%3F;new_value(i):string%20%3F]uses%20-.->[AddToSubset],[NodeChange]^-[AddNodeToSubset],[Activity])
![img](http://yuml.me/diagram/nofunky;dir:TB/class/[Subset],[NodeChange],[AddToSubset],[AddNodeToSubset&#124;about(i):string%20%3F;old_value(i):string%20%3F;new_value(i):string%20%3F]uses%20-.->[AddToSubset],[NodeChange]^-[AddNodeToSubset],[Activity])

## Parents

Expand All @@ -33,6 +33,12 @@ URI: [ocl:AddNodeToSubset](http://w3id.org/oclAddNodeToSubset)
* [was generated by](was_generated_by.md) <sub>OPT</sub>
* range: [Activity](Activity.md)

### Mixed in from add to subset:

* [add to subset➞in subset](add_to_subset_in_subset.md) <sub>OPT</sub>
* Description: subset that the element is being placed inside.
* range: [Subset](Subset.md)

## Other properties

| | | |
Expand Down
10 changes: 8 additions & 2 deletions docs/AddToSubset.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

placing an element inside a subset

URI: [ocl:AddToSubset](http://w3id.org/oclAddToSubset)
URI: [kgcl:AddToSubset](http://w3id.org/kgclAddToSubset)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[ChangeMixin],[AddNodeToSubset]uses%20-.->[AddToSubset],[ChangeMixin]^-[AddToSubset],[AddNodeToSubset])
![img](http://yuml.me/diagram/nofunky;dir:TB/class/[Subset],[ChangeMixin],[Subset]<in%20subset%200..1-++[AddToSubset],[AddNodeToSubset]uses%20-.->[AddToSubset],[ChangeMixin]^-[AddToSubset],[AddNodeToSubset])

## Parents

Expand All @@ -22,3 +22,9 @@ URI: [ocl:AddToSubset](http://w3id.org/oclAddToSubset)

## Attributes


### Own

* [add to subset➞in subset](add_to_subset_in_subset.md) <sub>OPT</sub>
* Description: subset that the element is being placed inside.
* range: [Subset](Subset.md)
2 changes: 1 addition & 1 deletion docs/Agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

a provence-generating agent

URI: [ocl:Agent](http://w3id.org/oclAgent)
URI: [kgcl:Agent](http://w3id.org/kgclAgent)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[Activity]<was%20informed%20by%200..1-%20[Agent],[Agent]<acted%20on%20behalf%20of%200..1-++[Agent],[Activity]++-%20was%20associated%20with%200..1>[Agent],[Activity])
Expand Down
2 changes: 1 addition & 1 deletion docs/Annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

owl annotations. Not to be confused with annotations sensu GO

URI: [ocl:Annotation](http://w3id.org/oclAnnotation)
URI: [kgcl:Annotation](http://w3id.org/kgclAnnotation)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[PropertyValue],[Node],[Node]<property(i)%200..1-%20[Annotation&#124;filler(i):string%20%3F],[Annotation]<annotation%20set%200..1-++[Annotation],[PropertyValue]^-[Annotation])
Expand Down
2 changes: 1 addition & 1 deletion docs/Change.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Any change perform on an ontology or knowledge graph

URI: [ocl:Change](http://w3id.org/oclChange)
URI: [kgcl:Change](http://w3id.org/kgclChange)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[SimpleChange],[ComplexChange],[Activity]<was%20generated%20by%200..1-%20[Change],[ComplexChange]++-%20change%20set%200..*>[Change],[Transaction]++-%20change%20set%200..*>[Change],[Change]^-[SimpleChange],[Change]^-[ComplexChange],[Transaction],[Activity])
Expand Down
2 changes: 1 addition & 1 deletion docs/ChangeMixin.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

root class for all change mixins

URI: [ocl:ChangeMixin](http://w3id.org/oclChangeMixin)
URI: [kgcl:ChangeMixin](http://w3id.org/kgclChangeMixin)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[Unobsoletion],[RemoveFromSubset],[Obsoletion],[Deletion],[Creation],[ChangeMixin]^-[Unobsoletion],[ChangeMixin]^-[RemoveFromSubset],[ChangeMixin]^-[Obsoletion],[ChangeMixin]^-[Deletion],[ChangeMixin]^-[Creation],[ChangeMixin]^-[AddToSubset],[AddToSubset])
Expand Down
8 changes: 6 additions & 2 deletions docs/ChangeSetSummaryStatistic.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

A summary statistic for a set of changes of the same type, grouped by zero or more node properties

URI: [ocl:ChangeSetSummaryStatistic](http://w3id.org/oclChangeSetSummaryStatistic)
URI: [kgcl:ChangeSetSummaryStatistic](http://w3id.org/kgclChangeSetSummaryStatistic)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[PropertyValue],[PropertyValue]<property%20value%20set%200..*-++[ChangeSetSummaryStatistic])
![img](http://yuml.me/diagram/nofunky;dir:TB/class/[PropertyValue],[PropertyValue]<property%20value%20set%200..*-++[ChangeSetSummaryStatistic&#124;change_type:change_class_type%20%3F;count:integer%20%3F])

## Referenced by class

Expand All @@ -17,6 +17,10 @@ URI: [ocl:ChangeSetSummaryStatistic](http://w3id.org/oclChangeSetSummaryStatisti

### Own

* [change set summary statistic➞change type](change_set_summary_statistic_change_type.md) <sub>OPT</sub>
* range: [ChangeClassType](types/ChangeClassType.md)
* [change set summary statistic➞count](change_set_summary_statistic_count.md) <sub>OPT</sub>
* range: [Integer](types/Integer.md)
* [change set summary statistic➞property value set](change_set_summary_statistic_property_value_set.md) <sub>0..*</sub>
* Description: Summary statistic is grouped by these constraints
* range: [PropertyValue](PropertyValue.md)
2 changes: 1 addition & 1 deletion docs/ClassNode.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A node that is a class

URI: [ocl:ClassNode](http://w3id.org/oclClassNode)
URI: [kgcl:ClassNode](http://w3id.org/kgclClassNode)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[Node],[Node]^-[ClassNode&#124;id(i):string;name(i):string%20%3F],[Annotation])
Expand Down
2 changes: 1 addition & 1 deletion docs/ComplexChange.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A change that is is a composition of other changes

URI: [ocl:ComplexChange](http://w3id.org/oclComplexChange)
URI: [kgcl:ComplexChange](http://w3id.org/kgclComplexChange)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[Change]<change%20set%200..*-++[ComplexChange],[Change]^-[ComplexChange],[Change],[Activity])
Expand Down
2 changes: 1 addition & 1 deletion docs/Creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Creation of an element.

URI: [ocl:Creation](http://w3id.org/oclCreation)
URI: [kgcl:Creation](http://w3id.org/kgclCreation)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[NodeCreation]uses%20-.->[Creation],[EdgeCreation]uses%20-.->[Creation],[ChangeMixin]^-[Creation],[NodeCreation],[EdgeCreation],[ChangeMixin])
Expand Down
2 changes: 1 addition & 1 deletion docs/DatatypeChange.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@



URI: [ocl:DatatypeChange](http://w3id.org/oclDatatypeChange)
URI: [kgcl:DatatypeChange](http://w3id.org/kgclDatatypeChange)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[SimpleChange],[SimpleChange]^-[DatatypeChange&#124;about(i):string%20%3F;old_value(i):string%20%3F;new_value(i):string%20%3F],[Activity])
Expand Down
2 changes: 1 addition & 1 deletion docs/Deletion.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Removal of an element.

URI: [ocl:Deletion](http://w3id.org/oclDeletion)
URI: [kgcl:Deletion](http://w3id.org/kgclDeletion)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[NodeDeletion]uses%20-.->[Deletion],[EdgeDeletion]uses%20-.->[Deletion],[ChangeMixin]^-[Deletion],[NodeDeletion],[EdgeDeletion],[ChangeMixin])
Expand Down
2 changes: 1 addition & 1 deletion docs/Edge.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A relationship between two nodes. We assume owlstar or similar for existential restrictions

URI: [ocl:Edge](http://w3id.org/oclEdge)
URI: [kgcl:Edge](http://w3id.org/kgclEdge)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[OntologyElement],[Node],[Annotation]<annotation%20set%200..1-++[Edge],[Node]<object%200..1-%20[Edge],[Node]<edge%20label%200..1-%20[Edge],[Node]<subject%200..1-%20[Edge],[OntologyElement]^-[Edge],[Annotation])
Expand Down
2 changes: 1 addition & 1 deletion docs/EdgeChange.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A change in which the entity changes is an edge

URI: [ocl:EdgeChange](http://w3id.org/oclEdgeChange)
URI: [kgcl:EdgeChange](http://w3id.org/kgclEdgeChange)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[SimpleChange],[NodeMove],[EdgeObsoletion],[EdgeLogicalInterpretationChange],[EdgeLabelChange],[EdgeDeletion],[EdgeCreation],[EdgeChange&#124;about:string%20%3F;old_value(i):string%20%3F;new_value(i):string%20%3F]^-[NodeMove],[EdgeChange]^-[EdgeObsoletion],[EdgeChange]^-[EdgeLogicalInterpretationChange],[EdgeChange]^-[EdgeLabelChange],[EdgeChange]^-[EdgeDeletion],[EdgeChange]^-[EdgeCreation],[SimpleChange]^-[EdgeChange],[Activity])
Expand Down
2 changes: 1 addition & 1 deletion docs/EdgeCreation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

An edge change in which a de-novo edge is created. The edge is potentially annotated in the same action.

URI: [ocl:EdgeCreation](http://w3id.org/oclEdgeCreation)
URI: [kgcl:EdgeCreation](http://w3id.org/kgclEdgeCreation)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[Node],[Annotation]<annotation%20set%200..1-++[EdgeCreation&#124;change_description:string%20%3F;about(i):string%20%3F;old_value(i):string%20%3F;new_value(i):string%20%3F],[Node]<object%200..1-%20[EdgeCreation],[Node]<edge%20label%200..1-%20[EdgeCreation],[Node]<subject%200..1-%20[EdgeCreation],[EdgeCreation]uses%20-.->[Creation],[EdgeChange]^-[EdgeCreation],[EdgeChange],[Creation],[Annotation],[Activity])
Expand Down
2 changes: 1 addition & 1 deletion docs/EdgeDeletion.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

An edge change in which an edge is removed. All edge annotations/properies are removed in the same action.

URI: [ocl:EdgeDeletion](http://w3id.org/oclEdgeDeletion)
URI: [kgcl:EdgeDeletion](http://w3id.org/kgclEdgeDeletion)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[Node],[Annotation]<annotation%20set%200..1-++[EdgeDeletion&#124;change_description:string%20%3F;about(i):string%20%3F;old_value(i):string%20%3F;new_value(i):string%20%3F],[Node]<object%200..1-%20[EdgeDeletion],[Node]<edge%20label%200..1-%20[EdgeDeletion],[Node]<subject%200..1-%20[EdgeDeletion],[EdgeDeletion]uses%20-.->[Deletion],[EdgeChange]^-[EdgeDeletion],[EdgeChange],[Deletion],[Annotation],[Activity])
Expand Down
2 changes: 1 addition & 1 deletion docs/EdgeLabelChange.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

An edge change where the edge label (relationship type) is modified.

URI: [ocl:EdgeLabelChange](http://w3id.org/oclEdgeLabelChange)
URI: [kgcl:EdgeLabelChange](http://w3id.org/kgclEdgeLabelChange)


![img](http://yuml.me/diagram/nofunky;dir:TB/class/[EdgeChange]^-[EdgeLabelChange&#124;change_description:string%20%3F;about(i):string%20%3F;old_value(i):string%20%3F;new_value(i):string%20%3F],[EdgeChange],[Activity])
Expand Down
Loading

0 comments on commit ad10525

Please sign in to comment.