Skip to content

Commit 7ba092a

Browse files
committed
certain properties in instances should have type IRI not string.
1 parent 346d250 commit 7ba092a

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

pipeline/src/module_template.py.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ class {{ class_name }}({{ base_class }}):
5151
{% for instance_name, instance in instances.items() %}
5252
{{ class_name }}.{{ instance_name }} = {{ class_name }}(
5353
{% for key, value in instance.items() -%}
54-
{% if value is string %}{{key}}="{{value}}",{% else %}{{key}}={{value}},{% endif %}
54+
{% if value is string -%}
55+
{% if value.startswith('http') and key != 'id' -%}
56+
{{key}}=IRI("{{value}}"),
57+
{%- else -%}
58+
{{key}}="{{value}}",
59+
{%- endif %}
60+
{%- else -%}
61+
{{key}}={{value}},
62+
{%- endif %}
5563
{% endfor -%}
5664
){% endfor %}

pipeline/translator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def filter_instance(instance):
213213
"Real": "from numbers import Real"
214214
}
215215
extra_imports = set()
216+
if len(instances) > 0:
217+
extra_imports.add(import_map["IRI"])
216218
for property in self.context["properties"]:
217219
if isinstance(property["type"], list):
218220
for t in property["type"]:

0 commit comments

Comments
 (0)