This is a demonstration how to run the Koreografeye reasoner.
git clone git@github.com:eyereasoner/KoreografeyeDemo.git YourProject
cd YourProject
npm install
in/
: an input directory for RDF resourcesin/demo.ttl
: an example input RDF resourceerr/
: an error directory for failed RDF resourcesout/
: an output directory for successful processed RDF resourcesrules/
: a directory containing zero or more N3 policy filesrules/*.n3
: example N3 policy files
An N3 policy can contain any valid Notation3 (N3) rule. The premise of the N3 rule should match the RDF resource one is interested in. The conclusion of the N3 rule should specify one or more policies. The policy has the format:
<PolicyName> pol:policy <PolicyDescription>
where:
<PolicyName>
is a unique identifier for the policy<PolicyDescription>
is an FnO description of the required policy
File: rules/demo.n3
- Lines 1-6 define the namespace prefixes that are used in the rule
- Line 10 binds
?id
to the main subject of the input RDF resource- This information is generated by Koreographeye and inject as a blank node into the RDF document
[ pol:mainSubject <id> ]
.
- This information is generated by Koreographeye and inject as a blank node into the RDF document
- Lines 12-13 binds
?class
to the class of the main subject and demands it is anas:Announce
or anas:Create
- Lines 17-23 define the policy that should be executed when a
?id
and?class
binding is found- Each policy must have a named identifier:
ex:MyDemoPolicy
was chosen for this example pol:policy
defines the required policy using the FnO vocabulary- A policy defines at least an
fno:executes
with a name of a policy interface - This interface can have zero or more arguments. In this example the arguments are:
ex:param1
ex:param2
ex:body
- A policy defines at least an
- Each policy must have a named identifier:
Process all RDF resource in the in
directory using the demo.n3
rule file.
Step 1. Run the orchestrator component
npx orch --info --keep --in in --out out --err err rules/demo.n3
or shorter
npm run orch:demo
This will generate a out/demo.ttl
file as output containing the input RDF resource plus injected policies.
Step 2. Run the policy executor against the output of step 1
npx pol --info --keep --single out/demo.ttl
or shorter
npm run pol
This will return some debugging output from the DemoPlugin
implementation of the demo policy.
Process all RDF resource in the in
directory using the ldn.n3
rule file.
Step 1. Run the orchestrator component
npx orch --info --keep --in in --out out --err err rules/ldn.n3
or shorter
npm run orch:ldn
This will generate a out/demo.ttl
file as output containing the input RDF resource plus injected policies.
Step 2. Run the policy executor against the output of step 1
npx pol --info --keep --single out/demo.ttl
or shorter
npm run pol
This will send a notification to https://httpbin.org/post
using the SendNotificationPlugin
implementation of the demo policy.
The ComponentsJS configuration file config.jsonld
defined all start up parameters of the Koreografeye components.
urn:koreografeye:reasonerInstance
contains arguments to pass to the internal Eye reasoner. On our example we make use of the EyeJS implementation.http://example.org/demoPlugin
defines the demo policy,demoPlugin
. The Koreografeye pluginDemoPlugin
is an implementation of this policy.http://example.org/sendNotify
defines the startup parameters of thesendNotify
policy. The Koreografeye pluginSendNotificationPlugin
is an implementation of this policy.
npx orch --help
npx pol --help