Closed rubenmate closed 3 months ago
I think the discussion over JSON or XML is not really important. It's more important to choose a way of storing the more complex relations that could happen in a real ER diagram.
This could be an example with entities, relation and cardinalities:
{
"entities": [
{ "id": 1, "label": "Customer" },
{ "id": 2, "label": "Product" },
{ "id": 3, "label": "Order" }
],
"relationships": [
{
"type": "purchase",
"participants": [
{ "entityId": 1, "role": "buyer", "cardinality": "1" },
{ "entityId": 2, "role": "product", "cardinality": "0..*" },
{ "entityId": 3, "role": "order", "cardinality": "1..*" }
]
}
]
}
Here is the same in XML.
<entityRelationDiagram>
<entities>
<entity id="1" label="Customer" />
<entity id="2" label="Product" />
<entity id="3" label="Order" />
</entities>
<relationships>
<relationship type="purchase">
<participant entityId="1" role="buyer" cardinality="1" />
<participant entityId="2" role="product" cardinality="0..*" />
<participant entityId="3" role="order" cardinality="1..*" />
</relationship>
</relationships>
</entityRelationDiagram>
In the #19 I'm using the following format:
{
"entities": [
{
"idMx": "2",
"name": "Entidad",
"position": {
"x": 254,
"y": 130
},
"attributes": [
{
"idMx": "3",
"name": "Atributo",
"position": {
"x": 374,
"y": 130
}
},
]
}
],
"relations": []
}
The relations are now added to the diagram structure so this can be closed.
Background:
I need to decide on the most suitable data format for saving the entity relationship diagrams modeled in our application. This includes determining how entities are linked, storing text labels, and other relevant information (like at some point the coordinates where the objects are placed).
Goals:
Investigate and brainstorm potential data formats for saving entity relationship diagrams. Evaluate the pros and cons of using XML versus JSON for storing diagram data.
Proposed Solution:
Research various data formats commonly used for storing structured data, such as XML and JSON.