Structura Documentation

What's is Structura?

Structura allows to edit Class Models in a graphical way.

Etymology: from struō (“to build”) + -tūra (“concrete action noun suffix”).

It is created using the Daga library as a graphical editor foundation and Essential as core metamodel.

The code generation allows a great level of precission, customization, and maintainability on defining custom-made targets based on ad-hoc code-gen.

Feel free to try for free all our code generators sampled here.

If you need a custom code generator to target your specific stack feel free to reach us for a quote. We are experts in tailor-made code generation ensuring compliance by-design.

Graphical Notation

Graphical notations resembles a classical UML class model.

Class

No surprises here. A class is represented as a rectangle (like the classical UML representation).

Enumeration

Enumerations are represented as a rectangle with a different color.

Associations

Sample composition between Invoice and InvoiceLine.

Inheritance relations

Sample inheritance relationship.

Textual Syntax

Structura defines a concise syntax to help reviewing models in textual form. This format is useful for:

  • humans: to create or review
  • tools: storing it on git and tracking changes, or
  • IAs: to read or to produce.

The following concepts are used in the textual syntax:

Comments

You can use regular comments (C style), inline or multiple lines:

// Inline comment

/* Multiline comment
    2nd line.
  */
          

Namespaces

Namespaces creates logical buckets or folders to contain concepts. They declares a naming scope and thus, it must be unique.

namespace Earth.Europe.Spain
{
        // Definitions ...
}
          

Classes

A class defines a type for objects. All objects created/instanciated from the same class have the same properties, methods and behaivour.

class Customer
{
        // Properties ...
}
          

Properties

Properties are defined inside the classes with a type and can be declared optional (denoted with '?' as a postfix of the type) or mandatory in other case. Note the optional mark is indicated in the type and not in the property. Types are specified before the property name.

class Customer
{
        string Name;
        string Surname;
        int? Age;
}
          

Enumeration

Enumerations defines a set of fixed values with a code and a name. These are used as semantic types to better describe your domain.

enum Color
{
        Undefined = 0
        Red = 1,
        Yellow = 2,
        Green = 3
}
          

Codes can be strings also. Example.

enum Day
{
        Monday = "mon"
        Tuesday = "tue",
        Wednesday = "wed",
        // ...
}
          

Associations

Associations establish relationships betweens classes. When relating two classes (called here source & target) you must describe the following aspects:

  • Composition: use the composition keyworkd to indicate it.
  • On the source:
    • Class name: the source class
    • Source Role: the role to name this end fo the relation.
    • Source Cardinality: minimum and maximun cardinality with the standard semantics used in UML.
    Samewise on the target:
    • Class name: the target class
    • Target Role: the role to name this end fo the relation.
    • Target Cardinality: minimum and maximun cardinality with the standard semantics used in UML.

Samples:

association Customer (Customer) 1..1 <>--  Invoice (Invoices) *;
association composition Invoice (Invoice) 1..1 <>--  InvoiceLine (InvoiceLines) *;
association InvoiceLine (InvoiceLine) * <>--  Product (Product) 1..1;
association Product (Product) 1..1 <>--  Stock (Stock) *;
          

Inheritance relations

Inheritance relationship can be expresed with this syntax:

class Child : Parent {}
          

Type System

Properties must have types. Primitives types supported by Structura are:

KeywordDescription
stringCommon string datatype. It should be size constrained.
charA single char.
boolA boolean type (true or false).
dateA date only value (yyyy-mm-dd).
timeA time only value (hh:mm:ss).
datetimeA complete timestamp.
intInteger.
longLong integer.
decimalDecimal type.
floatFloat type.

Decorators

Classes and properties can be decorated (Technically in UML this is called a stereotype).

Decorators enrich the model with specific semantics.

You can create freely your own decorators, but there also a list of predefined decorators with specific pourposes.

Class decorators

