Skip to content

Commit

Permalink
feat: first extension testing version
Browse files Browse the repository at this point in the history
  • Loading branch information
matheuslenke committed Jun 8, 2022
1 parent 52c59fd commit c9cdef6
Show file tree
Hide file tree
Showing 34 changed files with 4,490 additions and 10,929 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ out/
lib/
coverage
*.tsbuildinfo

*.vsix
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
],
"debugWebWorkerHost": true
}
]
}
8 changes: 8 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
.vscode/**
.vscode-test/**
.gitignore
out/test/**
src/**
.yarnrc
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
langium-quickstart.md
README.md
137 changes: 137 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<div id="top"></div>


<!-- [![Contributors][contributors-shield]][contributors-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url] -->


<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://github.com/othneildrew/Best-README-Template">
<img src="docs/images/TontoLogo.png" alt="Logo" height="100" alt="Tonto Logo image, a blue background with TONTO written in it">
</a>

<h3 align="center">An DSL for Ontology models</h3>

</div>

<div height="200">
</div>

&nbsp;

<!-- TABLE OF CONTENTS -->


<div>
<h1><summary>Table of Contents</summary></h1>
<ol>
<li><a href="#about-the-project">About The Project</a></li>
<li><a href="#built-with">Built With</a></li>
<li><a href="#getting-started">Getting Started</a></li>
<li><a href="#prerequisites">Prerequisites</a></li>
</ol>
</div>


<!-- ABOUT THE PROJECT -->
<div id="about-the-project"> </div>

## 📝 About The Project

Tonto is an acronym with the words Textual and Ontology, because it is a written way of writing Ontology models. It was developed using the `Langium` tool, with `Typescript`, and creates a Visual Studio Code Extension with a Language server.

Tonto was designed as a friendly textual syntax for ontologies. It offers specialized support for constructs reflecting the UFO foundational ontology, which makes it possible to identify errors in the ontology that would otherwise pass unnoticed. The language was designed to allow transformation to a number of languages including UML (more specifically OntoUML), OWL (for gUFO-based ontologies), Alloy, Common Logic, and the TPTP syntax.

### The language supports:

- UFO-based annotations to facilitate error checking and meaning negotiation

- High-order types for multi-level taxomies

- Structured comments for documentation generation

- Constraints specification when extra precision is required

- Ontology testing/verification directives



As a textual syntax, the language can benefit from source control tools such as git, and ontologies can be viewed and edited without special tools. This VS Code extension is provided with support for syntax verification, syntax highlight, content assist and ontology visualization preview. The extension is integrated with the [OntoUML](https://github.com/OntoUML/OntoUML) server, to benefit from services designed for the language, such as transformation to OWL and generation of database schemas.

<p align="right">(<a href="#top">back to top</a>)</p>


<div id="built-with"> </div>

### 🔨 Built With

Here are some of the languages, frameworks, tools and libraries used in development of this application:

* [Typescript](https://www.typescriptlang.org/)
* [Langium](https://langium.org/)

<p align="right">(<a href="#top">back to top</a>)</p>


<div id="getting-started"> </div>

<!-- GETTING STARTED -->
## ⌨️ Getting Started

This is the instructions on setting up your project locally. To get a local copy up and running follow these simple example steps:


<div id="prerequisites"> </div>

### Prerequisites

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 really recommended)


### ⚙️ Initializing

* Run `npm run langium:generate` to generate TypeScript code from the grammar definition.
* Run `npm run build` to compile all TypeScript code.
* 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.


### Packaging the extension

> With these commands you can generate a .vsix file to install the extension in your VS Code or to send privately to other people to test it, without publishing it to the Marketplace
```bash
# Run this to generate .vsix file
vsce package --yarn --pre-release --baseContentUrl none

# Installing the extension in your vscode (requires the code extension in path)
code --install-extension generatedFile.vsix
```

<!-- LICENSE -->
## 🔐 License

Distributed under the MIT License. See `LICENSE.txt` for more information.

<p align="right">(<a href="#top">back to top</a>)</p>

<div id="contact"> </div>

<!-- CONTACT -->
## ✉️ Contact


Matheus Lenke Coutinho - matheus.l.coutinho@edu.ufes.br - [Linkedin](https://www.linkedin.com/in/matheus-lenke-coutinho-492a4b15a/) - [Github](https://github.com/matheuslenke)

<div id="additional-tools"> </div>

<p align="right">(<a href="#top">back to top</a>)</p>

Binary file added docs/images/TontoIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/TontoLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//@ts-check
const watch = process.argv.includes('--watch');
const minify = process.argv.includes('--minify');
const success = watch ? 'Watch build succeeded' : 'Build succeeded';

function getTime() {
const date = new Date();
return `[${`${padZeroes(date.getHours())}:${padZeroes(date.getMinutes())}:${padZeroes(date.getSeconds())}`}] `;
}

function padZeroes(i) {
return i.toString().padStart(2, '0');
}

require('esbuild').build({
// Two entry points, one for the extension, one for the language server
entryPoints: ['src/extension.ts', 'src/language-server/main.ts'],
outdir: 'out',
bundle: true,
loader: { '.ts': 'ts' },
external: ['vscode'], // the vscode-module is created on-the-fly and must be excluded.
platform: 'node', // VSCode extensions run in a node process
sourcemap: true,
watch: watch ? {
onRebuild(error) {
if (error) console.error(`${getTime()}Watch build failed`)
else console.log(`${getTime()}${success}`)
}
} : false,
minify
})
.then(() => console.log(`${getTime()}${success}`))
.catch(() => process.exit(1));
89 changes: 89 additions & 0 deletions examples/CarRental.tonto
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
module CarRental {
kind Person

role Employee specializes Person
role ResponsibleEmployee specializes Employee

phase DeceasedPerson specializes Person
phase LivingPerson specializes Person

disjoint complete genset LifeStatus {
general Person
specifics Employee, DeceasedPerson, LivingPerson
}

phase Child specializes LivingPerson
phase Teenager specializes LivingPerson
phase Adult specializes LivingPerson

disjoint complete genset AgePhase {
general LivingPerson
specifics Child, Teenager, Adult
}

roleMixin Customer

role PersonalCustomer specializes Customer

kind Organization

role CorporateCustomer specializes Organization

disjoint complete genset CustomerNature {
general Customer
specifics CorporateCustomer, PersonalCustomer
}

kind Car

phase AvailableCar specializes Car
phase UnderMaintenanceCar specializes Car

disjoint complete genset CarStatus {
general Car
specifics AvailableCar, UnderMaintenanceCar
}

role RentalCar specializes AvailableCar


relator CarRental {
@mediation
-- involvesRental -- [1] RentalCar

@mediation
-- involvesMediator -- [1] ResponsibleEmployee

@mediation
-- involvesCustomer --[1] Customer
}

}

module Employment {
kind Person // Redeclaração ou específico do pacote? possível ponteiro para a declaração?
role Employee specializes Person
kind Organization

relator Employment {
@mediation
-- involvesEmployee -- [1] Employee

@mediation
-- involvesEmployer -- [1] Organization
}
}

module CarOwnership {
kind Organization
subkind CarAgency
kind Car

relator CarOwnership {
@mediation
-- involvesOwner -- [1] CarAgency

@mediation
-- involvesProperty -- [1] Car
}
}
File renamed without changes.
13 changes: 13 additions & 0 deletions examples/PersonTypes.tonto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module PersonTypes {
category LegalPerson

kind Person specializes LegalPerson

kind Organization specializes LegalPerson

phase LivingPerson specializes Person

role LegallyRecognizedPerson specializes Person

phase CognitivelyCapableLivingPerson specializes LivingPerson,LegallyRecognizedPerson
}
77 changes: 0 additions & 77 deletions examples/ex1.tonto

This file was deleted.

Loading

0 comments on commit c9cdef6

Please sign in to comment.