Open sirex opened 3 weeks ago
Add a new Manifest, for reading and writing draw.io xml file format.
For example, if we have DSA table:
d | r | b | m | property | type | ref | source | prepare | uri datasets/gov/rc/ar/ws | | | | | | | | Location | | id | | | locn:Location | | | | id | integer | | | | dct:identifier | | | | name | text | | | | rdfs:label | | | | name@lt | string | | | | | | | | | | | | | | | Location | | id | | | | | | Administration | | id | ADM | | | | | | id | integer | | ADM_ID | | | | | | name@lt | string | | NAME | | | | | | type | string | | TYPE | | skos:Concept | | | | | enum | | | "country" | | | | | | | | | "municipality" | | | | | | | | | "eldership" |
Then command spinta dsa.csv -o dsa.drawio should generate following XML file:
spinta dsa.csv -o dsa.drawio
<mxfile modified="2024-06-04T14:52:17.956Z" agent="Spinta" type="device"> <diagram name="Page-1" id="9ptSNCdeymJIEukcAglS"> <mxGraphModel dx="3626" dy="836" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> <root> <mxCell id="0" /> <mxCell id="1" parent="0" /> <mxCell id="Ts81wxNdnfjbUbDRierq-6" value="datasets/gov/rc/ar/ws" style="shape=folder;fontStyle=1;spacingTop=2;tabWidth=160;tabHeight=30;tabPosition=left;html=1;whiteSpace=wrap;verticalAlign=top;align=left;spacingLeft=6;" vertex="1" parent="1"> <mxGeometry x="-2150" y="-380" width="430" height="357" as="geometry" /> </mxCell> <mxCell id="Ts81wxNdnfjbUbDRierq-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endSize=16;endFill=0;" edge="1" parent="1" source="Ts81wxNdnfjbUbDRierq-8" target="Ts81wxNdnfjbUbDRierq-19"> <mxGeometry relative="1" as="geometry" /> </mxCell> <object label="Administration" source="ADM" ref="id" id="Ts81wxNdnfjbUbDRierq-8"> <mxCell style="swimlane;fontStyle=1;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="-2120" y="-164" width="140" height="78" as="geometry" /> </mxCell> </object> <object label="+ id: integer [1..1]" source="ADM_ID" id="Ts81wxNdnfjbUbDRierq-9"> <mxCell style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ts81wxNdnfjbUbDRierq-8"> <mxGeometry y="26" width="140" height="26" as="geometry" /> </mxCell> </object> <object label="+ name@lt: string [1..1]" source="NAME" id="Ts81wxNdnfjbUbDRierq-10"> <mxCell style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ts81wxNdnfjbUbDRierq-8"> <mxGeometry y="52" width="140" height="26" as="geometry" /> </mxCell> </object> <mxCell id="Ts81wxNdnfjbUbDRierq-13" value="<i style="font-weight: 400;">&lt;&lt;enumeration&gt;&gt;</i><br style="font-weight: 400;"><b>AdministrationType</b>" style="swimlane;fontStyle=1;childLayout=stackLayout;horizontal=1;startSize=36;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="-1890" y="-164" width="140" height="114" as="geometry" /> </mxCell> <mxCell id="Ts81wxNdnfjbUbDRierq-14" value="country" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ts81wxNdnfjbUbDRierq-13"> <mxGeometry y="36" width="140" height="26" as="geometry" /> </mxCell> <mxCell id="Ts81wxNdnfjbUbDRierq-15" value="municipality" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ts81wxNdnfjbUbDRierq-13"> <mxGeometry y="62" width="140" height="26" as="geometry" /> </mxCell> <mxCell id="Ts81wxNdnfjbUbDRierq-16" value="eldership" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ts81wxNdnfjbUbDRierq-13"> <mxGeometry y="88" width="140" height="26" as="geometry" /> </mxCell> <object label="type [1..1]" source="TYPE" uri="skos:Concept" id="Ts81wxNdnfjbUbDRierq-17"> <mxCell style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=open;endFill=1;endSize=12;" edge="1" parent="1" target="Ts81wxNdnfjbUbDRierq-13"> <mxGeometry x="0.0971" relative="1" as="geometry"> <mxPoint x="-1980" y="-116.59999999999991" as="sourcePoint" /> <mxPoint x="-1850" y="-116.59999999999991" as="targetPoint" /> <Array as="points"> <mxPoint x="-1980" y="-144" /> </Array> <mxPoint as="offset" /> </mxGeometry> </mxCell> </object> <object label="Location" uri="locn:Location" id="Ts81wxNdnfjbUbDRierq-19"> <mxCell style="swimlane;fontStyle=1;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="-2120" y="-320" width="140" height="104" as="geometry" /> </mxCell> </object> <object label="+ id: integer [1..1]" uri="dct:identifier" id="Ts81wxNdnfjbUbDRierq-20"> <mxCell style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ts81wxNdnfjbUbDRierq-19"> <mxGeometry y="26" width="140" height="26" as="geometry" /> </mxCell> </object> <object label="+ name: text [1..1]" uri="rdfs:label" id="Ts81wxNdnfjbUbDRierq-24"> <mxCell style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ts81wxNdnfjbUbDRierq-19"> <mxGeometry y="52" width="140" height="26" as="geometry" /> </mxCell> </object> <object label="+ name@lt: string [1..1]" id="Ts81wxNdnfjbUbDRierq-21"> <mxCell style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ts81wxNdnfjbUbDRierq-19"> <mxGeometry y="78" width="140" height="26" as="geometry" /> </mxCell> </object> </root> </mxGraphModel> </diagram> </mxfile>
Which should produce following UML class diagram:
When exporting to drawio.on top of existing file (update from dsa.csv to dsa.drawio:
dsa.csv
dsa.drawio
spinta update dsa.csv -o dsa.drawio
All existing positions and styling in dsa.drawio should be preserved, updating only labels, and data, by id.
When creating a new diagram, positions should be calculated to form a simple box like structure:
Where the end result should look like this (without boxes):
Number of boxes on x and y axes should be equal. For example, if we have 9 classes, then there should be 4 x 3 boxes.
Add a new Manifest, for reading and writing draw.io xml file format.
For example, if we have DSA table:
Then command
spinta dsa.csv -o dsa.drawio
should generate following XML file:Which should produce following UML class diagram:
When exporting to drawio.on top of existing file (update from
dsa.csv
todsa.drawio
:All existing positions and styling in
dsa.drawio
should be preserved, updating only labels, and data, by id.When creating a new diagram, positions should be calculated to form a simple box like structure:
Where the end result should look like this (without boxes):
Number of boxes on x and y axes should be equal. For example, if we have 9 classes, then there should be 4 x 3 boxes.