eyeling 1.5.38 → 1.5.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/oslo-steps-library-scholarly.n3 +144 -183
- package/examples/oslo-steps-workflow-composition.n3 +192 -217
- package/examples/output/oslo-steps-library-scholarly.n3 +672 -392
- package/examples/output/oslo-steps-workflow-composition.n3 +96 -56
- package/eyeling.js +779 -804
- package/package.json +1 -1
|
@@ -1,23 +1,48 @@
|
|
|
1
|
-
#
|
|
2
|
-
# OSLO-STEPS
|
|
1
|
+
# =======================================================================================
|
|
2
|
+
# OSLO-STEPS — minimal “Library / Scholarly access” workflow composition example
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
# A
|
|
4
|
+
# Purpose
|
|
5
|
+
# A compact, representative test case for Eyeling/EYE workflow composition in the
|
|
6
|
+
# OSLO-STEPS style, without SHACL or shape machinery.
|
|
6
7
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
8
|
+
# What it models
|
|
9
|
+
# A scholar (Alice) wants access to a scholarly item. The workflow progresses through
|
|
10
|
+
# five “state flags”:
|
|
11
|
+
# 1) identityVerified
|
|
12
|
+
# 2) affiliationVerified
|
|
13
|
+
# 3) requestSubmitted
|
|
14
|
+
# 4) itemLocated
|
|
15
|
+
# 5) accessGranted
|
|
14
16
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
+
# OSLO-STEPS core used
|
|
18
|
+
# - Each step is an o-steps:Step with:
|
|
19
|
+
# o-steps:requiresState (precondition state)
|
|
20
|
+
# o-steps:producesState (postcondition state)
|
|
21
|
+
# plus simple costs:
|
|
22
|
+
# cost:duration, cost:monetaryCost, cost:success, cost:usersatifaction
|
|
17
23
|
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
24
|
+
# State representation
|
|
25
|
+
# - Each “State” is stored as a quoted N3 formula term in state:si :formula { ... }.
|
|
26
|
+
# - We use var:x inside formulas as a stable placeholder to avoid variable-renaming
|
|
27
|
+
# explosions and to keep formula-term matching predictable.
|
|
28
|
+
#
|
|
29
|
+
# Compilation and planning
|
|
30
|
+
# - A small compiler turns each o-steps:Step into a gps:description transition:
|
|
31
|
+
# (FROM true TO STEP duration cost success satisfaction)
|
|
32
|
+
# - A minimal planner composes gps:description transitions into a gps:path by chaining
|
|
33
|
+
# them and aggregating metrics:
|
|
34
|
+
# duration + monetaryCost = sum
|
|
35
|
+
# success * satisfaction = product
|
|
36
|
+
# - No “fuel” bound is used here; termination is ensured because the workflow graph is
|
|
37
|
+
# acyclic (s0 -> s1 -> s2 -> s3 -> s4 -> s5) and has a finite number of alternatives.
|
|
38
|
+
#
|
|
39
|
+
# Output
|
|
40
|
+
# - Derives :alice gps:path ( ?Steps ?Duration ?Cost ?Success ?Satisfaction ).
|
|
41
|
+
#
|
|
42
|
+
# Run (examples)
|
|
43
|
+
# eye --quiet --nope --pass-only-new oslo-steps-library-scholarly-min.n3
|
|
44
|
+
# node eyeling.js oslo-steps-library-scholarly-min.n3
|
|
45
|
+
# =======================================================================================
|
|
21
46
|
|
|
22
47
|
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
|
|
23
48
|
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
|
|
@@ -25,7 +50,7 @@
|
|
|
25
50
|
@prefix : <https://eyereasoner.github.io/eye/reasoning#>.
|
|
26
51
|
|
|
27
52
|
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
|
|
28
|
-
@prefix
|
|
53
|
+
@prefix var: <http://www.w3.org/2000/10/swap/var#>.
|
|
29
54
|
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
|
|
30
55
|
|
|
31
56
|
@prefix o-steps: <https://fast.ilabt.imec.be/ns/oslo-steps#>.
|
|
@@ -34,10 +59,9 @@
|
|
|
34
59
|
@prefix cost: <https://example.org/cost#>.
|
|
35
60
|
@prefix state: <https://example.org/states#>.
|
|
36
61
|
@prefix step: <https://example.org/steps#>.
|
|
37
|
-
@prefix shape: <https://example.org/shapes#>.
|
|
38
62
|
|
|
39
|
-
#
|
|
40
|
-
# 1)
|
|
63
|
+
# -----------------------------------------------------------------------------
|
|
64
|
+
# 1) States as formula terms (no SHACL)
|
|
41
65
|
#
|
|
42
66
|
# State signature booleans (5):
|
|
43
67
|
# ex:identityVerified (can the scholar authenticate?)
|
|
@@ -45,79 +69,73 @@
|
|
|
45
69
|
# ex:requestSubmitted (has the access request been submitted?)
|
|
46
70
|
# ex:itemLocated (did we locate a route to the item?)
|
|
47
71
|
# ex:accessGranted (final: scholar can access/download)
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
state:s0
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
#
|
|
107
|
-
shape:s5ID a sh:PropertyShape; sh:path ex:identityVerified; sh:hasValue true; sh:minCount 1.
|
|
108
|
-
shape:s5AFF a sh:PropertyShape; sh:path ex:affiliationVerified; sh:hasValue true; sh:minCount 1.
|
|
109
|
-
shape:s5REQ a sh:PropertyShape; sh:path ex:requestSubmitted; sh:hasValue true; sh:minCount 1.
|
|
110
|
-
shape:s5LOC a sh:PropertyShape; sh:path ex:itemLocated; sh:hasValue true; sh:minCount 1.
|
|
111
|
-
shape:s5ACC a sh:PropertyShape; sh:path ex:accessGranted; sh:hasValue true; sh:minCount 1.
|
|
112
|
-
|
|
113
|
-
# Steps + costs (branching, but still a DAG)
|
|
72
|
+
# -----------------------------------------------------------------------------
|
|
73
|
+
|
|
74
|
+
state:s0 :formula {
|
|
75
|
+
var:x a foaf:Person.
|
|
76
|
+
var:x ex:identityVerified false.
|
|
77
|
+
var:x ex:affiliationVerified false.
|
|
78
|
+
var:x ex:requestSubmitted false.
|
|
79
|
+
var:x ex:itemLocated false.
|
|
80
|
+
var:x ex:accessGranted false.
|
|
81
|
+
}.
|
|
82
|
+
|
|
83
|
+
state:s1 :formula {
|
|
84
|
+
var:x a foaf:Person.
|
|
85
|
+
var:x ex:identityVerified true.
|
|
86
|
+
var:x ex:affiliationVerified false.
|
|
87
|
+
var:x ex:requestSubmitted false.
|
|
88
|
+
var:x ex:itemLocated false.
|
|
89
|
+
var:x ex:accessGranted false.
|
|
90
|
+
}.
|
|
91
|
+
|
|
92
|
+
state:s2 :formula {
|
|
93
|
+
var:x a foaf:Person.
|
|
94
|
+
var:x ex:identityVerified true.
|
|
95
|
+
var:x ex:affiliationVerified true.
|
|
96
|
+
var:x ex:requestSubmitted false.
|
|
97
|
+
var:x ex:itemLocated false.
|
|
98
|
+
var:x ex:accessGranted false.
|
|
99
|
+
}.
|
|
100
|
+
|
|
101
|
+
state:s3 :formula {
|
|
102
|
+
var:x a foaf:Person.
|
|
103
|
+
var:x ex:identityVerified true.
|
|
104
|
+
var:x ex:affiliationVerified true.
|
|
105
|
+
var:x ex:requestSubmitted true.
|
|
106
|
+
var:x ex:itemLocated false.
|
|
107
|
+
var:x ex:accessGranted false.
|
|
108
|
+
}.
|
|
109
|
+
|
|
110
|
+
state:s4 :formula {
|
|
111
|
+
var:x a foaf:Person.
|
|
112
|
+
var:x ex:identityVerified true.
|
|
113
|
+
var:x ex:affiliationVerified true.
|
|
114
|
+
var:x ex:requestSubmitted true.
|
|
115
|
+
var:x ex:itemLocated true.
|
|
116
|
+
var:x ex:accessGranted false.
|
|
117
|
+
}.
|
|
118
|
+
|
|
119
|
+
state:s5 :formula {
|
|
120
|
+
var:x a foaf:Person.
|
|
121
|
+
var:x ex:identityVerified true.
|
|
122
|
+
var:x ex:affiliationVerified true.
|
|
123
|
+
var:x ex:requestSubmitted true.
|
|
124
|
+
var:x ex:itemLocated true.
|
|
125
|
+
var:x ex:accessGranted true.
|
|
126
|
+
}.
|
|
127
|
+
|
|
128
|
+
# -----------------------------------------------------------------------------
|
|
129
|
+
# 2) Steps (OSLO-STEPS core) + costs
|
|
130
|
+
#
|
|
114
131
|
# Costs:
|
|
115
132
|
# cost:duration (minutes)
|
|
116
133
|
# cost:monetaryCost (arbitrary units)
|
|
117
134
|
# cost:success (0..1)
|
|
118
|
-
# cost:usersatifaction (0..1)
|
|
135
|
+
# cost:usersatifaction (0..1) (keep spelling consistent with earlier examples)
|
|
136
|
+
# -----------------------------------------------------------------------------
|
|
119
137
|
|
|
120
|
-
# s0 -> s1 (identity
|
|
138
|
+
# s0 -> s1 (identity)
|
|
121
139
|
step:verifyIdentitySSO a o-steps:Step;
|
|
122
140
|
rdfs:label "Verify identity (SSO)"@en;
|
|
123
141
|
o-steps:requiresState state:s0; o-steps:producesState state:s1;
|
|
@@ -128,7 +146,7 @@ step:verifyIdentityDesk a o-steps:Step;
|
|
|
128
146
|
o-steps:requiresState state:s0; o-steps:producesState state:s1;
|
|
129
147
|
cost:duration 20.0; cost:monetaryCost 0.0; cost:success 0.995; cost:usersatifaction 0.85.
|
|
130
148
|
|
|
131
|
-
# s1 -> s2 (affiliation
|
|
149
|
+
# s1 -> s2 (affiliation)
|
|
132
150
|
step:verifyAffiliationAuto a o-steps:Step;
|
|
133
151
|
rdfs:label "Verify affiliation (automatic)"@en;
|
|
134
152
|
o-steps:requiresState state:s1; o-steps:producesState state:s2;
|
|
@@ -150,7 +168,7 @@ step:submitRequestLibrarian a o-steps:Step;
|
|
|
150
168
|
o-steps:requiresState state:s2; o-steps:producesState state:s3;
|
|
151
169
|
cost:duration 15.0; cost:monetaryCost 0.0; cost:success 0.99; cost:usersatifaction 0.90.
|
|
152
170
|
|
|
153
|
-
# s3 -> s4 (locate item
|
|
171
|
+
# s3 -> s4 (locate item)
|
|
154
172
|
step:locateViaCatalogue a o-steps:Step;
|
|
155
173
|
rdfs:label "Locate item (catalogue + resolver)"@en;
|
|
156
174
|
o-steps:requiresState state:s3; o-steps:producesState state:s4;
|
|
@@ -165,71 +183,32 @@ step:locateViaDiscovery a o-steps:Step;
|
|
|
165
183
|
step:grantAccessOpenAccess a o-steps:Step;
|
|
166
184
|
rdfs:label "Grant access (open access)"@en;
|
|
167
185
|
o-steps:requiresState state:s4; o-steps:producesState state:s5;
|
|
168
|
-
cost:duration 1.0; cost:monetaryCost 0.0;
|
|
186
|
+
cost:duration 1.0; cost:monetaryCost 0.0; cost:success 0.92; cost:usersatifaction 0.97.
|
|
169
187
|
|
|
170
188
|
step:grantAccessSubscription a o-steps:Step;
|
|
171
189
|
rdfs:label "Grant access (subscription)"@en;
|
|
172
190
|
o-steps:requiresState state:s4; o-steps:producesState state:s5;
|
|
173
|
-
cost:duration 2.0; cost:monetaryCost 0.5;
|
|
191
|
+
cost:duration 2.0; cost:monetaryCost 0.5; cost:success 0.97; cost:usersatifaction 0.94.
|
|
174
192
|
|
|
175
193
|
step:grantAccessInterlibraryLoan a o-steps:Step;
|
|
176
194
|
rdfs:label "Grant access (interlibrary loan)"@en;
|
|
177
195
|
o-steps:requiresState state:s4; o-steps:producesState state:s5;
|
|
178
196
|
cost:duration 2880.0; cost:monetaryCost 5.0; cost:success 0.985; cost:usersatifaction 0.80.
|
|
179
197
|
|
|
180
|
-
#
|
|
181
|
-
#
|
|
182
|
-
#
|
|
183
|
-
# 2.1) StateShape -> State constraints (targetClass, path, value)
|
|
184
|
-
{ ?STATE :constraint (?TARGET ?PATH ?VALUE). } <=
|
|
185
|
-
{
|
|
186
|
-
?STATE o-steps:hasStateShape ?SHAPE.
|
|
187
|
-
?SHAPE sh:targetClass ?TARGET.
|
|
188
|
-
?SHAPE sh:property ?PS.
|
|
189
|
-
?PS sh:path ?PATH.
|
|
190
|
-
?PS sh:hasValue ?VALUE.
|
|
191
|
-
?PS sh:minCount 1.
|
|
192
|
-
}.
|
|
198
|
+
# -----------------------------------------------------------------------------
|
|
199
|
+
# 3) Compile OSLO-STEPS core -> internal gps:description transitions
|
|
200
|
+
# -----------------------------------------------------------------------------
|
|
193
201
|
|
|
194
|
-
# 2.2) Step -> internal gps:description transition (compiled)
|
|
195
|
-
# We compile FROM/TO formulas from required/produced state constraints.
|
|
196
202
|
{
|
|
197
|
-
ex:libmap gps:description
|
|
198
|
-
(
|
|
199
|
-
{ ?x a ?T.
|
|
200
|
-
?x ex:identityVerified ?ID1.
|
|
201
|
-
?x ex:affiliationVerified ?AFF1.
|
|
202
|
-
?x ex:requestSubmitted ?REQ1.
|
|
203
|
-
?x ex:itemLocated ?LOC1.
|
|
204
|
-
?x ex:accessGranted ?ACC1.
|
|
205
|
-
}
|
|
206
|
-
true
|
|
207
|
-
{ ?x a ?T.
|
|
208
|
-
?x ex:identityVerified ?ID2.
|
|
209
|
-
?x ex:affiliationVerified ?AFF2.
|
|
210
|
-
?x ex:requestSubmitted ?REQ2.
|
|
211
|
-
?x ex:itemLocated ?LOC2.
|
|
212
|
-
?x ex:accessGranted ?ACC2.
|
|
213
|
-
}
|
|
214
|
-
?STEP
|
|
215
|
-
?DUR ?MC ?SUC ?SAT
|
|
216
|
-
).
|
|
203
|
+
ex:libmap gps:description ( ?FROM true ?TO ?STEP ?DUR ?MC ?SUC ?SAT ).
|
|
217
204
|
} <=
|
|
218
205
|
{
|
|
219
|
-
?STEP o-steps:
|
|
220
|
-
?STEP o-steps:
|
|
206
|
+
?STEP a o-steps:Step.
|
|
207
|
+
?STEP o-steps:requiresState ?REQ.
|
|
208
|
+
?STEP o-steps:producesState ?PROD.
|
|
221
209
|
|
|
222
|
-
?
|
|
223
|
-
?
|
|
224
|
-
?REQSTATE :constraint (?T ex:requestSubmitted ?REQ1).
|
|
225
|
-
?REQSTATE :constraint (?T ex:itemLocated ?LOC1).
|
|
226
|
-
?REQSTATE :constraint (?T ex:accessGranted ?ACC1).
|
|
227
|
-
|
|
228
|
-
?PRODSTATE :constraint (?T ex:identityVerified ?ID2).
|
|
229
|
-
?PRODSTATE :constraint (?T ex:affiliationVerified ?AFF2).
|
|
230
|
-
?PRODSTATE :constraint (?T ex:requestSubmitted ?REQ2).
|
|
231
|
-
?PRODSTATE :constraint (?T ex:itemLocated ?LOC2).
|
|
232
|
-
?PRODSTATE :constraint (?T ex:accessGranted ?ACC2).
|
|
210
|
+
?REQ :formula ?FROM.
|
|
211
|
+
?PROD :formula ?TO.
|
|
233
212
|
|
|
234
213
|
?STEP cost:duration ?DUR.
|
|
235
214
|
?STEP cost:monetaryCost ?MC.
|
|
@@ -237,28 +216,23 @@ step:grantAccessInterlibraryLoan a o-steps:Step;
|
|
|
237
216
|
?STEP cost:usersatifaction ?SAT.
|
|
238
217
|
}.
|
|
239
218
|
|
|
240
|
-
#
|
|
241
|
-
#
|
|
242
|
-
#
|
|
243
|
-
|
|
244
|
-
{
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
219
|
+
# -----------------------------------------------------------------------------
|
|
220
|
+
# 4) Start + planner (NO fuel; terminates because workflow is acyclic)
|
|
221
|
+
# -----------------------------------------------------------------------------
|
|
222
|
+
|
|
223
|
+
:alice :start {
|
|
224
|
+
var:x a foaf:Person.
|
|
225
|
+
var:x ex:identityVerified false.
|
|
226
|
+
var:x ex:affiliationVerified false.
|
|
227
|
+
var:x ex:requestSubmitted false.
|
|
228
|
+
var:x ex:itemLocated false.
|
|
229
|
+
var:x ex:accessGranted false.
|
|
251
230
|
}.
|
|
252
231
|
|
|
253
|
-
# ----------
|
|
254
|
-
# 4) PLANNER
|
|
255
|
-
# ----------
|
|
256
232
|
# Base: one step is a path
|
|
257
233
|
{ (?From ?To (?Act) ?Dur ?Cost ?Suc ?Sat) :path true. }
|
|
258
234
|
<=
|
|
259
|
-
{
|
|
260
|
-
ex:libmap gps:description (?From true ?To ?Act ?Dur ?Cost ?Suc ?Sat).
|
|
261
|
-
}.
|
|
235
|
+
{ ex:libmap gps:description (?From true ?To ?Act ?Dur ?Cost ?Suc ?Sat). }.
|
|
262
236
|
|
|
263
237
|
# Recursive: step + rest, aggregate
|
|
264
238
|
{ (?From ?To ?Acts ?Dur ?Cost ?Suc ?Sat) :path true. }
|
|
@@ -276,41 +250,28 @@ step:grantAccessInterlibraryLoan a o-steps:Step;
|
|
|
276
250
|
|
|
277
251
|
# Wrapper: OSLO-like findpath with bounds
|
|
278
252
|
{
|
|
279
|
-
:scope gps:findpath
|
|
280
|
-
(
|
|
281
|
-
?GOAL
|
|
282
|
-
?PATH
|
|
283
|
-
?DURATION
|
|
284
|
-
?MONETARYCOST
|
|
285
|
-
?SUCCESS
|
|
286
|
-
?SATISFACTION
|
|
287
|
-
(?DL ?CL ?SL ?AL)
|
|
288
|
-
).
|
|
253
|
+
:scope gps:findpath ( ?GOAL ?PATH ?DUR ?COST ?SUC ?SAT (?DL ?CL ?SL ?AL) ).
|
|
289
254
|
} <=
|
|
290
255
|
{
|
|
291
256
|
:alice :start ?START.
|
|
292
|
-
(?START ?GOAL ?PATH ?
|
|
257
|
+
(?START ?GOAL ?PATH ?DUR ?COST ?SUC ?SAT) :path true.
|
|
293
258
|
|
|
294
|
-
?
|
|
295
|
-
?
|
|
296
|
-
?
|
|
297
|
-
?
|
|
259
|
+
?DUR math:lessThan ?DL.
|
|
260
|
+
?COST math:lessThan ?CL.
|
|
261
|
+
?SUC math:greaterThan ?SL.
|
|
262
|
+
?SAT math:greaterThan ?AL.
|
|
298
263
|
}.
|
|
299
264
|
|
|
300
|
-
#
|
|
301
|
-
# 5)
|
|
302
|
-
#
|
|
265
|
+
# -----------------------------------------------------------------------------
|
|
266
|
+
# 5) Goal query -> output
|
|
267
|
+
# -----------------------------------------------------------------------------
|
|
268
|
+
|
|
303
269
|
{
|
|
270
|
+
state:s5 :formula ?GOAL.
|
|
271
|
+
|
|
304
272
|
:scope gps:findpath
|
|
305
273
|
(
|
|
306
|
-
|
|
307
|
-
?x a foaf:Person.
|
|
308
|
-
?x ex:identityVerified true.
|
|
309
|
-
?x ex:affiliationVerified true.
|
|
310
|
-
?x ex:requestSubmitted true.
|
|
311
|
-
?x ex:itemLocated true.
|
|
312
|
-
?x ex:accessGranted true.
|
|
313
|
-
}
|
|
274
|
+
?GOAL
|
|
314
275
|
?PATH ?DUR ?COST ?SUC ?SAT
|
|
315
276
|
(
|
|
316
277
|
5000.0 # duration limit (minutes)
|