DecoratorSampleSemantics
doc[doc("A class description")]Provides a detailed description for the class.
color[color("red")] Provides a color for a class or enum. This allows you to arbitrarily classify a model or to follow conventions like UML Color

Property decorators

DecoratorSampleSemantics
doc[doc("A property description")]Provides a detailed description for the class.
key[key] Select the key field for the class. This will be used as a primary key and object identifier on generated code.
index[index]Created an index for this field to increase the performance on query operations.
maxsize[maxsize(20)] Provides a maximum size in characters for a string. In general, it is importan to limit the size of string fields due to performance issues when creating the databa schema.
minsize[minsize(3)]Provides a minimum size in characters for a string. Validation pourposes.
mail[mail]Email domain type. Provided specialized editors and validation.
money[money]Money domain type. Provided specialized editors and validation.
gt[gt(0)]Validation. Greather than x.
gte[gte(0)]Validation. Greather or equals than x.
lt[lt(42)]Validation. Lower than x.
lte[lte(42)]Validation. Lower or equals than x.
regex[regex("^\w+\d*$")]Validation. String value should match the regular expression.

Colors

Structura provides a palette of colors to help you to classify and organize the concepts in your model on your own with your custom criteria.

However, by default, Zeus uses UML Color criteria and will pre-clasify the concepts following this criteria:

  • pink
    Moment-interval — Represents a moment or interval of time for legal or business reasons.
  • yellow
    Role — Is it a way of participating in an activity (by either a person, place, or thing).
  • blue
    Description — Is it simply a catalog-entry-like description which classifies or 'labels' an object.
  • green
    Party, place, or thing — Something tangible, uniquely identifiable.

If you want other classification criteria ask Zeus about it.

Validation

Model can be validaded before code generation.

Some interested usages here is to apply profiles for business compliance validation like GRPD, PCI/DSS, and other security and quality standars to be enforced.

To be further defined.

Conventions

When generating the code, a function will be executed to attempt to infer the primary key for each class in the model.

According to the rules followed by this process, a property will be considered the primary key if it meets the following criteria, in order of priority:

  • The property is already decorated with key.
  • The property is named id.
  • The property is named as the class name followed by id.
  • The property is named id followed by the class name.
  • The property is named name.
  • The property is of type DateTime and is named Timestamp.

Code Generation

Structura can be used to implement code artifacts for different targets:

  • A backend with .Net Core 10 with persistence in SqlServer, MongoDb or MySQL, dockerized + Redis Cache. Rest API publised as OpenApi 3.1. Architecture: simple: contracts (DTOs), controller, (entitites) service, & repository.
  • Angular code including proxy services to connect with the backend.
  • A Vibe Coding generator (experimental).
  • Model documentation.
  • Others to come... (on demand): Compliance, embeded systems, real-time code, custom tech-stack, etc.

Frequently Asked Questions

Some questions we need to clarify:

Why another UML editor?

In the Artificial Intelligence era:

  • we think there is space to innovate providing a Web editor (low-code) to design at the right level of abstraction.
  • we think the value in the model (changes slowly, more stable), and less value is in the code (can change faster).
  • AI & LLMs can help you to create the model. You can curate the result and prevent AI hallucinations.
  • Code generation can provide you a solid start (80% of what you need accordingly to Pareto).
  • AI & LLMs and tradictional coding can help you again to complete faster the missing 20%.

Who owns the model I created?

You. We do not use the models for anything else than proving the service.

Who owns the code I generated?

You. Please, recognize in the credits the source tool (https://structura.tools) but feel free to use the code in your projects with no limits for personal or bussiness usages, including commercial distribution.

  • Free code generators are offered at no cost with no warranties.
  • Paid (future), custom and supported code-generators will come with extra warranties about enforcing compliance by design.
  • Need a custom code generator for your own stack? Feel free to reach us for a quote.

Credits

Build by Metadev from 2024 till 2026. All rights reserved.