Skip to content

Commit

Permalink
Merge pull request #47 from psychoinformatics-de/commit-model
Browse files Browse the repository at this point in the history
Model `DataladDataset` as a Git `Commit`
  • Loading branch information
mih authored Feb 25, 2024
2 parents a34cef1 + 82e2a61 commit 2b9867c
Show file tree
Hide file tree
Showing 50 changed files with 343 additions and 416 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
build/
*-stamp
.*.swp
*.rdf
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ build/linkml-docs: \
build/linkml-docs/ontology \
build/linkml-docs/datalad-dataset-components \
build/linkml-docs/datalad-dataset-version
# build/linkml-docs/git-provenance-schema
build/linkml-docs/%: src/linkml/schemas/%.yaml src/extra-docs/%-schema
export OUTDIR=$$([ "$*" = "ontology" ] && echo $@ || echo build/linkml-docs/schemas/$*) && \
gen-doc \
Expand All @@ -52,7 +51,6 @@ check-models: \
check-model-datalad-dataset-components \
check-model-datalad-dataset-version \
check-model-ontology
# check-model-git-provenance
check-model-%: src/linkml/schemas/%.yaml
@echo [Check $<]
@echo "Run linter"
Expand Down Expand Up @@ -84,8 +82,6 @@ check-validation: \
convert-examples-datalad-dataset-version \
check-validation-datalad-dataset-version \
convert-examples-ontology
# convert-examples-git-provenance
# check-validation-git-provenance
check-validation-%:
$(MAKE) check-valid-validation-$* check-invalid-validation-$*
check-valid-validation-%: tests/%-schema/validation src/linkml/schemas/%.yaml
Expand All @@ -103,7 +99,6 @@ convert-examples: \
convert-examples-datalad-dataset-components \
convert-examples-datalad-dataset-version \
convert-examples-ontology
# 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 \
Expand Down
34 changes: 34 additions & 0 deletions patches/jsonschemavalidator_plainyaml.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
See https://github.com/linkml/linkml/issues/1806 for
problem and rationale re this patch
--- jsonschemavalidator.py 2024-02-23 16:19:45.946867800 +0100
+++ jsonschemavalidator.py 2024-02-23 16:18:26.363624044 +0100
@@ -187,7 +187,27 @@
inargs["fmt"] = input_format

try:
- data_as_dict = loader.load_as_dict(source=input, **inargs)
+ if input_format == 'yaml':
+ from io import StringIO
+ from hbreader import FileInfo
+ import os
+ import yaml
+ metadata = FileInfo()
+ data = loader._read_source(
+ input,
+ metadata=metadata,
+ accept_header="text/yaml, application/yaml;q=0.9",
+ )
+ if isinstance(data, str):
+ data = StringIO(data)
+ if metadata and metadata.source_file:
+ data.name = os.path.relpath(metadata.source_file,
+ metadata.base_path)
+ data_as_dict = yaml.load(data, yaml.BaseLoader)
+ else:
+ data_as_dict = data
+ else:
+ data_as_dict = loader.load_as_dict(source=input, **inargs)
except NotImplementedError:
obj = loader.load(source=input, target_class=py_target_class, **inargs)
data_as_dict = as_simple_dict(obj)

22 changes: 22 additions & 0 deletions patches/rdflib_dumper_canonical.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Make linkml-convert produce deterministic RDF output.
See https://github.com/linkml/linkml/issues/1943 for details
and caveats
--- rdflib_dumper.py 2024-02-24 07:36:07.532183567 +0100
+++ rdflib_dumper.py 2024-02-24 07:36:26.279874637 +0100
@@ -6,6 +6,7 @@

from curies import Converter
from rdflib import Graph, URIRef, XSD
+from rdflib.compare import to_canonical_graph
from rdflib.term import Node, BNode, Literal
from rdflib.namespace import RDF

@@ -66,7 +67,7 @@
if schemaview.namespaces()._base:
g.base = schemaview.namespaces()._base
self.inject_triples(element, schemaview, g)
- return g
+ return to_canonical_graph(g)

