eyeling 1.30.3 → 1.30.5
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/README.md +5 -1
- package/examples/input/rdf-surfaces-disjunction-elimination.ttl +16 -0
- package/examples/input/rdf-surfaces-disjunction-route-filter.ttl +11 -0
- package/examples/input/rdf-surfaces-explicit-disjunction.ttl +22 -0
- package/examples/input/rdf-surfaces-strong-negation-access.ttl +14 -0
- package/examples/output/rdf-surfaces-disjunction-elimination.n3 +3 -0
- package/examples/output/rdf-surfaces-disjunction-route-filter.n3 +3 -0
- package/examples/output/rdf-surfaces-explicit-disjunction.n3 +3 -0
- package/examples/output/rdf-surfaces-strong-negation-access.n3 +4 -0
- package/examples/rdf-surfaces-disjunction-elimination.n3 +13 -0
- package/examples/rdf-surfaces-disjunction-route-filter.n3 +24 -0
- package/examples/rdf-surfaces-explicit-disjunction.n3 +16 -0
- package/examples/rdf-surfaces-strong-negation-access.n3 +20 -0
- package/package.json +1 -1
- package/test/rdf_surfaces.test.js +10 -0
package/README.md
CHANGED
|
@@ -734,9 +734,13 @@ eyeling --rdf-surfaces examples/input/rdf-surfaces-all-values-from-reverse.ttl e
|
|
|
734
734
|
eyeling --rdf-surfaces examples/input/rdf-surfaces-rdfs-range-codex.ttl examples/rdf-surfaces-rdfs-range-codex.n3
|
|
735
735
|
eyeling --rdf-surfaces examples/input/rdf-surfaces-rdfs-subclass-codex.ttl examples/rdf-surfaces-rdfs-subclass-codex.n3
|
|
736
736
|
eyeling --rdf-surfaces examples/input/rdf-surfaces-owl-all-values-from-codex.ttl examples/rdf-surfaces-owl-all-values-from-codex.n3
|
|
737
|
+
eyeling --rdf-surfaces examples/input/rdf-surfaces-strong-negation-access.ttl examples/rdf-surfaces-strong-negation-access.n3
|
|
738
|
+
eyeling --rdf-surfaces examples/input/rdf-surfaces-disjunction-route-filter.ttl examples/rdf-surfaces-disjunction-route-filter.n3
|
|
739
|
+
eyeling --rdf-surfaces examples/input/rdf-surfaces-explicit-disjunction.ttl examples/rdf-surfaces-explicit-disjunction.n3
|
|
740
|
+
eyeling --rdf-surfaces examples/input/rdf-surfaces-disjunction-elimination.ttl examples/rdf-surfaces-disjunction-elimination.n3
|
|
737
741
|
```
|
|
738
742
|
|
|
739
|
-
The additional examples show ordinary Horn-style RDF Surface patterns beyond the exact slide-33 abbreviations: subject typing (`rdf-surfaces-domain`), a two-hop property chain (`rdf-surfaces-property-chain`), recursive transitive closure (`rdf-surfaces-ancestor`), a conjunctive classification rule (`rdf-surfaces-multi-premise`), and codex-style RDFS/OWL rule generation (`rdf-surfaces-rdfs-range-codex`, `rdf-surfaces-rdfs-subclass-codex`, `rdf-surfaces-owl-all-values-from-codex`).
|
|
743
|
+
The additional examples show ordinary Horn-style RDF Surface patterns beyond the exact slide-33 abbreviations: subject typing (`rdf-surfaces-domain`), a two-hop property chain (`rdf-surfaces-property-chain`), recursive transitive closure (`rdf-surfaces-ancestor`), a conjunctive classification rule (`rdf-surfaces-multi-premise`), and codex-style RDFS/OWL rule generation (`rdf-surfaces-rdfs-range-codex`, `rdf-surfaces-rdfs-subclass-codex`, `rdf-surfaces-owl-all-values-from-codex`). More challenging examples keep the engine unchanged and add N3 helper rules on top: `rdf-surfaces-strong-negation-access` uses a top-level negative surface as a strong-negation fuse for an access policy, `rdf-surfaces-disjunction-route-filter` represents a disjunction as explicit candidate routes and filters one with a strong-negation policy, `rdf-surfaces-explicit-disjunction` puts the disjunction directly in the RDF Surface file with one outer negative surface and two inner alternatives, and `rdf-surfaces-disjunction-elimination` uses `log:forAllIn` to derive a conclusion only when every option in a disjunction implies it.
|
|
740
744
|
|
|
741
745
|
---
|
|
742
746
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# eyeling-options: --rdf-surfaces
|
|
2
|
+
@prefix ex: <http://example.org/> .
|
|
3
|
+
|
|
4
|
+
ex:caseSplit ex:option ex:ManualReview .
|
|
5
|
+
ex:caseSplit ex:option ex:AutomaticHold .
|
|
6
|
+
ex:caseSplit ex:candidateConclusion ex:NeedsHumanAttention .
|
|
7
|
+
ex:caseSplit ex:candidateConclusion ex:NoAction .
|
|
8
|
+
|
|
9
|
+
ex:ManualReview ex:implies ex:NeedsHumanAttention .
|
|
10
|
+
ex:AutomaticHold ex:implies ex:NeedsHumanAttention .
|
|
11
|
+
ex:ManualReview ex:implies ex:HasTicket .
|
|
12
|
+
|
|
13
|
+
# Strong negation: this case split must not collapse to "no action".
|
|
14
|
+
%not[
|
|
15
|
+
ex:caseSplit ex:disjunctionEntails ex:NoAction .
|
|
16
|
+
%]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# eyeling-options: --rdf-surfaces
|
|
2
|
+
@prefix ex: <http://example.org/> .
|
|
3
|
+
|
|
4
|
+
ex:shipment17 a ex:ExpressShipment .
|
|
5
|
+
ex:shipment17 ex:destination ex:CityCenter .
|
|
6
|
+
|
|
7
|
+
# Strong negation: a drone route to the city center is explicitly denied.
|
|
8
|
+
%not[ _:shipment
|
|
9
|
+
_:shipment ex:route ex:Drone .
|
|
10
|
+
_:shipment ex:destination ex:CityCenter .
|
|
11
|
+
%]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# eyeling-options: --rdf-surfaces
|
|
2
|
+
@prefix ex: <http://example.org/> .
|
|
3
|
+
|
|
4
|
+
ex:shipment23 a ex:ExpressShipment .
|
|
5
|
+
ex:shipment23 ex:destination ex:CityCenter .
|
|
6
|
+
|
|
7
|
+
# Explicit RDF Surfaces disjunction: an express shipment can go by rail or by drone.
|
|
8
|
+
%not[ _:shipment
|
|
9
|
+
_:shipment a ex:ExpressShipment .
|
|
10
|
+
%not[
|
|
11
|
+
_:shipment ex:possibleRoute ex:Rail .
|
|
12
|
+
%]
|
|
13
|
+
%not[
|
|
14
|
+
_:shipment ex:possibleRoute ex:Drone .
|
|
15
|
+
%]
|
|
16
|
+
%]
|
|
17
|
+
|
|
18
|
+
# Strong negation: drone delivery to the city center is ruled out.
|
|
19
|
+
%not[ _:shipment
|
|
20
|
+
_:shipment ex:destination ex:CityCenter .
|
|
21
|
+
_:shipment ex:selectedRoute ex:Drone .
|
|
22
|
+
%]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# eyeling-options: --rdf-surfaces
|
|
2
|
+
@prefix ex: <http://example.org/> .
|
|
3
|
+
|
|
4
|
+
ex:alice ex:requests ex:lab .
|
|
5
|
+
ex:bob ex:requests ex:lab .
|
|
6
|
+
ex:lab a ex:RestrictedArea .
|
|
7
|
+
ex:alice ex:clearance ex:general .
|
|
8
|
+
ex:bob ex:clearance ex:admin .
|
|
9
|
+
|
|
10
|
+
# Strong negation: nobody with general clearance may access the lab.
|
|
11
|
+
%not[ _:person
|
|
12
|
+
_:person ex:access ex:lab .
|
|
13
|
+
_:person ex:clearance ex:general .
|
|
14
|
+
%]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@prefix ex: <http://example.org/> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
|
|
4
|
+
# Disjunction elimination as N3 rules: if every disjunctive option implies the
|
|
5
|
+
# same candidate conclusion, then the whole disjunction entails that conclusion.
|
|
6
|
+
{ ?choice ex:candidateConclusion ?conclusion .
|
|
7
|
+
( { ?choice ex:option ?option . }
|
|
8
|
+
{ ?option ex:implies ?conclusion . } ) log:forAllIn 1 .
|
|
9
|
+
} => { ?choice ex:disjunctionEntails ?conclusion . } .
|
|
10
|
+
|
|
11
|
+
{ ?choice ex:disjunctionEntails ?conclusion . }
|
|
12
|
+
log:query
|
|
13
|
+
{ ?choice ex:disjunctionEntails ?conclusion . } .
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@prefix ex: <http://example.org/> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
|
|
4
|
+
# Extra N3 rules encode a disjunction as explicit alternatives. This does not
|
|
5
|
+
# assert both routes; it derives candidate routes that can be filtered.
|
|
6
|
+
{ ?shipment a ex:ExpressShipment . }
|
|
7
|
+
=> {
|
|
8
|
+
?shipment ex:possibleRoute ex:Rail .
|
|
9
|
+
?shipment ex:possibleRoute ex:Drone .
|
|
10
|
+
} .
|
|
11
|
+
|
|
12
|
+
# Mirror the strong-negation policy into a filterable denial fact before any
|
|
13
|
+
# candidate route is selected as viable.
|
|
14
|
+
{ ?shipment ex:destination ex:CityCenter .
|
|
15
|
+
?shipment ex:possibleRoute ex:Drone .
|
|
16
|
+
} => { ?shipment ex:stronglyNegatedRoute ex:Drone . } .
|
|
17
|
+
|
|
18
|
+
{ ?shipment ex:possibleRoute ?route .
|
|
19
|
+
1 log:notIncludes { ?shipment ex:stronglyNegatedRoute ?route . } .
|
|
20
|
+
} => { ?shipment ex:viableRoute ?route . } .
|
|
21
|
+
|
|
22
|
+
{ ?shipment ex:viableRoute ?route . }
|
|
23
|
+
log:query
|
|
24
|
+
{ ?shipment ex:viableRoute ?route . } .
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@prefix ex: <http://example.org/> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
|
|
4
|
+
# Extra N3 rules interpret the explicit surface disjunction as candidate
|
|
5
|
+
# alternatives and select the alternatives that are not strongly negated.
|
|
6
|
+
{ ?shipment ex:destination ex:CityCenter .
|
|
7
|
+
?shipment ex:possibleRoute ex:Drone .
|
|
8
|
+
} => { ?shipment ex:stronglyNegatedRoute ex:Drone . } .
|
|
9
|
+
|
|
10
|
+
{ ?shipment ex:possibleRoute ?route .
|
|
11
|
+
1 log:notIncludes { ?shipment ex:stronglyNegatedRoute ?route . } .
|
|
12
|
+
} => { ?shipment ex:selectedRoute ?route . } .
|
|
13
|
+
|
|
14
|
+
{ ?shipment ex:selectedRoute ?route . }
|
|
15
|
+
log:query
|
|
16
|
+
{ ?shipment ex:selectedRoute ?route . } .
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@prefix ex: <http://example.org/> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
|
|
4
|
+
# Extra N3 rules interpret the positive policy. The RDF Surface above remains
|
|
5
|
+
# a hard strong-negation guard: deriving the forbidden access would trip the fuse.
|
|
6
|
+
{ ?person ex:requests ?area .
|
|
7
|
+
?person ex:clearance ex:admin .
|
|
8
|
+
} => { ?person ex:access ?area . } .
|
|
9
|
+
|
|
10
|
+
{ ?person ex:requests ?area .
|
|
11
|
+
?person ex:access ?area .
|
|
12
|
+
} => { ?person ex:decision ex:Permit . } .
|
|
13
|
+
|
|
14
|
+
{ ?person ex:requests ?area .
|
|
15
|
+
1 log:notIncludes { ?person ex:decision ex:Permit . } .
|
|
16
|
+
} => { ?person ex:decision ex:Deny . } .
|
|
17
|
+
|
|
18
|
+
{ ?person ex:decision ?decision . }
|
|
19
|
+
log:query
|
|
20
|
+
{ ?person ex:decision ?decision . } .
|
package/package.json
CHANGED
|
@@ -132,6 +132,16 @@ const exampleCases = [
|
|
|
132
132
|
'rdf-surfaces-owl-all-values-from-codex',
|
|
133
133
|
'@prefix ex: <http://example.org/> .\n\nex:item43 a ex:AllowedItem .\nex:item42 a ex:AllowedItem .\nex:box a ex:AllowedContainer .\nex:crate a ex:AllowedContainer .',
|
|
134
134
|
],
|
|
135
|
+
[
|
|
136
|
+
'rdf-surfaces-strong-negation-access',
|
|
137
|
+
'@prefix ex: <http://example.org/> .\n\nex:bob ex:decision ex:Permit .\nex:alice ex:decision ex:Deny .',
|
|
138
|
+
],
|
|
139
|
+
['rdf-surfaces-disjunction-route-filter', '@prefix ex: <http://example.org/> .\n\nex:shipment17 ex:viableRoute ex:Rail .'],
|
|
140
|
+
['rdf-surfaces-explicit-disjunction', '@prefix ex: <http://example.org/> .\n\nex:shipment23 ex:selectedRoute ex:Rail .'],
|
|
141
|
+
[
|
|
142
|
+
'rdf-surfaces-disjunction-elimination',
|
|
143
|
+
'@prefix ex: <http://example.org/> .\n\nex:caseSplit ex:disjunctionEntails ex:NeedsHumanAttention .',
|
|
144
|
+
],
|
|
135
145
|
];
|
|
136
146
|
|
|
137
147
|
let seq = 0;
|