Introduction

JUDO Specification Language (JSL) is an implementation independent text-based modeling language. The overall goal of the language is to provide unambiguous and readable descriptions of different business domains and their incorporated business logic.

Because of the accuracy of JSL, models can be run, tested, and integrated into coding projects.

All concepts and rules described in this document are valid in JSL.

See the JUDO Java documentation for APIs and programming concepts.

Example model

We use the model below as example data model in this guide.

model shop;

import judo::types;

type string Email(min-size = 0, max-size = 64, regex = r"^\w+@\w+(\.\w+)+$");

enum OrderStatus {
	OPEN = 1;
	PAID = 2;
	DELIVERED = 3;
}

entity Address {
    field required String street;
    field required String city;
    field String country;
}

entity User {
	identifier required Email email;
}

entity abstract Customer {
    field required Address address;
	relation Order[] orders opposite customer;
}

entity Person extends Customer, User {
	field required String firstName;
	field required String lastName;
	derived	String fullName => self.firstName + " " + self.lastName;
}

entity Enterprise extends Customer {
	field required String name;
}

entity Order {
	field required OrderStatus status = OrderStatus#OPEN;
	field OrderItem[] orderItems;
	relation required Customer customer opposite orders;
	derived Integer price => self.orderItems!sum(item | item.price);
}

entity OrderItem {
	relation required Product product opposite-add orderItems[];
	field required Integer amount;
	derived	String productName => self.product.name;
	derived Integer price => self.amount * self.product.price;
}

entity Product {
	identifier required String name;
	field required Integer price;
}
diagram-classes