Skip to content

Commit

Permalink
Merge pull request #20 from matheuslenke/fix/F01-fix-relations
Browse files Browse the repository at this point in the history
[Fix] Fix relations syntax
  • Loading branch information
matheuslenke authored May 28, 2024
2 parents 3e288f5 + 7bb3bf2 commit 6d9bddc
Show file tree
Hide file tree
Showing 38 changed files with 1,568 additions and 1,140 deletions.
31 changes: 13 additions & 18 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"sourceMaps": true,
"request": "launch",
"args": [
"${workspaceFolder}/examples/newGeneration",
"--extensionDevelopmentPath=${workspaceFolder}/packages/tonto-vscode"
],
"outFiles": [
"${workspaceFolder}/{packages,examples}/*/{lib,out}/**/*.js"
]
},
{
"name": "CLI: GenerateModular",
"program": "${workspaceFolder}/packages/tonto/bin/cli.js",
Expand Down Expand Up @@ -90,24 +103,6 @@
],
"cwd": "${workspaceFolder}/examples/ontouml-models/Aguiar2019ooco"
},
{
"name": "Run Extension",
"type": "extensionHost",
"sourceMaps": true,
"request": "launch",
"args": [
// "${workspaceFolder}/../tonto-example-models/Library",
// "${workspaceFolder}/../tonto-catalog/models/abel2015petroleum-system",
"${workspaceFolder}/examples/newGeneration",
"--extensionDevelopmentPath=${workspaceFolder}/packages/tonto-vscode"
],
"outFiles": [
"${workspaceFolder}/{packages,examples}/*/{lib,out}/**/*.js"
]
// "env": {
// "DEBUG_BREAK": "true"
// }
},
{
"name": "Attach to Language Server",
"type": "node",
Expand Down
124 changes: 124 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"version": "2.0.0",

"tasks": [
{
"label": "watch langium",
"hide": false,
"type": "shell",
"command": "npm run langium:watch",
"isBackground": true,
"group": "build",
"runOptions": {
"runOn": "default"
},
"options": {
"cwd": "${workspaceFolder}/packages/tonto",
},
"presentation": {
"panel": "dedicated",
"reveal": "never"
}
},
{
"label": "watch tonto",
"type": "shell",
"command": "npm run watch",
"hide": false,
"isBackground": true,
"group": "build",
"runOptions": {
"runOn": "default"
},
"options": {
"cwd": "${workspaceFolder}/packages/tonto"
},
"presentation": {
"panel": "dedicated",
"reveal": "never"
}
},
{
"label": "watch extension",
"type": "shell",
"hide": false,
"command": "npm run watch",
"isBackground": true,
"group": "build",
"runOptions": {
"runOn": "default"
},
"options": {
"cwd": "${workspaceFolder}/packages/tonto-vscode"
},
"presentation": {
"panel": "dedicated",
"reveal": "always"
}
},
{
"label": "watch tpm",
"type": "shell",
"command": "npm run watch",
"isBackground": true,
"group": "build",
"runOptions": {
"runOn": "default"
},
"options": {
"cwd": "${workspaceFolder}/packages/tonto-package-manager"
},
"presentation": {
"panel": "dedicated",
"reveal": "never"
}
},
{
"label": "watch workspace",
"command": "npm run watch",
"isBackground": true,
"group": "build",
"problemMatcher": "$tsc-watch",
"runOptions": {
"runOn": "folderOpen"
},
"options": {
"cwd": "${workspaceFolder}"
},
"presentation": {
"panel": "dedicated",
"reveal": "always"
},
"detail": "npm run watch --workspaces"
},
{
"label": "Watch all",
"dependsOn": [
"watch langium",
"watch tonto",
"watch extension",
"watch tpm"
],
"dependsOrder": "parallel",
"group": "build",
"problemMatcher": [
"$tsc-watch"
],
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}"
},
},

// Test tasks
{
"label": "test: tonto",
"command": "npm run test",
"isBackground": false,
"options": {
"cwd": "${workspaceFolder}/packages/tonto"
},
}
]
}

43 changes: 35 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ Here are some of the languages, frameworks, tools and libraries used in developm
<p align="right">(<a href="#top">back to top</a>)</p>


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

<!-- PACKAGES -->
## Packages

Expand All @@ -83,10 +81,25 @@ This project is divided in 3 packages, each of them responsible for a different
- This package is responsible for the [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=Lenke.tonto)

### [Tonto Package Manager](packages/tonto-package-manager/)
- This package is responsible for the TPM responsible for managing
- This package is responsible for the `Tonto Package Manager (TPM)`. The TPM provides a way to manage ontologies as sepparate packages, simmilarly to how programming languages work.

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

#### 4.1 Visual Studio Code Extension

The Tonto VS Code extension provides a rich editing experience with features like:

* Real-time syntax verification
* Syntax highlighting
* Autocompletion
* Code snippets
* Transformation to OntoUML (JSON) and gUFO-based OWL
* Visualization of diagrams

#### 4.2 Tonto Package Manager (TPM)

TPM enables managing dependencies between Tonto projects, facilitating code reuse and modular development.


<!-- GETTING STARTED -->
## ⌨️ Getting Started
Expand All @@ -105,26 +118,40 @@ This is all the tools you need installed to run the project and the versions tha


### ⚙️ Initializing
#### Tasks
This project defines tasks in order to be easier for vscode to build everything.

* Run `npm run langium:generate` to generate TypeScript code from the grammar definition.
* Run `npm run build` to compile all TypeScript code or `npm 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.
1. If you want to build all packages in watch mode just press `cmd` + `shift` + `b` or the equivalent command to run the build task.

2. After that, select at the debug tab the `Run Extension` command or press `F5` to run the extension in a sepparate Extension Development Host.

3. Create a new file with a file name suffix `.tonto` and start using Tonto

### 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
npm run package
# Or
vsce package --pre-release --baseContentUrl https://github.com/matheuslenke/Tonto

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

### Publishing

You can Publish the `tonto-cli` to npm and the Visual Studio Code extension to the extension marketplace

In order to publish the extension, you need to configure your azure key and your npm key locally.

Then, inside the `tonto` or `tonto-vscode` folder, run the following command:

```bash
npm run publish
```
<!-- LICENSE -->
## 🔐 License

Expand Down
22 changes: 14 additions & 8 deletions examples/newGeneration/tokens.tonto
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package CheckGeneralizationConsistency
kind Person
role Doctor specializes Person
package tokens

relation Doctor -- treats -- Person
kind B
kind A {
-- B
}

kind C {
-- name -- B
-- B
-- [1] B
[1..*] -- [1] B
[1..*] -- A
-- C.name
}

genset GeneralizationSet {
general Person
specifics Doctor.treats
}
Loading

0 comments on commit 6d9bddc

Please sign in to comment.