koreografeye

A web choreography service using eye

https://github.com/eyereasoner/koreografeye

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.1%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

A web choreography service using eye

Basic Info
  • Host: GitHub
  • Owner: eyereasoner
  • License: mit
  • Language: TypeScript
  • Default Branch: main
  • Size: 1.9 MB
Statistics
  • Stars: 11
  • Watchers: 3
  • Forks: 2
  • Open Issues: 8
  • Releases: 23
Created about 3 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License Citation

README.md

Koreografeye

npm

Koreografeye is a choreography / orchestration engine for linked data services using Notation3 (N3) rule engines such as EYE.

Koreografeye was created to facilitate automated processes against Solid pods. Our main use case is monitoring the LDN Inbox of Solid Pods for new notifications and running scripts when new data arrives.

Usage

Configuration

Create a project directory.

mkdir demo cd demo

Add the koreografeye dependency (and solid-bashlib in case you want to monitor private Solid resources).

npm install koreografeye npm install solid-bashlib

Create input, output and rules directories.

mkdir input output rules

Prepare some input data

Put a demo.jsonld AS2 notification in the input directory.

{ "@context": [ "https://www.w3.org/ns/activitystreams", "https://purl.org/coar/notify" ], "id": "urn:uuid:0370c0fb-bb78-4a9b-87f5-bed307a509dd", "type": "Offer", "actor": { "id": "https://mypod.org/profile/card#me", "name": "Freddy Test", "type": "Person" }, "object": "https://research-organisation.org/repository/preprint/201203/421/" }

Create a demo.n3 N3 rule file in the rules directory.

``` @prefix ex: http://example.org/ . @prefix as: https://www.w3.org/ns/activitystreams# . @prefix pol: https://www.example.org/ns/policy# . @prefix fno: https://w3id.org/function/ontology# .

{ # if we get an offer ?id a as:Offer . ?id as:actor ?actor . } => { # Send an accept notification to an LDN inbox ex:MySendNotificationDemo pol:policy ex:MySendNotificationDemoExecution. ex:MySendNotificationDemoExecution a fno:Execution ; fno:executes ex:sendNotification ; ex:to http://httpbin.org/post ; ex:notification ex:MyNotification .

ex:MyNotification 
    a as:Accept ;
    as:inReplyTo ?id ;
    as:actor     <http://my.service.edu/profile/card#me> ;
    as:object    ?id .

}. ```

Run orch

The orch command will take the input data and use the N3 rules to decide what to do with the data. No actions are taken yet. These will be done by the pol command.

npx orch --info --keep --in input --out output rules/demo.n3

The processed notifications will end up in the output directory

Run pol

The pol command will take the output of the orch command and execute the requested policies defined with the N3 rules.

npx pol --info --keep --in output

The result will be an AS2 that is send to the http://httpbin.org/post address.

Experiment

Using Koreografeye plugins you can experiment with:

  • Sending emails
  • Sending notifications
  • Sending push messages to your phone
  • Updating Solid Pods
  • Sending toot messages to a Mastodon account

Check the Git repository https://github.com/eyereasoner/Koreografeye for more examples.

We use the Bashlib to monitor remote Solid LDN inboxes for new notification.

E.g. move the contents of your inbox to the input directory.

npx sld mv https://yourpod.org/inbox/ input/

This assumes you have an authenticated Bashlib session. Use the bashlib auth create-token command to create a token for the CSS Solid pod.

Typescript/javascript

One can also use JavaScript to execute the orch and pol commands:

