Tonto Command Line Interface (CLI) is a tool that expands the use of Tonto models by enabling the transformation of Tonto projects into other formats and providing validation capabilities.
- Transformation to JSON: The
generate
command converts a Tonto model into a JSON file that adheres to the OntoUML JSON schema. This allows for interoperability with OntoUML tools and further processing.tonto-cli generate [directoryName]
- Import from JSON: The
import
command takes a JSON file conforming to the OntoUML JSON schema and generates a corresponding Tonto project. This facilitates the migration of existing OntoUML models to Tonto.tonto-cli import [jsonFileName]
- Transformation to OWL: The
transform
command converts a Tonto model into a gUFO-based OWL ontology using the Turtle syntax. This bridges the gap between conceptual models and formal ontologies used in the Semantic Web.tonto-cli transform [directoryName]
- Validation: The
validate
command sends the Tonto model to theontouml-server
API for validation. It returns any validation errors identified by the server, helping to ensure the model's correctness and adherence to OntoUML/UFO rules.tonto-cli validate [directoryName]
Tonto CLI is available as an NPM package. To install it globally, use the following command:
npm install -g tonto-cli
Once installed, you can use the tonto-cli
command followed by the desired command and directory or file name to perform the corresponding action.
- Node.js Requirement: Tonto CLI requires Node.js to be installed on your system.
- Global Installation: Installing Tonto CLI globally allows you to use the
tonto-cli
command from any directory.
Tonto grammar allows you declare elements by using its keyword and the defined name for the element.
package example
kind Person {
name: String
age: Integer
gender: Gender
}
phase Child specializes Person
enum Gender {
MALE
FEMALE
OTHER
}
relation Person [0..*] -- hasFriend -- [0..*] Person
Tonto specifications are organized into packages, defined using the package keyword followed by the package name. Packages act as namespaces and are fundamental for modularity.
package myPackage
Classes are declared using keywords corresponding to UFO types (e.g., kind, role, phase) followed by the class name. Specializations are indicated using the specializes keyword.
kind Person {
name: string
birthDate: date {const}
}
phase Child specializes Person
Tonto supports built-in datatypes (number, string, boolean, date, time, datetime) and allows defining custom datatypes using the datatype keyword.
datatype Address {
street: string
number: int
}
Enumerations are declared using the enum keyword, listing possible literal values.
enum EyeColor { Blue, Green, Brown, Black }
Generalization sets define relationships between a general class and its specializations. They can be marked as disjoint and/or complete.
disjoint complete genset PersonAgeGroup where Child, Adult specializes Person
genset PersonAgeGroup {
general Person
specifics Child, Adult
}
Relations (associations) can be declared internally (within a class body) or externally. They are specified using relation stereotypes (e.g., @componentOf, @mediation) and cardinalities.
// Internal relation
kind University {
@componentOf [1] <>-- [1..*] Department
}
// External relation
@mediation relation EmploymentContract [1..*] -- [1] Employee
This is the instructions on setting up your project locally. To get a local copy up and running follow these simple example steps:
This is all the tools you need installed to run the project and the versions that are preferred
- nodejs - v16.9.1 or higher
- npm - 7.21.1 or higher
- Yarn - 1.22.18 (not mandatory, but recommended)
- Run
npm run langium:generate
to generate TypeScript code from the grammar definition. - Run
npm run build
to compile all TypeScript code ornpm run watch
if you want the compiler to work automatically everytime you update your files - Press
F5
to open a new window with your extension loaded. - Create a new file with a file name suffix matching your language.
- Verify that syntax highlighting, validation, completion etc. are working as expected.
- Help command to list all available commands
tonto-cli help
- Generate JSON File from Tonto Project command::
tonto-cli generate <dirName>
- Generate Tonto Project from a JSON Filee
tonto-cli import <fileName.json>
- Validate Tonto Project with ontouml-js server APII
tonto-cli validate <dirName>
Distributed under the MIT License. See LICENSE.txt
for more information.
Matheus Lenke Coutinho - matheus.l.coutinho@edu.ufes.br - Linkedin - Github