|
|
@@ -1,23 +1,61 @@
|
|
|
-{%- macro cellbase(page_index, page, cell, cell_iri) %}
|
|
|
+// Warning: Generated code! Do not edit!
|
|
|
+// Input file: '{{file.filename}}'
|
|
|
+// Generator: https://msdl.uantwerpen.be/git/rparedis/DrawioConvert/src/library
|
|
|
+
|
|
|
+{%- macro point(p) -%}
|
|
|
+drawio:hasX {{p.x}}
|
|
|
+drawio:hasY {{p.y}}
|
|
|
+{%- endmacro -%}
|
|
|
+
|
|
|
+{%- macro write_cell(page_index, cell) %}
|
|
|
+ {%- set cell_iri = "p"+(page_index|string)+"_cell_"+(cell.id|string) -%}
|
|
|
+ ci {{cell_iri}} : drawio:{{cell.__class__.__name__}} [
|
|
|
drawio:hasDrawioId {{cell.id|to_oml_string_literal}}
|
|
|
{%- if cell.value != "" %}
|
|
|
drawio:hasValue {{cell.value|to_oml_string_literal}}
|
|
|
{%- endif %}
|
|
|
{%- if cell.parent != None %}
|
|
|
- {%- set parent_index = page.find_cell_index(cell.parent) %}
|
|
|
- {%- if parent_index != None %}
|
|
|
- drawio:hasParent p{{page_index}}_c{{parent_index}}
|
|
|
- {%- endif %}
|
|
|
- {%- set parent_index = page.find_edge_index(cell.parent) %}
|
|
|
- {%- if parent_index != None %}
|
|
|
- drawio:hasParent p{{page_index}}_e{{parent_index}}
|
|
|
- {%- endif %}
|
|
|
+ drawio:hasParent p{{page_index}}_cell_{{cell.parent.id}}
|
|
|
{%- else %}
|
|
|
drawio:isRootOf p{{page_index}}
|
|
|
{%- endif %}
|
|
|
object_diagram:inModel model
|
|
|
- ]
|
|
|
|
|
|
+ {%- if cell.__class__.__name__ == "Vertex" %}
|
|
|
+ drawio:hasVertexGeometry drawio:VertexGeometry [
|
|
|
+ {{ point(cell.geometry)|indent(6) }}
|
|
|
+ drawio:hasWidth {{cell.geometry.width}}
|
|
|
+ drawio:hasHeight {{cell.geometry.height}}
|
|
|
+ ]
|
|
|
+ {% endif -%}
|
|
|
+
|
|
|
+ {%- if cell.__class__.__name__ == "Edge" %}
|
|
|
+ drawio:hasEdgeGeometry drawio:EdgeGeometry [
|
|
|
+ {%- for p in cell.geometry.points -%}
|
|
|
+ drawio:hasPoint drawio:PointListItem [
|
|
|
+ drawio:hasListIndex {{loop.index0}}
|
|
|
+ {{ point(p)|indent(8) }}
|
|
|
+ ]
|
|
|
+ {%- endfor %}
|
|
|
+ {%- if cell.geometry.source_point != None %}
|
|
|
+ drawio:hasSourcePoint drawio:Point [
|
|
|
+ {{ point(cell.geometry.source_point)|indent(8) }}
|
|
|
+ ]
|
|
|
+ {%- endif %}
|
|
|
+ {%- if cell.geometry.target_point != None %}
|
|
|
+ drawio:hasTargetPoint drawio:Point [
|
|
|
+ {{ point(cell.geometry.target_point)|indent(8) }}
|
|
|
+ ]
|
|
|
+ {%- endif %}
|
|
|
+ ]
|
|
|
+ {%- if cell.source %}
|
|
|
+ drawio:hasSource p{{page_index}}_cell_{{cell.source.id}}
|
|
|
+ {%- endif -%}
|
|
|
+ {%- if cell.target %}
|
|
|
+ drawio:hasTarget p{{page_index}}_cell_{{cell.target.id}}
|
|
|
+ {%- endif -%}
|
|
|
+ {%- endif %}
|
|
|
+ ]
|
|
|
{# Cell properties #}
|
|
|
{%-for prop_key,prop_val in cell.properties.items() %}
|
|
|
ci {{cell_iri}}_prop_{{prop_key}} : drawio:CellProperty [
|
|
|
@@ -27,7 +65,6 @@
|
|
|
object_diagram:inModel model
|
|
|
]
|
|
|
{%- endfor %}
|
|
|
-
|
|
|
{# Cell style #}
|
|
|
{%- for style_key,style_val in cell.style.data.items() %}
|
|
|
ci {{cell_iri}}_sty_{{style_key}} : drawio:CellStyleEntry [
|
|
|
@@ -37,7 +74,6 @@
|
|
|
object_diagram:inModel model
|
|
|
]
|
|
|
{%- endfor %}
|
|
|
-
|
|
|
{# Cell attributes #}
|
|
|
{%- for attr_key,attr_val in cell.attributes.items() %}
|
|
|
ci {{cell_iri}}_attr_{{attr_key}} : drawio:CellAttribute [
|
|
|
@@ -47,16 +83,12 @@
|
|
|
object_diagram:inModel model
|
|
|
]
|
|
|
{%- endfor %}
|
|
|
-{%- endmacro -%}
|
|
|
-
|
|
|
-{%- macro point(p) %}
|
|
|
-drawio:hasX {{p.x}}
|
|
|
-drawio:hasY {{p.y}}
|
|
|
-{%- endmacro -%}
|
|
|
|
|
|
-// Warning: Generated code! Do not edit!
|
|
|
-// Input file: '{{file.filename}}'
|
|
|
-// Generator: https://msdl.uantwerpen.be/git/rparedis/DrawioConvert/src/library
|
|
|
+ {# Recursively write out children #}
|
|
|
+ {%- for child in cell.children %}
|
|
|
+ {{ write_cell(page_index, child) }}
|
|
|
+ {%- endfor -%}
|
|
|
+{%- endmacro %}
|
|
|
|
|
|
description <{{namespaces.description}}#> as {{namespaces.shorthand}} {
|
|
|
|
|
|
@@ -88,47 +120,8 @@ description <{{namespaces.description}}#> as {{namespaces.shorthand}} {
|
|
|
{%- endfor %}
|
|
|
|
|
|
{# Cells #}
|
|
|
- {%- for cell_index, cell in enumerate(page.cells) -%}
|
|
|
- {%- set cell_iri = "p"+(page_index|string)+"_c"+(cell_index|string) %}
|
|
|
- ci {{cell_iri}} : drawio:Cell [
|
|
|
- {%- if cell.geometry != None %}
|
|
|
- drawio:hasCellGeometry drawio:CellGeometry [
|
|
|
- {{ point(cell.geometry)|indent(6) }}
|
|
|
- drawio:hasWidth {{cell.geometry.width}}
|
|
|
- drawio:hasHeight {{cell.geometry.height}}
|
|
|
- ]
|
|
|
- {%- endif %}
|
|
|
- {{ cellbase(page_index, page, cell, cell_iri) }}
|
|
|
- {# closing ']' is taken care of by cellbase #}
|
|
|
- {%- endfor %}
|
|
|
+ {{ write_cell(page_index, page.root) }}
|
|
|
|
|
|
- {# Edges #}
|
|
|
- {%- for edge_index, edge in enumerate(page.edges) -%}
|
|
|
- {%- set edge_iri = "p"+(page_index|string)+"_e"+(edge_index|string) %}
|
|
|
- ci {{edge_iri}} : drawio:Edge [
|
|
|
- {%-if edge.geometry != None %}
|
|
|
- drawio:hasEdgeGeometry drawio:EdgeGeometry [
|
|
|
- {%-for p in edge.geometry.points -%}
|
|
|
- drawio:hasPoint drawio:PointListItem [
|
|
|
- drawio:hasListIndex {{loop.index0}}
|
|
|
- {{ point(p)|indent(8) }}
|
|
|
- ]
|
|
|
- {%- endfor %}
|
|
|
- {%- if edge.geometry.source_point != None %}
|
|
|
- drawio:hasSourcePoint drawio:Point [
|
|
|
- {{ point(edge.geometry.source_point)|indent(8) }}
|
|
|
- ]
|
|
|
- {%- endif %}
|
|
|
- {%- if edge.geometry.target_point != None %}
|
|
|
- drawio:hasTargetPoint drawio:Point [
|
|
|
- {{ point(edge.geometry.target_point)|indent(8) }}
|
|
|
- ]
|
|
|
- {%- endif %}
|
|
|
- ]
|
|
|
- {%- endif %}
|
|
|
- {{ cellbase(page_index, page, edge, edge_iri) }}
|
|
|
- {# closing ']' is taken care of by cellbase #}
|
|
|
- {%- endfor %}
|
|
|
{%- endfor %}
|
|
|
|
|
|
}
|