Skip to content

Commit

Permalink
Reorganize code
Browse files Browse the repository at this point in the history
Importantly, strictly separate ontology components from schema
definitions.

The rest is the changes are largely a consequence of the renaming/move.
  • Loading branch information
mih committed Feb 17, 2024
1 parent 5c4d28e commit f5964b9
Show file tree
Hide file tree
Showing 50 changed files with 104 additions and 103 deletions.
47 changes: 23 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ try:

all: mkdocs-site build/context.jsonld

build/context.jsonld: src/linkml/ontology.yaml
build/context.jsonld: src/linkml/schemas/ontology.yaml
mkdir -p build
gen-jsonld-context \
--prefixes \
Expand All @@ -23,22 +23,21 @@ build/context.jsonld: src/linkml/ontology.yaml

build/linkml-docs: \
build/linkml-docs/ontology \
build/linkml-docs/data-access-schema \
build/linkml-docs/datalad-dataset-version-schema
build/linkml-docs/data-access \
build/linkml-docs/datalad-dataset-version
# build/linkml-docs/git-provenance-schema
build/linkml-docs/%: src/linkml/%.yaml src/extra-docs/%
build/linkml-docs/%: src/linkml/schemas/%.yaml src/extra-docs/%-schema
gen-doc \
--mergeimports \
--hierarchical-class-view \
--include-top-level-diagram \
--diagram-type er_diagram \
--metadata \
--format markdown \
--example-directory src/examples/$$(basename $@) \
-d $@ \
--example-directory src/examples/$$(basename $@)-schema \
-d $$([ "$*" = "ontology" ] && echo $@ || echo $@-schema) \
$<
# try to inject any extra-docs (if any exist)
-cp -r src/extra-docs/$$(basename $@)/*.md $@
-cp -r src/extra-docs/$$(basename $@)-schema/*.md $@

build/mkdocs-site: build/linkml-docs src/extra-docs/*.md
# top-level content
Expand All @@ -49,11 +48,11 @@ check: check-models check-validation

# add additional schemas to lint here
check-models: \
check-model-data-access-schema \
check-model-datalad-dataset-version-schema \
check-model-data-access \
check-model-datalad-dataset-version \
check-model-ontology
# check-model-git-provenance-schema
check-model-%: src/linkml/%.yaml
# check-model-git-provenance
check-model-%: src/linkml/schemas/%.yaml
@echo [Check $<]
@echo "Run linter"
@linkml-lint \
Expand All @@ -79,32 +78,32 @@ check-model-%: src/linkml/%.yaml
# respective validation targets, because some tests rely on these
# converted formats
check-validation: \
convert-examples-data-access-schema \
check-validation-data-access-schema \
convert-examples-datalad-dataset-version-schema \
check-validation-datalad-dataset-version-schema \
convert-examples-data-access \
check-validation-data-access \
convert-examples-datalad-dataset-version \
check-validation-datalad-dataset-version \
convert-examples-ontology
# convert-examples-git-provenance-schema
# check-validation-git-provenance-schema
# convert-examples-git-provenance
# check-validation-git-provenance
check-validation-%:
$(MAKE) check-valid-validation-$* check-invalid-validation-$*
check-valid-validation-%: tests/%/validation src/linkml/%.yaml
check-valid-validation-%: tests/%-schema/validation src/linkml/schemas/%.yaml
@for ex in $</*.valid.cfg.yaml; do \
echo "Validate $$ex" ; \
linkml-validate --config "$$ex" ; \
done
check-invalid-validation-%: tests/%/validation src/linkml/%.yaml
check-invalid-validation-%: tests/%-schema/validation src/linkml/schemas/%.yaml
@for ex in $</*.invalid.cfg.yaml; do \
echo "(In)validate $$ex" ; \
linkml-validate --config "$$ex" && UNEXPECTEDLY VALID || true; \
done

convert-examples: \
convert-examples-data-access-schema \
convert-examples-datalad-dataset-version-schema \
convert-examples-data-access \
convert-examples-datalad-dataset-version \
convert-examples-ontology
# convert-examples-git-provenance-schema
convert-examples-%: src/linkml/%.yaml src/examples/%
# convert-examples-git-provenance
convert-examples-%: src/linkml/schemas/%.yaml src/examples/%
# loop over all examples, skip the schema file itself
for ex in $^/*.yaml; do \
[ "$$ex" = "$<" ] && continue; \
Expand Down
File renamed without changes.
21 changes: 0 additions & 21 deletions src/linkml/ontology.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/checksumming
id: https://concepts.datalad.org/ontology/checksumming
name: checksumming
title: Concepts for describing checksums of digital content
description: >
Expand All @@ -13,8 +13,8 @@ prefixes:
spdx: http://spdx.org/rdf/terms#

imports:
- properties
- types
- ../ontology/properties
- ../ontology/types
- linkml:types
default_prefix: dlco

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# models for DataLad datasets

id: https://concepts.datalad.org/datalad-datasets
id: https://concepts.datalad.org/ontology/datalad-datasets
name: datalad-datasets
prefixes:
dlco: https://concepts.datalad.org/ontology/
dcterms: http://purl.org/dc/terms/
rdfs: http://www.w3.org/2000/01/rdf-schema#
imports:
- datasets
- labeling
- meta_utils
- types
- ../ontology/datasets
- ../ontology/labeling
- ../ontology/meta_utils
- ../ontology/types
default_prefix: dlco


Expand Down
9 changes: 5 additions & 4 deletions src/linkml/datalad.yaml → src/linkml/ontology/datalad.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# models for DataLad datasets

id: https://concepts.datalad.org/datalad
id: https://concepts.datalad.org/ontology/datalad
name: datalad
title: DataLad concepts
description: >
Expand All @@ -10,13 +10,13 @@ prefixes:
dcterms: http://purl.org/dc/terms/
rdfs: http://www.w3.org/2000/01/rdf-schema#
imports:
- datasets
- properties
default_prefix: dlco
- ../ontology/datasets
- ../ontology/properties


classes:
DataladDatasetVersion:
class_uri: dlco:DataladDatasetVersion
mixin: true
is_a: Dataset
description: >-
Expand All @@ -26,6 +26,7 @@ classes:
range: DataladDataset

DataladDataset:
class_uri: dlco:DataladDataset
mixin: true
description: >-
Concept class for linking `DataladDatasetVersion` instances.
Expand Down
13 changes: 7 additions & 6 deletions src/linkml/datasets.yaml → src/linkml/ontology/datasets.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/datasets
id: https://concepts.datalad.org/ontology/datasets
name: datasets
title: Concepts for describing datasets
description: >
Expand Down Expand Up @@ -28,11 +28,11 @@ prefixes:
schema: http://schema.org/

imports:
- checksumming
- meta_utils
- properties
- provenance
- types
- ../ontology/checksumming
- ../ontology/meta_utils
- ../ontology/properties
- ../ontology/provenance
- ../ontology/types
- linkml:types
default_prefix: dlco

Expand Down Expand Up @@ -239,6 +239,7 @@ classes:
that cannot be inferred from a standard `DCAT:Distribution`.
DataService:
class_uri: dlco:DataService
mixin: true
description: >-
A collection of operations that provides access to one or more
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/git-annex
id: https://concepts.datalad.org/ontology/git-annex
name: git-annex
title: Git-annex concepts
description: >
Expand All @@ -7,9 +7,9 @@ prefixes:
annex: https://concepts.datalad.org/namespace/annex-uuid/
dlco: https://concepts.datalad.org/ontology/
imports:
- datasets
- git
- properties
- ../ontology/datasets
- ../ontology/git
- ../ontology/properties
default_prefix: dlco


Expand Down
8 changes: 4 additions & 4 deletions src/linkml/git.yaml → src/linkml/ontology/git.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/git
id: https://concepts.datalad.org/ontology/git
name: git
title: Git concepts
description: >
Expand All @@ -7,9 +7,9 @@ prefixes:
gitsha: https://concepts.datalad.org/namespace/gitsha/
dlco: https://concepts.datalad.org/ontology/
imports:
- datasets
- meta_utils
- types
- ../ontology/datasets
- ../ontology/meta_utils
- ../ontology/types
default_prefix: dlco


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/labeling
id: https://concepts.datalad.org/ontology/labeling
name: labeling
title: Utilities for labeling objects
description: >-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/meta_utils
id: https://concepts.datalad.org/ontology/meta_utils
name: meta_utils
title: Utilities for identifying and typing metadata objects
description: >-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/properties
id: https://concepts.datalad.org/ontology/properties
name: properties
title: Common properties
description: >
Expand All @@ -12,7 +12,7 @@ prefixes:
spdx: http://spdx.org/rdf/terms#

imports:
- types
- ../ontology/types
default_prefix: dlco

slots:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/provenance
id: https://concepts.datalad.org/ontology/provenance
name: provenance
title: Concepts for ascribing provenance to entities
description: >-
Expand Down
2 changes: 1 addition & 1 deletion src/linkml/types.yaml → src/linkml/ontology/types.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/types
id: https://concepts.datalad.org/ontology/types
name: types
prefixes:
afo: http://purl.allotrope.org/ontologies/result#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/data-access-schema
id: https://concepts.datalad.org/schemas/data-access
name: data-access-schema
title: Data access schema
description: >-
Expand All @@ -13,8 +13,8 @@ prefixes:
schema: http://schema.org/
linkml: https://w3id.org/linkml/
imports:
- types
- meta_utils
- ../ontology/types
- ../ontology/meta_utils
- linkml:types
default_prefix: dlco

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# models for DataLad datasets

id: https://concepts.datalad.org/datalad-dataset-version-schema
id: https://concepts.datalad.org/schemas/datalad-dataset-version
name: datalad-dataset-version-schema
title: DataLad dataset version schema
description: >-
Expand All @@ -20,8 +20,8 @@ prefixes:
prov: http://www.w3.org/ns/prov#
spdx: http://spdx.org/rdf/terms#
imports:
- datalad
- git-annex
- ../ontology/datalad
- ../ontology/git-annex
default_prefix: dlco

classes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: https://concepts.datalad.org/git-provenance-schema
id: https://concepts.datalad.org/schemas/git-provenance
name: git-provenance-schema
title: Git provenance schema
description: >-
Expand All @@ -14,11 +14,11 @@ prefixes:
linkml: https://w3id.org/linkml/
prov: http://www.w3.org/ns/prov#
imports:
- git
- labeling
- meta_utils
- provenance
- types
- ../ontology/git
- ../ontology/labeling
- ../ontology/meta_utils
- ../ontology/provenance
- ../ontology/types
default_prefix: dlco


Expand Down
21 changes: 21 additions & 0 deletions src/linkml/schemas/ontology.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
id: https://concepts.datalad.org/schemas/ontology
name: datalad-concepts-ontology
title: DataLad Concepts Ontology (DLCO)
description: |-
[DataLad Concepts Ontology](https://concepts.datalad.org) (DLCO)
license: MIT

prefixes:
linkml: https://w3id.org/linkml/
dlco: https://concepts.datalad.org/ontology/

imports:
- ../ontology/checksumming
- ../ontology/datalad
- ../ontology/datasets
- ../ontology/git-annex
- ../ontology/labeling
- ../ontology/meta_utils
- ../ontology/properties
- ../ontology/provenance
- ../ontology/types
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schema: src/linkml/data-access-schema.yaml
schema: src/linkml/schemas/data-access.yaml
target_class: ObjectAvailability
data_sources:
- src/examples/data-access-schema/ObjectAvailability-annexwebdav.yaml
- src/examples/data-access/ObjectAvailability-annexwebdav.yaml
plugins:
JsonschemaValidationPlugin:
closed: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
schema: src/linkml/data-access-schema.yaml
schema: src/linkml/schemas/data-access.yaml
target_class: DataObject
data_sources:
- tests/data-access-schema/validation/GitAnnexSpecialRemote-missing_type.yaml
Expand Down
Loading

0 comments on commit f5964b9

Please sign in to comment.