shacl2code 0.0.22__tar.gz → 0.0.23__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.22 → shacl2code-0.0.23}/PKG-INFO +1 -1
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/jsonschema.j2 +67 -51
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/python.j2 +18 -12
- shacl2code-0.0.23/src/shacl2code/version.py +1 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/test_python.py +1 -0
- shacl2code-0.0.22/src/shacl2code/version.py +0 -1
- {shacl2code-0.0.22 → shacl2code-0.0.23}/.flake8 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/.github/workflows/coverage-generate.yaml +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/.github/workflows/coverage-report.yaml +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/.github/workflows/publish.yaml +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/.github/workflows/scorecard.yml +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/.github/workflows/test.yaml +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/.gitignore +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/LICENSE +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/README.md +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/SECURITY.md +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/pyproject.toml +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/__init__.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/__main__.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/context.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/__init__.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/common.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/cpp.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/golang.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/jinja.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/jsonschema.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/lang.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/python.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/sources/cpp/json.hpp +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/Doxyfile.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/Makefile.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/api.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/datetime.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/datetime.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/decode.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/decode.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/encode.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/encode.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/errorhandler.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/errorhandler.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/exceptions.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/extensible.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/extensible.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/header.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/jsonld-header.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/jsonld-source.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/link.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/link.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/namedindividual.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/namedindividual.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/object.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/object.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/objectpath.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/objectpath.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/objectset.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/objectset.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/pkgconfig.pc.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/prop.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/property.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/property.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/propertyvalue.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/propertyvalue.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/ref.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/refproperty.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/refproperty.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/source.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/type.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/type.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/util.cpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/util.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/validate.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/walk.hpp.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/classes.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/decode.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/encode.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/errorhandler.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/errors.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/extensible.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/linkstate.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/listproperty.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/optional.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/path.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/property.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/ref.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/reflistproperty.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/refproperty.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/shaclobject.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/shaclobjectset.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/shacltype.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/util.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/validator.go.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/main.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/model.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/urlcontext.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/testfixtures/testfixtures/__init__.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/testfixtures/testfixtures/httpserver.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/testfixtures/testfixtures/jsonvalidation.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/testfixtures/testfixtures/timetests.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/testfixtures/testfixtures/utils.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/conftest.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/abort.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/bad-id.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/bad-node-kind.ttl +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/bad-pattern-class.ttl +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/bad-pattern-integer.ttl +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/bad-prop-type.ttl +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/bad-reference.jsonld +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/context-url.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/context.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/links.json +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/missing-range.ttl +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/model/test-context.json +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/model/test.ttl +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/python/bad-object-type-inline.json +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/python/bad-object-type-ref-after.json +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/python/bad-object-type-ref-before.json +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/raw.j2 +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/data/roundtrip.json +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/test_cli.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/test_common_jinja.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/test_common_prefix.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/test_context.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/test_cpp.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/test_golang.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/test_jsonschema.py +0 -0
- {shacl2code-0.0.22 → shacl2code-0.0.23}/tests/test_model_source.py +0 -0
|
@@ -34,24 +34,28 @@
|
|
|
34
34
|
"required": ["@context"],
|
|
35
35
|
{%- endif %}
|
|
36
36
|
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
"if": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"required": ["@graph"]
|
|
40
|
+
},
|
|
41
|
+
"then": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"@graph": {
|
|
45
|
+
"description": "Top level container for JSON-LD objects",
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"$ref": "#/$defs/AnyClass",
|
|
50
|
+
"unevaluatedProperties": false
|
|
49
51
|
}
|
|
50
|
-
}
|
|
51
|
-
"required": ["@graph"]
|
|
52
|
+
}
|
|
52
53
|
},
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
"required": ["@graph"]
|
|
55
|
+
},
|
|
56
|
+
"else": {
|
|
57
|
+
"$ref": "#/$defs/AnyClass"
|
|
58
|
+
},
|
|
55
59
|
"unevaluatedProperties": false,
|
|
56
60
|
|
|
57
61
|
"$defs": {
|
|
@@ -61,39 +65,51 @@
|
|
|
61
65
|
{#- @type tag #}
|
|
62
66
|
{%- if not class.is_abstract or class.is_extensible %}
|
|
63
67
|
"{{ varname(*class.clsname) }}": {
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{
|
|
68
|
-
|
|
69
|
-
{%-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
]
|
|
82
|
-
{%- else %}
|
|
83
|
-
"oneOf": [
|
|
84
|
-
{%- if class.is_extensible %}
|
|
85
|
-
{ "$ref": "#/$defs/IRI" },
|
|
86
|
-
{%- endif %}
|
|
87
|
-
{ "const": "{{ context.compact_vocab(class._id) }}" }
|
|
88
|
-
]
|
|
89
|
-
{%- endif %}
|
|
90
|
-
}
|
|
91
|
-
}{%- if class.node_kind == SH.IRI %},
|
|
92
|
-
"required": ["{{ class.id_property or "@id" }}"]
|
|
68
|
+
"if": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"properties": {
|
|
71
|
+
"{{ context.compact_iri("@type") }}": {
|
|
72
|
+
{#- Abstract Extensible classes are weird; any type _except_ the specific class type is allowed #}
|
|
73
|
+
{%- if class.is_abstract and class.is_extensible %}
|
|
74
|
+
"allOf": [
|
|
75
|
+
{ "$ref": "#/$defs/IRI" },
|
|
76
|
+
{ "not": { "const": "{{ context.compact_vocab(class._id) }}" } }
|
|
77
|
+
]
|
|
78
|
+
{%- elif class.is_extensible %}
|
|
79
|
+
"anyOf": [
|
|
80
|
+
{ "$ref": "#/$defs/IRI" },
|
|
81
|
+
{ "const": "{{ context.compact_vocab(class._id) }}" }
|
|
82
|
+
]
|
|
83
|
+
{%- else %}
|
|
84
|
+
"const": "{{ context.compact_vocab(class._id) }}"
|
|
93
85
|
{%- endif %}
|
|
86
|
+
}
|
|
94
87
|
},
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
"required": ["{{ context.compact_iri("@type") }}"]
|
|
89
|
+
},
|
|
90
|
+
"then": {
|
|
91
|
+
"allOf": [
|
|
92
|
+
{
|
|
93
|
+
"type": "object",
|
|
94
|
+
{%- if class.deprecated %}
|
|
95
|
+
"deprecated": true,
|
|
96
|
+
{%- endif %}
|
|
97
|
+
{%- if class.is_extensible %}
|
|
98
|
+
"unevaluatedProperties": true,
|
|
99
|
+
{%- endif %}
|
|
100
|
+
"properties": {
|
|
101
|
+
"{{ class.id_property or "@id" }}": { "$ref": "#/$defs/{{ class.node_kind.split("#")[-1] }}" },
|
|
102
|
+
"{{ context.compact_iri("@type") }}": { "type": "string" }
|
|
103
|
+
}{%- if class.node_kind == SH.IRI %},
|
|
104
|
+
"required": ["{{ class.id_property or "@id" }}"]
|
|
105
|
+
{%- endif %}
|
|
106
|
+
},
|
|
107
|
+
{ "$ref": "#/$defs/{{ varname(*class.clsname) }}_props" }
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"else": {
|
|
111
|
+
"const": "Not a {{ varname(*class.clsname) }}"
|
|
112
|
+
}
|
|
97
113
|
},
|
|
98
114
|
{%- endif %}
|
|
99
115
|
"{{ varname(*class.clsname) }}_derived": {
|
|
@@ -151,7 +167,7 @@
|
|
|
151
167
|
"{{ context.compact_vocab(prop.path) }}": {
|
|
152
168
|
{%- set prop_ref = "#/$defs/prop_" + varname(*class.clsname) + "_" + varname(prop.varname) %}
|
|
153
169
|
{%- if is_list %}
|
|
154
|
-
"
|
|
170
|
+
"anyOf": [
|
|
155
171
|
{
|
|
156
172
|
"type": "array",
|
|
157
173
|
{%- if prop.max_count is not none %}
|
|
@@ -241,7 +257,7 @@
|
|
|
241
257
|
{%- elif prop.datatype == "http://www.w3.org/2001/XMLSchema#boolean" %}
|
|
242
258
|
"type": "boolean"
|
|
243
259
|
{%- elif prop.datatype == "http://www.w3.org/2001/XMLSchema#decimal" %}
|
|
244
|
-
"
|
|
260
|
+
"anyOf": [
|
|
245
261
|
{
|
|
246
262
|
"type": "number"
|
|
247
263
|
},
|
|
@@ -266,7 +282,7 @@
|
|
|
266
282
|
"pattern": "^_:.+"
|
|
267
283
|
},
|
|
268
284
|
"BlankNodeOrIRI": {
|
|
269
|
-
"
|
|
285
|
+
"anyOf": [
|
|
270
286
|
{ "$ref": "#/$defs/IRI" },
|
|
271
287
|
{ "$ref": "#/$defs/BlankNode" }
|
|
272
288
|
]
|
|
@@ -278,7 +294,7 @@
|
|
|
278
294
|
"type": "object",
|
|
279
295
|
"properties": {
|
|
280
296
|
"{{ context.compact_iri("@type") }}": {
|
|
281
|
-
"
|
|
297
|
+
"anyOf": [
|
|
282
298
|
{ "$ref": "#/$defs/IRI" },
|
|
283
299
|
{
|
|
284
300
|
"enum": [
|
|
@@ -33,6 +33,7 @@ from typing import (
|
|
|
33
33
|
Set,
|
|
34
34
|
Tuple,
|
|
35
35
|
Type,
|
|
36
|
+
TypeVar,
|
|
36
37
|
Union,
|
|
37
38
|
cast,
|
|
38
39
|
)
|
|
@@ -540,10 +541,9 @@ class EnumProp(IRIProp):
|
|
|
540
541
|
def validate(self, value) -> None:
|
|
541
542
|
super().validate(value)
|
|
542
543
|
|
|
543
|
-
|
|
544
|
-
if value not in valid_values:
|
|
544
|
+
if value not in self.iri_values():
|
|
545
545
|
raise ValueError(
|
|
546
|
-
f"'{value}' is not a valid value. Choose one of {' '.join(
|
|
546
|
+
f"'{value}' is not a valid value. Choose one of {' '.join(self.iri_values())}"
|
|
547
547
|
)
|
|
548
548
|
|
|
549
549
|
def encode(self, encoder, value, state) -> None:
|
|
@@ -616,6 +616,7 @@ def register(
|
|
|
616
616
|
|
|
617
617
|
register_lock = threading.Lock()
|
|
618
618
|
NAMED_INDIVIDUALS: Set[str] = set()
|
|
619
|
+
ForeachT = TypeVar("ForeachT", bound="SHACLObject")
|
|
619
620
|
|
|
620
621
|
|
|
621
622
|
@functools.total_ordering
|
|
@@ -861,7 +862,7 @@ class SHACLObject(object):
|
|
|
861
862
|
) as obj_s:
|
|
862
863
|
self._encode_properties(obj_s, state)
|
|
863
864
|
|
|
864
|
-
def _encode_properties(self, encoder, state):
|
|
865
|
+
def _encode_properties(self, encoder, state) -> None:
|
|
865
866
|
for iri, prop, min_count, max_count, pyname, compact in self.__iter_props():
|
|
866
867
|
value = self.__dict__["_obj_data"][iri]
|
|
867
868
|
if prop.elide(value):
|
|
@@ -921,7 +922,9 @@ class SHACLObject(object):
|
|
|
921
922
|
|
|
922
923
|
return obj
|
|
923
924
|
|
|
924
|
-
def _decode_properties(
|
|
925
|
+
def _decode_properties(
|
|
926
|
+
self, decoder, objectset: Optional[SHACLObjectSet] = None
|
|
927
|
+
) -> None:
|
|
925
928
|
for key in decoder.object_keys():
|
|
926
929
|
if not self._decode_prop(decoder, key, objectset=objectset):
|
|
927
930
|
raise KeyError(f"Unknown property '{key}'")
|
|
@@ -1019,7 +1022,9 @@ class SHACLExtensibleObject(SHACLObject):
|
|
|
1019
1022
|
obj = cls(typ)
|
|
1020
1023
|
return obj
|
|
1021
1024
|
|
|
1022
|
-
def _decode_properties(
|
|
1025
|
+
def _decode_properties(
|
|
1026
|
+
self, decoder, objectset: Optional[SHACLObjectSet] = None
|
|
1027
|
+
) -> None:
|
|
1023
1028
|
def decode_value(d):
|
|
1024
1029
|
if not d.is_list():
|
|
1025
1030
|
return d.read_value()
|
|
@@ -1042,7 +1047,7 @@ class SHACLExtensibleObject(SHACLObject):
|
|
|
1042
1047
|
with decoder.read_property(key) as prop_d:
|
|
1043
1048
|
self.__dict__["_obj_data"][key] = decode_value(prop_d)
|
|
1044
1049
|
|
|
1045
|
-
def _encode_properties(self, encoder, state):
|
|
1050
|
+
def _encode_properties(self, encoder, state) -> None:
|
|
1046
1051
|
super()._encode_properties(encoder, state)
|
|
1047
1052
|
if self.CLOSED:
|
|
1048
1053
|
return
|
|
@@ -1275,8 +1280,8 @@ class SHACLObjectSet(object):
|
|
|
1275
1280
|
yield child
|
|
1276
1281
|
|
|
1277
1282
|
def foreach_type(
|
|
1278
|
-
self, typ: Union[str,
|
|
1279
|
-
) -> Iterable[
|
|
1283
|
+
self, typ: Union[str, type[ForeachT]], *, match_subclass: bool = True
|
|
1284
|
+
) -> Iterable[ForeachT]:
|
|
1280
1285
|
"""
|
|
1281
1286
|
Iterate over each object of a specified type (or subclass there of)
|
|
1282
1287
|
|
|
@@ -1287,15 +1292,16 @@ class SHACLObjectSet(object):
|
|
|
1287
1292
|
if not isinstance(typ, str):
|
|
1288
1293
|
if not isinstance(typ, type) or not issubclass(typ, SHACLObject):
|
|
1289
1294
|
raise TypeError(f"Type must be derived from SHACLObject, got {typ}")
|
|
1290
|
-
|
|
1291
|
-
|
|
1295
|
+
# This intermediate step is necessary for pyrefly...
|
|
1296
|
+
typ_class: Type[SHACLObject] = typ
|
|
1297
|
+
typ = typ_class._OBJ_TYPE
|
|
1292
1298
|
|
|
1293
1299
|
if typ not in self.obj_by_type:
|
|
1294
1300
|
return
|
|
1295
1301
|
|
|
1296
1302
|
for exact, o in self.obj_by_type[typ]:
|
|
1297
1303
|
if match_subclass or exact:
|
|
1298
|
-
yield o
|
|
1304
|
+
yield cast(ForeachT, o)
|
|
1299
1305
|
|
|
1300
1306
|
def merge(self, *objectsets) -> "SHACLObjectSet":
|
|
1301
1307
|
"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.0.23"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "0.0.22"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/errorhandler.cpp.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/errorhandler.hpp.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/namedindividual.cpp.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/namedindividual.hpp.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/propertyvalue.cpp.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/propertyvalue.hpp.j2
RENAMED
|
File without changes
|
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/refproperty.cpp.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/cpp/refproperty.hpp.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/errorhandler.go.j2
RENAMED
|
File without changes
|
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/extensible.go.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/linkstate.go.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/listproperty.go.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/reflistproperty.go.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/refproperty.go.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/shaclobject.go.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/shaclobjectset.go.j2
RENAMED
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/shacltype.go.j2
RENAMED
|
File without changes
|
|
File without changes
|
{shacl2code-0.0.22 → shacl2code-0.0.23}/src/shacl2code/lang/templates/golang/validator.go.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|