Update entity_relationship_generator.py
Browse files- entity_relationship_generator.py +44 -12
entity_relationship_generator.py
CHANGED
@@ -435,10 +435,10 @@ def generate_entity_relationship_diagram(json_input: str, output_format: str) ->
|
|
435 |
height='0.6'
|
436 |
)
|
437 |
|
438 |
-
# Conectar padre con ISA
|
439 |
dot.edge(parent, rel_name, len='1.5', color='#404040', penwidth='2')
|
440 |
|
441 |
-
# Conectar ISA con hijos
|
442 |
for child in children:
|
443 |
dot.edge(rel_name, child, len='1.5', color='#404040', penwidth='2')
|
444 |
|
@@ -456,13 +456,29 @@ def generate_entity_relationship_diagram(json_input: str, output_format: str) ->
|
|
456 |
height='1.0'
|
457 |
)
|
458 |
|
459 |
-
# Conectar entidades con cardinalidades
|
460 |
-
|
461 |
-
|
|
|
|
|
|
|
|
|
462 |
dot.edge(
|
463 |
-
|
464 |
rel_name,
|
465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
len='2.0',
|
467 |
color='#404040',
|
468 |
penwidth='2',
|
@@ -484,13 +500,29 @@ def generate_entity_relationship_diagram(json_input: str, output_format: str) ->
|
|
484 |
height='1.0'
|
485 |
)
|
486 |
|
487 |
-
# Conectar entidades con cardinalidades
|
488 |
-
|
489 |
-
|
|
|
|
|
|
|
|
|
490 |
dot.edge(
|
491 |
-
|
492 |
rel_name,
|
493 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
len='2.0',
|
495 |
color='#404040',
|
496 |
penwidth='2',
|
|
|
435 |
height='0.6'
|
436 |
)
|
437 |
|
438 |
+
# Conectar padre con ISA (sin cardinalidad)
|
439 |
dot.edge(parent, rel_name, len='1.5', color='#404040', penwidth='2')
|
440 |
|
441 |
+
# Conectar ISA con hijos (sin cardinalidad)
|
442 |
for child in children:
|
443 |
dot.edge(rel_name, child, len='1.5', color='#404040', penwidth='2')
|
444 |
|
|
|
456 |
height='1.0'
|
457 |
)
|
458 |
|
459 |
+
# Conectar entidades con cardinalidades posicionadas correctamente
|
460 |
+
if len(entities_involved) >= 2:
|
461 |
+
entity1, entity2 = entities_involved[0], entities_involved[1]
|
462 |
+
card1 = cardinalities.get(entity1, '1')
|
463 |
+
card2 = cardinalities.get(entity2, '1')
|
464 |
+
|
465 |
+
# Primera entidad -> relación (cardinalidad cerca de la entidad)
|
466 |
dot.edge(
|
467 |
+
entity1,
|
468 |
rel_name,
|
469 |
+
taillabel=card1,
|
470 |
+
len='2.0',
|
471 |
+
color='#404040',
|
472 |
+
penwidth='2',
|
473 |
+
fontcolor='#000000',
|
474 |
+
fontsize='12'
|
475 |
+
)
|
476 |
+
|
477 |
+
# Relación -> segunda entidad (cardinalidad cerca de la entidad)
|
478 |
+
dot.edge(
|
479 |
+
rel_name,
|
480 |
+
entity2,
|
481 |
+
headlabel=card2,
|
482 |
len='2.0',
|
483 |
color='#404040',
|
484 |
penwidth='2',
|
|
|
500 |
height='1.0'
|
501 |
)
|
502 |
|
503 |
+
# Conectar entidades con cardinalidades posicionadas correctamente
|
504 |
+
if len(entities_involved) >= 2:
|
505 |
+
entity1, entity2 = entities_involved[0], entities_involved[1]
|
506 |
+
card1 = cardinalities.get(entity1, '1')
|
507 |
+
card2 = cardinalities.get(entity2, '1')
|
508 |
+
|
509 |
+
# Primera entidad -> relación (cardinalidad cerca de la entidad)
|
510 |
dot.edge(
|
511 |
+
entity1,
|
512 |
rel_name,
|
513 |
+
taillabel=card1,
|
514 |
+
len='2.0',
|
515 |
+
color='#404040',
|
516 |
+
penwidth='2',
|
517 |
+
fontcolor='#000000',
|
518 |
+
fontsize='12'
|
519 |
+
)
|
520 |
+
|
521 |
+
# Relación -> segunda entidad (cardinalidad cerca de la entidad)
|
522 |
+
dot.edge(
|
523 |
+
rel_name,
|
524 |
+
entity2,
|
525 |
+
headlabel=card2,
|
526 |
len='2.0',
|
527 |
color='#404040',
|
528 |
penwidth='2',
|