Skip to content

Commit e13c159

Browse files
committed
feat: Use eyeling for reasoning
This removes the need for eye reasoner to be installed
1 parent 2d68fa4 commit e13c159

18 files changed

Lines changed: 3 additions & 45 deletions

File tree

.github/workflows/test.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ jobs:
2929

3030
steps:
3131

32-
- name: Install prolog
33-
uses: logtalk-actions/setup-swi-prolog@master
34-
35-
- name: Clone EYE repo
36-
uses: actions/checkout@v4
37-
with:
38-
repository: eyereasoner/eye
39-
40-
- name: Build EYE
41-
run: bash install.sh --prefix=$HOME/.local # This folder is available on $PATH already
42-
4332
- name: Checkout main branch
4433
uses: actions/checkout@v4
4534

Dockerfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
FROM node:22
22
ENV NODE_ENV=production
33

4-
# Install EYE reasoner
5-
RUN apt-get update \
6-
&& apt-get install swi-prolog -y \
7-
&& git clone https://github.com/eyereasoner/eye.git \
8-
&& /eye/install.sh --prefix=/usr/local \
9-
&& rm -r /eye
10-
114
WORKDIR /usr/src/app
125
COPY . .
136

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ This repository contains SolidLab research artefacts on use of UMA in the Solid
1515

1616
In order to run this project you need to perform the following steps.
1717

18-
1. Install the [eye reasoner](https://github.com/eyereasoner/eye/) and have `eye` available on your path.
19-
2. Ensure that you are using Node.js 20 or higher, e.g. by running `nvm use`. (see [.nvmrc](./.nvmrc))
18+
1. Ensure that you are using Node.js 20 or higher, e.g. by running `nvm use`. (see [.nvmrc](./.nvmrc))
2019
2. Enable Node.js Corepack with `corepack enable`.
2120
3. Run `yarn install` in the project root (this will automatically call `yarn build`).
2221
4. Run `yarn start`.

packages/uma/bin/demo.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const launch = async () => {
1717

1818
// variables['urn:uma:variables:policyDir'] = path.join(rootDir, './config/rules/policy');
1919
variables['urn:uma:variables:policyContainer'] = 'http://localhost:3000/settings/policies/';
20-
variables['urn:uma:variables:eyePath'] = 'eye';
2120
variables['urn:uma:variables:backupFilePath'] = '';
2221

2322
const configPath = path.join(rootDir, './config/demo.json');

packages/uma/bin/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const launch = async () => {
3939

4040
variables['urn:uma:variables:port'] = argv.port;
4141
variables['urn:uma:variables:baseUrl'] = argv.baseUrl ?? `http://localhost:${argv.port}/uma`;
42-
variables['urn:uma:variables:eyePath'] = 'eye';
4342
variables['urn:uma:variables:backupFilePath'] = argv.backupFilePath;
4443

4544
const configPath = path.join(rootDir, './config/default.json');

packages/uma/bin/odrl.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const launch = async () => {
1717

1818
variables['urn:uma:variables:policyBaseIRI'] = 'http://localhost:3000/';
1919
variables['urn:uma:variables:policyDir'] = path.join(rootDir, './config/rules/odrl');
20-
variables['urn:uma:variables:eyePath'] = 'eye';
2120
variables['urn:uma:variables:backupFilePath'] = '';
2221

2322
const configPath = path.join(rootDir, './config/odrl.json');

packages/uma/config/odrl.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"overrideInstance": { "@id": "urn:uma:default:Authorizer" },
1313
"overrideParameters": {
1414
"@type": "OdrlAuthorizer",
15-
"eyePath": { "@id": "urn:uma:variables:eyePath" },
1615
"policies": {
1716
"@id": "urn:uma:default:RulesStorage"
1817
}

packages/uma/config/policies/authorizers/default.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"fallback": {
5353
"@id": "urn:uma:default:OdrlAuthorizer",
5454
"@type": "OdrlAuthorizer",
55-
"eyePath": { "@id": "urn:uma:variables:eyePath" },
5655
"policies": {
5756
"@id": "urn:uma:default:RulesStorage",
5857
"@type": "FileBackupUCRulesStorage",

packages/uma/config/variables/default.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
"@id": "urn:uma:variables:policyBaseIRI",
2323
"@type": "Variable"
2424
},
25-
{
26-
"comment": "Path of the local eye reasoner.",
27-
"@id": "urn:uma:variables:eyePath",
28-
"@type": "Variable"
29-
},
3025
{
3126
"comment": "URL of container where policies are stored.",
3227
"@id": "urn:uma:variables:policyContainer",

packages/uma/src/policies/authorizers/OdrlAuthorizer.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BadRequestHttpError, DC, RDF } from '@solid/community-server';
22
import { getLoggerFor } from 'global-logger-factory';
33
import { DataFactory, Quad, Store, Writer } from 'n3';
4-
import { EyeReasoner, ODRLEngineMultipleSteps, ODRLEvaluator } from 'odrl-evaluator';
4+
import { EyelingReasoner, EyeReasoner, ODRLEngineMultipleSteps, ODRLEvaluator } from 'odrl-evaluator';
55
import { CLIENTID, WEBID } from '../../credentials/Claims';
66
import { ClaimSet } from '../../credentials/ClaimSet';
77
import { basicPolicy } from '../../ucp/policy/ODRL';
@@ -41,16 +41,11 @@ export class OdrlAuthorizer implements Authorizer {
4141
*
4242
*
4343
* @param policies - A store containing the ODRL policy rules.
44-
* @param eyePath - The path to run the local EYE reasoner, if there is one.
4544
*/
4645
constructor(
4746
private readonly policies: UCRulesStorage,
48-
eyePath?: string,
4947
) {
50-
const engine = eyePath ?
51-
new ODRLEngineMultipleSteps({ reasoner: new EyeReasoner(eyePath, ["--quiet", "--nope", "--pass-only-new"]) }) :
52-
new ODRLEngineMultipleSteps();
53-
this.odrlEvaluator = new ODRLEvaluator(engine);
48+
this.odrlEvaluator = new ODRLEvaluator(new ODRLEngineMultipleSteps({ reasoner: new EyelingReasoner()}));
5449
this.strategy = new PrioritizeProhibitionStrategy();
5550
}
5651

0 commit comments

Comments
 (0)