From: Benjamin Auder Date: Wed, 24 Jan 2018 23:16:20 +0000 (+0100) Subject: Fix README, separate example.svg (doesn't work inline) X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/user/assets/rpsls.css?a=commitdiff_plain;h=fe021b27455df1f9cd8392b2bba235029c567dec;p=erdiag.git Fix README, separate example.svg (doesn't work inline) --- diff --git a/README.md b/README.md index d9cf9fd..93b1314 100644 --- a/README.md +++ b/README.md @@ -11,124 +11,48 @@ At least the former is planned, and also probably a way to indicate relative ide ----- An entity is defined as follow + [Entity] #attr1 (*) attr2 (*) + with (\*) = optional SQL indications, and # denoting a (part of) a key. A relationship is defined in this way + {Relation} Entity C1 Entity2 C2 -- attr1 (*) attr2 (*) + where attributes are optional, and C1 (resp. C2) = cardinality for entity 1 (resp. 2). Defining relationships with more than two attributes is easy: just add entities. Cardinality dictionary: * \* = 0..n - * + = 1..n + * \+ = 1..n * 1 = 1..1 * ? = 0..1 To mark a weak entity, just surround its name by extra-brackets + [[WeakEntity]] + In the same way, a weak relation can be written + {{WeakRelation}} + The syntax for these two last is then the same as in the non-weak versions. To indicate an inheritance relation, proceed as follow + is_a Animal Cat Fish Planet Mars Venus -Finally, blocks must be separated by new lines. For a usage example, see example.html +Finally, blocks must be separated by new lines. For a usage example, see example.html (it should render as seen in example.svg) Note that the "drawMcd" method can take a second argument, which indicates the type of graph. * "bubble" draws the standard graph, as seen [here](https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model#/media/File:ER_Diagram_MMORPG.png) for example * "compact" (default) use the same box for an entity and its attributes - ------ - -Here is how the example file should render: - - - -%3 - - -Musician - -Musician - -id - -name - -band - -role - - - -Play - -Play - - -Musician:name--Play - -1,n - - -Instrument - -Instrument - -name - -family - - - -Instrument:name--Play - -0,n - - -Piano - -Piano - -type - - - -Piano:name--Instrument:name - - - - -Guitar - -Guitar - -type - - - -Guitar:name--Instrument:name - - - - -Play_event - -event - - -Play_event--Play - - - - diff --git a/example.svg b/example.svg new file mode 100644 index 0000000..bf81b87 --- /dev/null +++ b/example.svg @@ -0,0 +1,96 @@ + + + + + + +%3 + + + +Musician + +Musician + +id + +name + +band + +role + + + + +Play + +Play + + + +Musician:name--Play + +1,n + + + +Instrument + +Instrument + +name + +family + + + + +Instrument:name--Play + +0,n + + + +Piano + +Piano + +type + + + + +Piano:name--Instrument:name + + + + + +Guitar + +Guitar + +type + + + + +Guitar:name--Instrument:name + + + + + +Play_event + +event + + + +Play_event--Play + + + +