Search code examples
erdplantuml

How to create contextual entity relationship diagram in plant uml?


I'm searching from the internet already and it seems I can't find any method to create contextual entity relationship diagram in plant UML like this one:

enter image description here

So what's lacking from plantUML is the ability to create diamond symbol and create cardinality using number and the letter (N). It seems I can't connect oval to rectangle using multiple lines too.


Solution

  • If you use @startdot you can get a GraphViz diagram. There's an example of what you want to do.

    Here's the PlantUML:

    @startdot
    graph ER {
        fontname="Helvetica,Arial,sans-serif"
        node [fontname="Helvetica,Arial,sans-serif"]
        edge [fontname="Helvetica,Arial,sans-serif"]
        layout=neato
        node [shape=box]; course; institute; student;
        node [shape=ellipse]; {node [label="name"] name0; name1; name2;}
            code; grade; number;
        node [shape=diamond,style=filled,color=lightgrey]; "C-I"; "S-C"; "S-I";
    
        name0 -- course;
        code -- course;
        course -- "C-I" [label="n",len=1.00];
        "C-I" -- institute [label="1",len=1.00];
        institute -- name1;
        institute -- "S-I" [label="1",len=1.00];
        "S-I" -- student [label="n",len=1.00];
        student -- grade;
        student -- name2;
        student -- number;
        student -- "S-C" [label="m",len=1.00];
        "S-C" -- course [label="n",len=1.00];
    
        label = "\n\nEntity Relation Diagram\ndrawn by NEATO";
        fontsize=20;
    }
    @enddot
    

    enter image description here