X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=README.md;h=ef279e629813bb4a962e719a5dc1b75d1e2a8d63;hb=8edb29ffa12fda61a939295ce00a6d22133131d1;hp=d9cf9fd347e5867e28b7fd20c8a317d31580c664;hpb=525c4d2aa73ae124da17a3c64a2ca44d13fcc49d;p=erdiag.git diff --git a/README.md b/README.md index d9cf9fd..ef279e6 100644 --- a/README.md +++ b/README.md @@ -5,44 +5,58 @@ Inspired by [this repository](https://code.google.com/archive/p/merisier/). This parser reads ER diagrams definition files, and produces two types of diagrams + SQL code. [Graphviz](https://www.graphviz.org/) is used on server side to translate parsed graph descriptions into SVG objects. -*Note:* at the moment, only the conceptual graph is implemented, and no comments are allowed in textual descriptions. -At least the former is planned, and also probably a way to indicate relative identifiers. - ----- An entity is defined as follow - [Entity] - #attr1 (*) - attr2 (*) + + [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 (*) + + {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 +Special cardinalities are also available to indicate relative identification: `?R` and `1R`. + +And, in case of a self-relationship, symbols '>' and '<' can indicate the sense, as in + + {manage} + Users *> + Users 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 + is_a + Animal Cat Fish + Planet Mars Venus + +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 @@ -50,85 +64,11 @@ Note that the "drawMcd" method can take a second argument, which indicates the t ----- -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 - - - - +**TODO** list: + + - functional integrity constraints (CIF) + - inter-relations constraints (or, and, xor...) + - inheritance with the right symbol (triangle) + - put online somewhere (user enter graph description and get SVG + SQL) + +*Implementation note:* temporary dependency to [underscore](http://underscorejs.org/); good library but used so far only for its shuffle() method.