Skip to content

Commit

Permalink
With conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
vladistan committed Nov 2, 2024
1 parent ad9df36 commit 37654cd
Show file tree
Hide file tree
Showing 39 changed files with 365 additions and 181 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"words": [
"absolufy",
"ucum",
"rdfx",
"SPARQL",
"boto",
"awslogs",
Expand Down
57 changes: 17 additions & 40 deletions data_model/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PYPROJ = python/$(subst -,_,$(SCHEMA_NAME))
PYTHON_DATACLASS = $(PYPROJ)/dataclass.py
DOCDIR = docs
DOCTEMPLATES = templates
EXAMPLEDIR = data/examples/
EXAMPLEDIR = data/examples

CONFIG_YAML = --config-file config.yaml

Expand Down Expand Up @@ -158,38 +158,8 @@ else
$(info Ok)
endif

VALID_YML_FILES := $(wildcard $(EXAMPLEDIR)/valid/*.yml)
VALID_TTL_FILES := $(patsubst $(EXAMPLEDIR)/valid/%.yml,$(EXAMPLEDIR)/valid/%.ttl,$(VALID_YML_FILES))
VALID_NT_FILES := $(patsubst $(EXAMPLEDIR)/valid/%.ttl,$(EXAMPLEDIR)/valid/%.nt,$(VALID_TTL_FILES))
VALID_JSON_FILES := $(patsubst $(EXAMPLEDIR)/valid/%.yml,$(EXAMPLEDIR)/valid/%.json,$(VALID_YML_FILES))
VALID_JSON_LD_FILES := $(patsubst $(EXAMPLEDIR)/valid/%.yml,$(EXAMPLEDIR)/valid/%.ld.json,$(VALID_YML_FILES))

$(EXAMPLEDIR)/valid/%.ttl: $(EXAMPLEDIR)/valid/%.yml $(PYTHON_DATACLASS) $(SCHEMAS)
$(RUN) linkml-convert -t ttl \
-m $(PYTHON_DATACLASS) \
--target-class-from-path \
-s $(SOURCE_SCHEMA_PATH) \
-o $@ $<

$(EXAMPLEDIR)/valid/%.json: $(EXAMPLEDIR)/valid/%.yml
$(RUN) linkml-convert -t json \
-m $(PYTHON_DATACLASS) \
--target-class-from-path \
-s $(SOURCE_SCHEMA_PATH) \
-o $@ $<

$(EXAMPLEDIR)/valid/%.ld.json: $(EXAMPLEDIR)/valid/%.yml
$(RUN) linkml-convert -t json-ld \
-m $(PYTHON_DATACLASS) \
--target-class-from-path \
-s $(SOURCE_SCHEMA_PATH) \
-o $@ $<


convert-valid-yml-to-ttl: $(VALID_TTL_FILES) $(SCHEMAS) $(PYTHON_DATACLASS)
convert-valid-yml-to-nt: $(VALID_NT_FILES) $(SCHEMAS) $(PYTHON_DATACLASS)
convert-valid-yml-to-json: $(VALID_JSON_FILES) $(SCHEMAS) $(PYTHON_DATACLASS)
convert-valid-yml-to-json-ld: $(VALID_JSON_LD_FILES) $(SCHEMAS) $(PYTHON_DATACLASS)
convert-valid-ttl-to-nt: $(VALID_NT_FILES) $(SCHEMAS) $(PYTHON_DATACLASS)

docs/%.svg: schema/%.yaml
$(RUN) gen-plantuml \
Expand All @@ -201,19 +171,26 @@ docs/erd.mermaid: schema/$(SCHEMA_NAME).yaml
$< > $@
# --exclude-attributes \

.PHONY: convert-valid-yml-to-ttl convert-valid-yml-to-json convert-valid-yml-to-json-ld

gen-examples: $(VALID_TTL_FILES) $(VALID_JSON_FILES) $(VALID_JSON_LD_FILES)

examples/output:
mkdir -p $@
.PHONY: gen-examples
gen-examples:
mkdir -p $(EXAMPLEDIR)/output
$(RUN) linkml-run-examples \
--output-formats json \
--output-formats yaml \
--counter-example-input-directory data/examples/invalid \
--input-directory data/examples/valid \
--output-directory $@ \
--schema $< > $@/README.md
--output-formats ttl \
--counter-example-input-directory $(EXAMPLEDIR)/invalid \
--input-directory $(EXAMPLEDIR)/valid \
--output-directory $(EXAMPLEDIR)/output \
--schema schema/$(SCHEMA_NAME).yaml > $(EXAMPLEDIR)/output/README.md
cd $(EXAMPLEDIR)/output && \
for f in *.ttl; do \
rdfx convert "$$f" --format nt > "$${f%.ttl}.nt"; \
done




# Test documentation locally
serve: testdoc
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions data_model/data/examples/invalid/Item-001.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example data object
---
id: "cryd:item-02"
5 changes: 5 additions & 0 deletions data_model/data/examples/output/Item-001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "cryd:item-01",
"label": "file-1",
"@type": "Item"
}
2 changes: 2 additions & 0 deletions data_model/data/examples/output/Item-001.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<https://crystalia.link/data/item-01> <http://www.w3.org/2000/01/rdf-schema#label> "file-1" .
<https://crystalia.link/data/item-01> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/crystalia/Item> .
7 changes: 7 additions & 0 deletions data_model/data/examples/output/Item-001.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@prefix cryd: <https://crystalia.link/data/> .
@prefix crys: <https://w3id.org/crystalia/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

cryd:item-01 a crys:Item ;
rdfs:label "file-1" .

2 changes: 2 additions & 0 deletions data_model/data/examples/output/Item-001.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id: cryd:item-01
label: file-1
7 changes: 7 additions & 0 deletions data_model/data/examples/output/Method-MD5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "cryd:method-md5",
"label": "MD5",
"robustness": "VERY_HIGH",
"comment": "MD5 is a widely used hash algorithm that generates a 128-bit hash value from a variable-length input. It is known for its speed and efficiency, making it suitable for various applications, including digital signatures and checksums.",
"@type": "Method"
}
4 changes: 4 additions & 0 deletions data_model/data/examples/output/Method-MD5.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<https://crystalia.link/data/method-md5> <http://www.w3.org/2000/01/rdf-schema#comment> "MD5 is a widely used hash algorithm that generates a 128-bit hash value from a variable-length input. It is known for its speed and efficiency, making it suitable for various applications, including digital signatures and checksums." .
<https://crystalia.link/data/method-md5> <http://www.w3.org/2000/01/rdf-schema#label> "MD5" .
<https://crystalia.link/data/method-md5> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/crystalia/Method> .
<https://crystalia.link/data/method-md5> <https://w3id.org/crystalia/robustness> "VERY_HIGH" .
9 changes: 9 additions & 0 deletions data_model/data/examples/output/Method-MD5.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@prefix cryd: <https://crystalia.link/data/> .
@prefix crys: <https://w3id.org/crystalia/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

cryd:method-md5 a crys:Method ;
rdfs:label "MD5" ;
rdfs:comment "MD5 is a widely used hash algorithm that generates a 128-bit hash value from a variable-length input. It is known for its speed and efficiency, making it suitable for various applications, including digital signatures and checksums." ;
crys:robustness "VERY_HIGH" .

6 changes: 6 additions & 0 deletions data_model/data/examples/output/Method-MD5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id: cryd:method-md5
label: MD5
robustness: VERY_HIGH
comment: MD5 is a widely used hash algorithm that generates a 128-bit hash value from
a variable-length input. It is known for its speed and efficiency, making it suitable
for various applications, including digital signatures and checksums.
7 changes: 7 additions & 0 deletions data_model/data/examples/output/Method-SHA1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "cryd:method-sha1",
"label": "SHA1",
"robustness": "EXTREMELY_HIGH",
"comment": "SHA1 is a widely used hash algorithm that generates a 160-bit hash value from a variable-length input. It is known for its speed and efficiency, making it suitable for various applications, including digital signatures and checksums.",
"@type": "Method"
}
4 changes: 4 additions & 0 deletions data_model/data/examples/output/Method-SHA1.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<https://crystalia.link/data/method-sha1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/crystalia/Method> .
<https://crystalia.link/data/method-sha1> <http://www.w3.org/2000/01/rdf-schema#label> "SHA1" .
<https://crystalia.link/data/method-sha1> <http://www.w3.org/2000/01/rdf-schema#comment> "SHA1 is a widely used hash algorithm that generates a 160-bit hash value from a variable-length input. It is known for its speed and efficiency, making it suitable for various applications, including digital signatures and checksums." .
<https://crystalia.link/data/method-sha1> <https://w3id.org/crystalia/robustness> "EXTREMELY_HIGH" .
9 changes: 9 additions & 0 deletions data_model/data/examples/output/Method-SHA1.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@prefix cryd: <https://crystalia.link/data/> .
@prefix crys: <https://w3id.org/crystalia/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

cryd:method-sha1 a crys:Method ;
rdfs:label "SHA1" ;
rdfs:comment "SHA1 is a widely used hash algorithm that generates a 160-bit hash value from a variable-length input. It is known for its speed and efficiency, making it suitable for various applications, including digital signatures and checksums." ;
crys:robustness "EXTREMELY_HIGH" .

6 changes: 6 additions & 0 deletions data_model/data/examples/output/Method-SHA1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id: cryd:method-sha1
label: SHA1
robustness: EXTREMELY_HIGH
comment: SHA1 is a widely used hash algorithm that generates a 160-bit hash value
from a variable-length input. It is known for its speed and efficiency, making it
suitable for various applications, including digital signatures and checksums.
7 changes: 7 additions & 0 deletions data_model/data/examples/output/Method-SHA256.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "cryd:method-sha256",
"label": "SHA256",
"robustness": "EXTREMELY_HIGH",
"comment": "SHA256 is a widely used hash algorithm that generates a 256-bit hash value from a variable-length input. The long signature makes it more resilient against forgery attempts compared to hash algorithms with shorter signatures.",
"@type": "Method"
}
4 changes: 4 additions & 0 deletions data_model/data/examples/output/Method-SHA256.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<https://crystalia.link/data/method-sha256> <http://www.w3.org/2000/01/rdf-schema#comment> "SHA256 is a widely used hash algorithm that generates a 256-bit hash value from a variable-length input. The long signature makes it more resilient against forgery attempts compared to hash algorithms with shorter signatures." .
<https://crystalia.link/data/method-sha256> <https://w3id.org/crystalia/robustness> "EXTREMELY_HIGH" .
<https://crystalia.link/data/method-sha256> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/crystalia/Method> .
<https://crystalia.link/data/method-sha256> <http://www.w3.org/2000/01/rdf-schema#label> "SHA256" .
9 changes: 9 additions & 0 deletions data_model/data/examples/output/Method-SHA256.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@prefix cryd: <https://crystalia.link/data/> .
@prefix crys: <https://w3id.org/crystalia/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

cryd:method-sha256 a crys:Method ;
rdfs:label "SHA256" ;
rdfs:comment "SHA256 is a widely used hash algorithm that generates a 256-bit hash value from a variable-length input. The long signature makes it more resilient against forgery attempts compared to hash algorithms with shorter signatures." ;
crys:robustness "EXTREMELY_HIGH" .

6 changes: 6 additions & 0 deletions data_model/data/examples/output/Method-SHA256.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id: cryd:method-sha256
label: SHA256
robustness: EXTREMELY_HIGH
comment: SHA256 is a widely used hash algorithm that generates a 256-bit hash value
from a variable-length input. The long signature makes it more resilient against
forgery attempts compared to hash algorithms with shorter signatures.
46 changes: 46 additions & 0 deletions data_model/data/examples/output/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Item-001
### Input
```yaml
id: cryd:item-01
label: file-1

```
## Method-MD5
### Input
```yaml
comment: MD5 is a widely used hash algorithm that generates a 128-bit hash value from
a variable-length input. It is known for its speed and efficiency, making it suitable
for various applications, including digital signatures and checksums.
id: cryd:method-md5
label: MD5
robustness: VERY_HIGH

```
## Method-SHA1
### Input
```yaml
comment: SHA1 is a widely used hash algorithm that generates a 160-bit hash value
from a variable-length input. It is known for its speed and efficiency, making it
suitable for various applications, including digital signatures and checksums.
id: cryd:method-sha1
label: SHA1
robustness: EXTREMELY_HIGH

```
## Method-SHA256
### Input
```yaml
comment: SHA256 is a widely used hash algorithm that generates a 256-bit hash value
from a variable-length input. The long signature makes it more resilient against
forgery attempts compared to hash algorithms with shorter signatures.
id: cryd:method-sha256
label: SHA256
robustness: EXTREMELY_HIGH

```
## Item-001
### Input
```yaml
id: cryd:item-02

```
4 changes: 4 additions & 0 deletions data_model/data/examples/valid/Item-001.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Example data object
---
id: "cryd:item-01"
label: "file-1"
8 changes: 8 additions & 0 deletions data_model/data/examples/valid/Method-MD5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
id: "cryd:method-md5"
label: "MD5"
robustness: "VERY_HIGH"
comment: >-
MD5 is a widely used hash algorithm that generates a 128-bit hash value from a
variable-length input. It is known for its speed and efficiency, making it
suitable for various applications, including digital signatures and checksums.
8 changes: 8 additions & 0 deletions data_model/data/examples/valid/Method-SHA1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
id: "cryd:method-sha1"
label: "SHA1"
robustness: "EXTREMELY_HIGH"
comment: >-
SHA1 is a widely used hash algorithm that generates a 160-bit hash value from a
variable-length input. It is known for its speed and efficiency, making it
suitable for various applications, including digital signatures and checksums.
8 changes: 8 additions & 0 deletions data_model/data/examples/valid/Method-SHA256.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
id: "cryd:method-sha256"
label: "SHA256"
robustness: "EXTREMELY_HIGH"
comment: >-
SHA256 is a widely used hash algorithm that generates a 256-bit hash value from a
variable-length input. The long signature makes it more resilient against forgery
attempts compared to hash algorithms with shorter signatures.
6 changes: 0 additions & 6 deletions data_model/examples/valid/Item-001.yaml

This file was deleted.

Binary file modified data_model/project/excel/crystalia.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion data_model/project/jsonld/crystalia.context.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
},
"comments": {
"description": "Auto generated by LinkML jsonld context generator",
"generation_date": "2024-11-01T09:46:37",
"generation_date": "2024-11-01T21:07:55",
"source": "crystalia.yaml"
}
}
6 changes: 3 additions & 3 deletions data_model/project/jsonld/crystalia.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
]
}
],
"generation_date": "2024-11-01T09:46:37",
"generation_date": "2024-11-01T21:07:55",
"id": "https://w3id.org/crystalia",
"imports": [
"linkml:types"
Expand Down Expand Up @@ -424,8 +424,8 @@
}
],
"source_file": "crystalia.yaml",
"source_file_date": "2024-10-31T23:12:00",
"source_file_size": 4339,
"source_file_date": "2024-11-01T14:43:36",
"source_file_size": 4337,
"title": "Crystalia Data Model",
"types": [
{
Expand Down
Loading

0 comments on commit 37654cd

Please sign in to comment.