```javascript const { parseAsN3Store, readText, topGraphIds, storeAddPredicate, makeComponentsManager, executePolicies } = require('koreografeye');

main();

async function main() { const config = './config/config.jsonld'; const inputData = './input/demo.jsonld'; const inputRules = './rules/demo.n3';

// Read the input graph as an N3 store
const store  = await parseAsN3Store(inputData); 
// Read the N3 rules as an array of strings
const rules  = [readText(inputRules)]; 

// Load the components we need for reasoning
const manager = await makeComponentsManager(config,'.');

// Get a reasoner
const reasoner = await manager.instantiate('urn:koreografeye:reasonerInstance');

// Execute the reasoner (orch)
const resultStore = await reasoner.reason(store, rules);

// Execute the policies (pol)
const results = await executePolicies(manager, resultStore);

if (results) {
    let success = 0;
    let errors = 0;
    results?.forEach( (r) => { 
        if (r.result) { success += 1; }
        else { errors += 1; }
    });  
    console.log(`success: ${success} ; errors: ${errors}`);
}
else {
    console.log(`no policies executed`);
}

} ```

Run this code with:

node demo.js

Commands

orch

Run the orchstrator with one or more N3 rule files on an input directory of notifications.

bin/orch [options] rule [rule ...]

Options:

  • --config file : orchestrator configuration file
  • --in directory : directory with input notifications
  • --out directory : directory with orchestrator output
  • --err directory : directory with failed notifications
  • --single file : process only a single file
  • --keep : keep the --in data (don't delete after processing)
  • --info : verbose messages
  • --debug : debug messages
  • --trace : trace messages

pol

Run a policy executor on one of the output files of the orchestrator

bin/pol [options]

Options:

  • --config file : orchestrator configuration file
  • --in directory : directory with input notifications
  • --out directory : directory with orchestrator output
  • --err directory : directory with failed notifications
  • --single file : process only a single file
  • --keep : keep the --in data (don't delete after processing)
  • --info : verbose messages
  • --debug : debug messages
  • --trace : trace messages

Examples implementations

Owner

  • Name: EYE N3 Reasoner
  • Login: eyereasoner
  • Kind: organization

Home of the EYE N3 rule reasoner and related software libraries

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Hochstenbach"
  given-names: "Patrick"
  orcid: "https://orcid.org/0000-0001-8390-6171"
title: "Koreografeye"
version: 0.4.9
url: "https://github.com/eyereasoner/Koreografeye"

GitHub Events

Total
  • Watch event: 1
  • Delete event: 108
  • Issue comment event: 12
  • Push event: 217
  • Pull request event: 212
  • Create event: 110
Last Year
  • Watch event: 1
  • Delete event: 108
  • Issue comment event: 12
  • Push event: 217
  • Pull request event: 212
  • Create event: 110

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 9
  • Total pull requests: 237
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 4 days
  • Total issue authors: 3
  • Total pull request authors: 4
  • Average comments per issue: 0.78
  • Average comments per pull request: 0.09
  • Merged pull requests: 213
  • Bot issues: 1
  • Bot pull requests: 233
Past Year
  • Issues: 1
  • Pull requests: 145
  • Average time to close issues: 1 minute
  • Average time to close pull requests: 5 days
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.08
  • Merged pull requests: 126
  • Bot issues: 1
  • Bot pull requests: 145
Top Authors
Issue Authors
  • phochste (7)
  • dependabot[bot] (7)
  • woutslabbinck (1)
Pull Request Authors
  • dependabot[bot] (444)
  • woutslabbinck (2)
  • woutermont (2)
  • jeswr (2)
Top Labels
Issue Labels
dependencies (7) enhancement (2)
Pull Request Labels
dependencies (441)

Packages

  • Total packages: 1
  • Total downloads:
    • npm 125 last-month
  • Total dependent packages: 4
  • Total dependent repositories: 1
  • Total versions: 24
  • Total maintainers: 3
npmjs.org: koreografeye

A Solid choreography / orchestrator agent with a reasoning component

  • Homepage: http:
  • License: MIT
  • Latest release: 0.5.0
    published almost 2 years ago
  • Versions: 24
  • Dependent Packages: 4
  • Dependent Repositories: 1
  • Downloads: 125 Last month
Rankings
Dependent packages count: 4.5%
Stargazers count: 10.1%
Dependent repos count: 10.3%
Average: 10.9%
Downloads: 14.2%
Forks count: 15.4%
Last synced: 6 months ago