Skip to content

Alessandro-Salerno/hera

Hera

Contributors Forks Stargazers Issues MIT License

Create SVG Entity-Relationship diagrams using a simple text-based formal language

Why Hera?

ER diagrams are often used in database implementation during the initial design phases, particularly as part of a Conceptual Design. Such diagrams are also widely used in academia, being employed by introductory and advanced DB courses alike.

Their dominance, however, is curiously not accompanied by easy-to-use, accessible design tools. In fact, the use of rudimentary or otherwise non-application-specific software such as draw.io is frequently encouraged. While sufficient, these programs and websites typically rely on visual design rather than formal, text-based descriptions, making the process both slower and harder, especially for people with visual disabilities.

Hera (backronym for Hierarchical Entity-Relationship Autogenerator) aims to provide an accessible, stable, and portable, text-based solution. The project is currently intended for academic use, though its scope and structure may allow for more advanced use cases in the future.

Features

  • Custom ER description language
  • Standard SVG output
  • Relationships as first-class constructs (i.e., with support for attributes)
  • Support for specialization hierarchies with both total and exclusive modifiers
  • Visual Studio Code (TextMate) extension and Treesitter parser
  • Helpful command-line error messages
  • Designed to be portable and (mostly) freestanding
  • UNIX-like behavior: SVG source is printed to Standard Output, allowing for piping or other forms of straightforward redirection

Portability

While not strictly related to database design, portability is one of Hera's core philosophies. An often overlooked aspect of so called free software is the freedom to choose the host platform. Most projects, in fact, have large dependency graphs which de-facto force users to use one of a handful of popular platforms.

Given its scope, Hera strives for easy portability, thus letting users choose their operating system, compiler, and standard library without any special considerations for Hera.

Examples

// University Management System
// Demonstrates specialization, inheritance, and cardinality constraints

entity Person total exclusive alias p {
    attribute "ID Number" key;
    attribute Name;
    attribute "Birth Date";
}

entity Student specifies Person {
    attribute "Enrollment Year";
    attribute Major;

    relation Enrolls (1, N);
}

entity Professor specifies Person {
    attribute Department;
    attribute "Office Number";

    relation Teaches (1, N);
}

entity Course {
    attribute Code key;
    attribute Title;
    attribute Credits;

    relation Enrolls (0, N);
    relation Teaches (1, 1);
    relation Requirements (0, N);
}

relation Enrolls {
    attribute Grade;
    attribute Semester;
}

relation Teaches {
}

relation Requirements {
}

A collection of example input files is available in the examples/ directory.

Documentation

Documentation is available in the docs/ directory. Additional information is also available in FAQ.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md, and LICENSE.

License

Hera is distributed under the BSD 2-Clause license. This only applies to the core source code and headers of the program. Third-party headers and source files included in this repository may have distinct licenses. The license is always stated at the top of each file.

See LICENSE for details.

Contributing

Hera is open to contributors, see CONTRIBUTING.md for details.