def inject_triples(self, element: Any, schemaview: SchemaView, graph: Graph, target_type: ElementName = None) -> Node:
"""

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
{
"meta_id": "gitsha:558275f650574389dcbbf7cd8ab5046482473fc8",
"meta_type": "dlccs:DataladDatasetVersionSE",
"is_version_of": "datalad:0b76362c-aa27-11ee-be29-b3b123281259"
"gitsha": "558275f650574389dcbbf7cd8ab5046482473fc8",
"is_version_of": "datalad:0b76362c-aa27-11ee-be29-b3b123281259",
"was_generated_by": {
"was_associated_with": {
"name": "Jane Doe",
"email": "[email protected]"
}
}
}
],
"@type": "ContainerSE"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ components:
uuid: 0b76362c-aa27-11ee-be29-b3b123281259
- meta_id: gitsha:558275f650574389dcbbf7cd8ab5046482473fc8
meta_type: dlccs:DataladDatasetVersionSE
gitsha: 558275f650574389dcbbf7cd8ab5046482473fc8
is_version_of: datalad:0b76362c-aa27-11ee-be29-b3b123281259
was_generated_by:
was_associated_with:
name: Jane Doe
email: [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"meta_id": "gitsha:558275f650574389dcbbf7cd8ab5046482473fc8",
"meta_type": "dlccs:DataladDatasetVersionSE",
"gitsha": "558275f650574389dcbbf7cd8ab5046482473fc8",
"has_annex_remote": [
"annex:7e0bf3e7-7d46-4093-813e-b4009826c3bf"
],
Expand All @@ -25,7 +26,13 @@
"relation": "gitsha:b94ef1797f7bfc1ac979be122e1b538bbb0d1d58",
"at_location": "subdir/data.bin"
}
]
],
"was_generated_by": {
"was_associated_with": {
"name": "Jane Doe",
"email": "[email protected]"
}
}
},
{
"meta_id": "gitsha:56094a33cf330fef5b375aa813fc4dc07147729f",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ components:
# dataset version
- meta_id: gitsha:558275f650574389dcbbf7cd8ab5046482473fc8
meta_type: dlccs:DataladDatasetVersionSE
gitsha: 558275f650574389dcbbf7cd8ab5046482473fc8
was_generated_by:
was_associated_with:
name: Jane Doe
email: [email protected]
is_version_of: datalad:0b76362c-aa27-11ee-be29-b3b123281259
has_annex_remote:
- annex:7e0bf3e7-7d46-4093-813e-b4009826c3bf
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"meta_id": "gitsha:558275f650574389dcbbf7cd8ab5046482473fc8",
"meta_type": "dlccs:DataladDatasetVersionSE",
"gitsha": "558275f650574389dcbbf7cd8ab5046482473fc8",
"was_derived_from": [
"gitsha:a52963ce19a3e3628e9976555ffc8c422b29f054"
],
"was_generated_by": {
"was_associated_with": {
"name": "Jane Doe",
"email": "[email protected]"
},
"was_informed_by": {
"was_associated_with": {
"name": "Jane Doe",
"email": "[email protected]"
}
}
},
"description": "This message describes the changes done for this particular Dataset version.\n",
"@type": "DataladDatasetVersionSE"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
meta_id: gitsha:558275f650574389dcbbf7cd8ab5046482473fc8
meta_type: dlccs:DataladDatasetVersionSE
gitsha: 558275f650574389dcbbf7cd8ab5046482473fc8
description: >
This message describes the changes done for this particular
Dataset version.
was_derived_from:
- gitsha:a52963ce19a3e3628e9976555ffc8c422b29f054
was_generated_by:
# we cannot declare a datetime here, without causing validation
# issues: https://github.com/linkml/linkml/issues/1806
#ended_at: 2002-05-30T09:30:10+06:00
was_associated_with:
name: Jane Doe
email: [email protected]
was_informed_by:
# we cannot declare a datetime here, without causing validation
# issues: https://github.com/linkml/linkml/issues/1806
#ended_at: 2001-02-28T18:27:04+02:00
was_associated_with:
name: Jane Doe
email: [email protected]

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"is_version_of": {
"uuid": "0b76362c-aa27-11ee-be29-b3b123281259"
},
"gitsha": "558275f650574389dcbbf7cd8ab5046482473fc8",
"has_annex_remote": {
"annex:7e0bf3e7-7d46-4093-813e-b4009826c3bf": {
"meta_id": "annex:7e0bf3e7-7d46-4093-813e-b4009826c3bf",
Expand Down Expand Up @@ -32,5 +33,11 @@
"at_location": "README.txt"
}
],
"was_generated_by": {
"was_associated_with": {
"name": "Jane Doe",
"email": "[email protected]"
}
},
"@type": "DataladDatasetVersionSE"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
gitsha: 558275f650574389dcbbf7cd8ab5046482473fc8
was_generated_by:
was_associated_with:
name: Jane Doe
email: [email protected]
is_version_of:
uuid: 0b76362c-aa27-11ee-be29-b3b123281259
has_annex_remote:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
"is_version_of": {
"uuid": "0b76362c-aa27-11ee-be29-b3b123281259"
},
"gitsha": "558275f650574389dcbbf7cd8ab5046482473fc8",
"was_generated_by": {
"was_associated_with": {
"name": "Jane Doe",
"email": "[email protected]"
}
},
"@type": "DataladDatasetVersionSE"
}

This file was deleted.

Loading

0 comments on commit 2b9867c

Please sign in to comment.