# thumder-ontology

> Ontology of THUMDER DLX - THe UltiMate Dlx EmulatoR

Latest version **1.1.1** (published 2021-10-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install thumder-ontology
pnpm add thumder-ontology
yarn add thumder-ontology
bun add thumder-ontology
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2021-10-04 |
| First published | 2021-08-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 96.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Antonio Mudarra Machuca |
| Maintainers | nonodev96 |
| Keywords | dlx, thumder, ontology |

## Links

- npm: https://www.npmjs.com/package/thumder-ontology
- Repository: https://github.com/nonodev96/thumder_ontology
- Homepage: https://github.com/nonodev96/thumder_ontology#readme
- Issues: https://github.com/nonodev96/thumder_ontology/issues
- npm.io page: https://npm.io/package/thumder-ontology

## Dependencies (9)

- [ws](https://npm.io/package/ws.md) ^8.0.0
- [express](https://npm.io/package/express.md) ^4.17.1
- [inquirer](https://npm.io/package/inquirer.md) ^8.1.2
- [socket.io](https://npm.io/package/socket.io.md) ^4.1.3
- [md5-typescript](https://npm.io/package/md5-typescript.md) ^1.0.5
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^4.1.3
- [socket.io-server](https://npm.io/package/socket.io-server.md) ^1.0.0-b
- [class-transformer](https://npm.io/package/class-transformer.md) ^0.4.0
- [datastructures-js](https://npm.io/package/datastructures-js.md) ^10.1.1

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2021-10-04
- 1.0.9 — 2021-08-18
- 1.0.8 — 2021-08-17
- 1.0.7 — 2021-08-14
- 1.0.5 — 2021-08-08
- 1.0.4 — 2021-08-08
- 1.0.3 — 2021-08-08
- 1.0.2 — 2021-08-08

## README

# THUMDER Ontology

| Command               | Description                                               |
| --------------------- | --------------------------------------------------------- |
| `npm run dev`         | Build the app. Your built files are in the `/dist` folder |
| `npm run dev:server`  | Build the example for server                              |
| `npm run dev:client`  | Build the example for client                              |
| `npm run node:server` | Execute the example for server                            |
| `npm run node:client` | Execute the example for client                            |
| `npm run test`        | Test the app with jest                                    |

## Via npm

```
npm install thumder-ontology --save
```

### Via npm with version

```
npm install thumder-ontology@<version> --save
```

## Examples

```ts
import { ACLMessage, Performative, InteractionProtocol } from "thumder-ontology";

const createFile = new CreateFile('path/to/folder', 'tests/', 'example_00.s')
const createFile_string = JSON.stringify(createFile)
const message = new ACLMessage()
message.setSender(new AID({
    name: "Client",
    localName: "Client-" + this.coreAgents.clientID,
    address: this.coreAgents.clientID
}))
message.setPerformative(Performative.REQUEST)
message.setOntology(new Ontology("Make-File"))
message.setContent(createFile_string)

this.coreAgents.addTask(new Task_CreateFile_RequestInitiator("Make-File", message)).then((data) => {
    // ... CODE
})
```

### Define Task - SERVER

```ts
import { ACLMessage, AchieveREResponder } from "thumder-ontology";

export class Task_CreateFile_RequestResponse extends AchieveREResponder {
    constructor(taskName: string) {
        super(taskName);
        console.log("Task_CreateFile_RequestResponse")
    }

    handleRequest(request: ACLMessage): ACLMessage {
        console.log("Task_CreateFile_RequestResponse handleRequest", this.getTaskName())
        const message_reply = request.createReply();
        message_reply.setPerformative(Performative.AGREE);
        return message_reply
    }
}
```

### Define Task - CLIENT

```ts
import { AchieveREInitiator, ACLMessage } from "thumder-ontology";

export class Task_CreateFile_RequestInitiator extends AchieveREInitiator {
    constructor(taskName: string, message: ACLMessage) {
        super(taskName, message)
        console.log("Task_CreateFile_RequestInitiator")
    }

    handleAgree(agree: ACLMessage): any {
        console.log("Task_CreateFile_RequestInitiator handleAgree")
        return "Agree"
    }

    handleRefuse(refuse: ACLMessage): any {
        console.log("Task_CreateFile_RequestInitiator handleRefuse")
        return "Refuse"
    }

    handleInform(inform: ACLMessage): any {
        console.log("Task_CreateFile_RequestInitiator handleInform")
        return "Inform"
    }
}
```

### Add Task

```ts
import { CoreAgentsServer } from "./CoreAgentsClient";

const coreAgents = new CoreAgentsServer(<any>io)
coreAgents.addTask(new Task_RequestResponse())

io.on("connection", (socket) => {
    socket.on("disconnect", (args) => {
        coreAgentsServer.deleteSocket(socket.id)
        consoleManager.deleteSocket(socket.id)
    })
    coreAgentsServer.addNewSocket(socket)
    consoleManager.addSocket(socket)
});
```

```ts
import { CoreAgentsClient } from "./CoreAgentsServer";

const coreAgents = new CoreAgentsClient(<any>socket)

socket.on("connect", () => {
    console.log('connect', socket.id)
    coreAgents.clientID = socket.id
})
```

## Design of ontology

#### Concept

![README_Concept](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/VocabularyConcept.puml)

#### AgentAction

![README_AgentAction](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/VocabularyAgentAction.puml)

#### Predicate

![README_Predicate](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/VocabularyPredicate.puml)

# Tasks

<div style="text-align: center">

![README_Predicate](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/2.3_Sequence.puml)

![README_Predicate](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/2.3.1_Sequence.puml)

![README_Predicate](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/2.4.1_Sequence.puml)

![README_Predicate](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/2.4_Sequence.puml)

![README_Predicate](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/2.5.1_Sequence.puml)

![README_Predicate](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/2.5_Sequence.puml)

![README_Predicate](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/nonodev96/THUMDER_ontology/master/assets/2.6_Sequence.puml)

</div>

---
_Source: https://npm.io/package/thumder-ontology · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
