shacl2code 0.0.7__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {shacl2code-0.0.7 → shacl2code-0.0.9}/PKG-INFO +1 -1
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/lang/templates/jsonschema.j2 +28 -11
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/lang/templates/python.j2 +358 -233
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/model.py +26 -21
- shacl2code-0.0.9/src/shacl2code/version.py +1 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/model/test-context.json +4 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/model/test.ttl +42 -1
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/python/roundtrip.json +6 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/expect/jsonschema/test-context.json +225 -75
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/expect/jsonschema/test.json +225 -75
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/expect/python/test-context.py +477 -371
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/expect/python/test.py +474 -343
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/expect/raw/test-context.txt +4 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/expect/raw/test.txt +16 -14
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/test_jsonschema.py +106 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/test_python.py +173 -119
- shacl2code-0.0.7/src/shacl2code/version.py +0 -1
- {shacl2code-0.0.7 → shacl2code-0.0.9}/.flake8 +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/.github/workflows/coverage-generate.yaml +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/.github/workflows/coverage-report.yaml +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/.github/workflows/publish.yaml +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/.github/workflows/test.yaml +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/.gitignore +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/LICENSE +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/README.md +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/pyproject.toml +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/__init__.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/__main__.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/context.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/lang/__init__.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/lang/common.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/lang/jinja.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/lang/jsonschema.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/lang/lang.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/lang/python.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/main.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/src/shacl2code/urlcontext.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/conftest.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/abort.j2 +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/bad-id.j2 +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/bad-node-kind.ttl +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/bad-pattern-class.ttl +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/bad-pattern-integer.ttl +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/bad-reference.jsonld +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/context-url.j2 +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/context.j2 +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/missing-range.ttl +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/python/links.json +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/data/raw.j2 +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/expect/make_expect.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/test_cli.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/test_common_jinja.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/test_common_prefix.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/test_context.py +0 -0
- {shacl2code-0.0.7 → shacl2code-0.0.9}/tests/test_model_source.py +0 -0
|
@@ -60,9 +60,19 @@
|
|
|
60
60
|
"{{ varname(class.clsname) }}": {
|
|
61
61
|
"allOf": [
|
|
62
62
|
{
|
|
63
|
+
{%- if class.extensible %}
|
|
64
|
+
"unevaluatedProperties": true,
|
|
65
|
+
{%- endif %}
|
|
63
66
|
"properties": {
|
|
64
67
|
"{{ class.id_property or "@id" }}": { "$ref": "#/$defs/{{ class.node_kind.split("#")[-1] }}" },
|
|
65
|
-
"{{ context.compact("@type") }}": {
|
|
68
|
+
"{{ context.compact("@type") }}": {
|
|
69
|
+
"oneOf": [
|
|
70
|
+
{%- if class.extensible %}
|
|
71
|
+
{ "$ref": "#/$defs/IRI" },
|
|
72
|
+
{%- endif %}
|
|
73
|
+
{ "const": "{{ context.compact_vocab(class._id) }}" }
|
|
74
|
+
]
|
|
75
|
+
}
|
|
66
76
|
}{%- if class.node_kind == SH.IRI %},
|
|
67
77
|
"required": ["{{ class.id_property or "@id" }}"]
|
|
68
78
|
{%- endif %}
|
|
@@ -71,6 +81,9 @@
|
|
|
71
81
|
]
|
|
72
82
|
},
|
|
73
83
|
"{{ varname(class.clsname) }}_derived": {
|
|
84
|
+
{%- if not class.extensible %}
|
|
85
|
+
"unevaluatedProperties": false,
|
|
86
|
+
{%- endif %}
|
|
74
87
|
{%- set ns = namespace(external_ref=False, local_ref=False, any_ref=False, json_refs=[]) %}
|
|
75
88
|
{%- for d in get_all_derived(class) + [class._id] %}
|
|
76
89
|
{%- set ns.json_refs = ns.json_refs + ["#/$defs/" + varname(classes.get(d).clsname)] %}
|
|
@@ -80,13 +93,12 @@
|
|
|
80
93
|
{%- if ns.json_refs | length == 1 %}
|
|
81
94
|
"$ref": "{{ ns.json_refs[0] }}",
|
|
82
95
|
{%- elif ns.json_refs %}
|
|
83
|
-
"
|
|
96
|
+
"anyOf": [
|
|
84
97
|
{%- for r in ns.json_refs %}
|
|
85
98
|
{ "$ref": "{{ r }}" }{% if not loop.last %},{% endif %}
|
|
86
99
|
{%- endfor %}
|
|
87
|
-
]
|
|
100
|
+
]
|
|
88
101
|
{%- endif %}
|
|
89
|
-
"unevaluatedProperties": false
|
|
90
102
|
},
|
|
91
103
|
"{{ varname(class.clsname) }}_props": {
|
|
92
104
|
"allOf": [
|
|
@@ -213,11 +225,11 @@
|
|
|
213
225
|
{%- endfor %}
|
|
214
226
|
"IRI": {
|
|
215
227
|
"type": "string",
|
|
216
|
-
"pattern": "^(?!_:)
|
|
228
|
+
"pattern": "^(?!_:).+:.+"
|
|
217
229
|
},
|
|
218
230
|
"BlankNode": {
|
|
219
231
|
"type": "string",
|
|
220
|
-
"pattern": "^_
|
|
232
|
+
"pattern": "^_:.+"
|
|
221
233
|
},
|
|
222
234
|
"BlankNodeOrIRI": {
|
|
223
235
|
"oneOf": [
|
|
@@ -244,17 +256,22 @@
|
|
|
244
256
|
"type": "object",
|
|
245
257
|
"properties": {
|
|
246
258
|
"{{ context.compact("@type") }}": {
|
|
247
|
-
"
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
259
|
+
"oneOf": [
|
|
260
|
+
{ "$ref": "#/$defs/IRI" },
|
|
261
|
+
{
|
|
262
|
+
"enum": [
|
|
263
|
+
{%- for class in classes %}
|
|
264
|
+
"{{ context.compact_vocab(class._id) }}"{% if not loop.last %},{% endif %}
|
|
265
|
+
{%- endfor %}
|
|
266
|
+
]
|
|
267
|
+
}
|
|
251
268
|
]
|
|
252
269
|
}
|
|
253
270
|
},
|
|
254
271
|
"required": ["{{ context.compact("@type") }}"]
|
|
255
272
|
},
|
|
256
273
|
"AnyClass": {
|
|
257
|
-
"
|
|
274
|
+
"anyOf": [
|
|
258
275
|
{%- for class in classes %}
|
|
259
276
|
{ "$ref": "#/$defs/{{ varname(class.clsname) }}" }{% if not loop.last %},{% endif %}
|
|
260
277
|
{%- endfor %}
|