Skip to content

Commit

Permalink
fix: Add "@container": "@set" when it is needed and predicate URI g…
Browse files Browse the repository at this point in the history
…eneration
  • Loading branch information
Murloc6 committed Nov 15, 2023
1 parent 28fbd98 commit f453ec8
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 68 deletions.
7 changes: 5 additions & 2 deletions aas_core_codegen/jsonld/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ def _generate_for_property(
our_type_to_rdfs_range=our_type_to_rdfs_range,
)
property_json_ld_context: JsonLdType = {"@id": property_uri}
if isinstance(prop.type_annotation, intermediate.ListTypeAnnotation):
if isinstance(
intermediate.beneath_optional(prop.type_annotation),
intermediate.ListTypeAnnotation,
):
property_json_ld_context["@container"] = "@set"

underlying_atomic_type_annotation = _get_underlying_atomic_type(
Expand Down Expand Up @@ -254,7 +257,7 @@ def _generate_class_context(

class_context_definition: JsonLdType = {}
class_name = naming.json_model_type(cls.name)
uri_fragment = rdf_shacl_naming.class_name((Identifier(class_name)))
uri_fragment = rdf_shacl_naming.class_name((Identifier(cls.name)))
class_context_definition[class_name] = {
"@id": uri_fragment,
"@context": {
Expand Down
Loading

0 comments on commit f453ec8

Please sign in to comment.