eyelang 1.5.2 → 1.5.4
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 +2 -0
- package/examples/access-control-policy.pl +3 -0
- package/examples/ackermann.pl +3 -0
- package/examples/age.pl +3 -0
- package/examples/aliases-and-namespaces.pl +7 -0
- package/examples/alignment-demo.pl +3 -0
- package/examples/allen-interval-calculus.pl +3 -0
- package/examples/ancestor.pl +7 -0
- package/examples/animal.pl +3 -0
- package/examples/annotation.pl +3 -0
- package/examples/auroracare.pl +309 -0
- package/examples/backward.pl +3 -0
- package/examples/basic-monadic.pl +3 -1
- package/examples/bayes-diagnosis.pl +3 -0
- package/examples/bayes-therapy.pl +3 -0
- package/examples/beam-deflection.pl +3 -0
- package/examples/blocks-world-planning.pl +3 -0
- package/examples/bmi.pl +3 -0
- package/examples/braking-safety-worlds.pl +3 -0
- package/examples/buck-converter-design.pl +3 -0
- package/examples/cache-performance.pl +3 -0
- package/examples/canary-release.pl +3 -0
- package/examples/cat-koko.pl +3 -0
- package/examples/clinical-trial-screening.pl +3 -0
- package/examples/collatz-1000.pl +3 -0
- package/examples/combinatorics-findall-sort.pl +6 -0
- package/examples/competitive-enzyme-kinetics.pl +3 -0
- package/examples/complex-matrix-stability.pl +3 -0
- package/examples/complex.pl +3 -0
- package/examples/composition-of-injective-functions-is-injective.pl +3 -0
- package/examples/context-association.pl +3 -0
- package/examples/control-system.pl +3 -0
- package/examples/cryptarithmetic-send-more-money.pl +3 -0
- package/examples/cyclic-path.pl +3 -1
- package/examples/d3-group.pl +8 -0
- package/examples/dairy-energy-balance.pl +3 -0
- package/examples/data-negotiation.pl +6 -0
- package/examples/deep-taxonomy-10.pl +3 -0
- package/examples/deep-taxonomy-100.pl +3 -0
- package/examples/deep-taxonomy-1000.pl +3 -0
- package/examples/deep-taxonomy-10000.pl +3 -0
- package/examples/deep-taxonomy-100000.pl +3 -0
- package/examples/delfour.pl +18 -1
- package/examples/dense-hamiltonian-cycle.pl +3 -0
- package/examples/deontic-logic.pl +6 -0
- package/examples/derived-backward-rule.pl +3 -0
- package/examples/derived-rule.pl +3 -0
- package/examples/diamond-property.pl +3 -0
- package/examples/dijkstra-findall-sort.pl +6 -0
- package/examples/dijkstra-risk-path.pl +3 -0
- package/examples/dijkstra.pl +3 -0
- package/examples/dining-philosophers.pl +3 -0
- package/examples/dog.pl +5 -0
- package/examples/drone-corridor-planner.pl +3 -0
- package/examples/easter-computus.pl +6 -0
- package/examples/electrical-rc-filter.pl +3 -0
- package/examples/epidemic-policy.pl +6 -0
- package/examples/equivalence-classes-overlap-implies-same-class.pl +3 -0
- package/examples/eulerian-path.pl +6 -0
- package/examples/ev-range-worlds.pl +3 -0
- package/examples/exact-cover-sudoku.pl +3 -0
- package/examples/existential-rule.pl +3 -0
- package/examples/exoplanet-validation-worlds.pl +3 -0
- package/examples/expression-eval.pl +5 -0
- package/examples/family-cousins.pl +3 -0
- package/examples/fastpow.pl +5 -0
- package/examples/fft8-numeric.pl +6 -0
- package/examples/fibonacci.pl +3 -0
- package/examples/field-nitrogen-balance.pl +3 -0
- package/examples/flandor.pl +296 -0
- package/examples/floating-point.pl +5 -0
- package/examples/four-color-map.pl +3 -0
- package/examples/fundamental-theorem-arithmetic.pl +3 -0
- package/examples/gcd-bezout-identity.pl +3 -0
- package/examples/gd-step-certified.pl +3 -0
- package/examples/gdpr-compliance.pl +6 -0
- package/examples/goldbach-1000.pl +3 -0
- package/examples/good-cobbler.pl +3 -0
- package/examples/gps.pl +3 -0
- package/examples/graph-reachability.pl +3 -0
- package/examples/gray-code-counter.pl +6 -0
- package/examples/greatest-lower-bound-uniqueness.pl +3 -0
- package/examples/group-inverse-uniqueness.pl +3 -0
- package/examples/hamiltonian-cycle.pl +3 -0
- package/examples/hamiltonian-path.pl +3 -0
- package/examples/hamming-code.pl +3 -0
- package/examples/hanoi.pl +3 -0
- package/examples/heat-loss.pl +3 -0
- package/examples/heron-theorem.pl +5 -0
- package/examples/ideal-gas-law.pl +3 -0
- package/examples/illegitimate-reasoning.pl +3 -0
- package/examples/kaprekar.pl +3 -0
- package/examples/law-of-cosines.pl +5 -0
- package/examples/least-squares-regression.pl +3 -0
- package/examples/list-collection.pl +5 -0
- package/examples/lldm.pl +3 -0
- package/examples/manufacturing-quality-control.pl +3 -0
- package/examples/matrix.pl +3 -0
- package/examples/microgrid-dispatch.pl +3 -0
- package/examples/monkey-bananas.pl +3 -0
- package/examples/n-queens.pl +3 -0
- package/examples/network-sla.pl +3 -0
- package/examples/newton-raphson.pl +3 -0
- package/examples/nixon-diamond.pl +3 -0
- package/examples/odrl-dpv-healthcare-risk-ranked.pl +3 -0
- package/examples/odrl-dpv-risk-ranked.pl +3 -0
- package/examples/orbital-transfer-design.pl +3 -0
- package/examples/output/auroracare.pl +117 -0
- package/examples/output/delfour.pl +7 -1
- package/examples/output/flandor.pl +43 -0
- package/examples/path-discovery.pl +3 -0
- package/examples/peano-arithmetic.pl +3 -0
- package/examples/peasant.pl +5 -0
- package/examples/pendulum-period.pl +3 -0
- package/examples/polynomial.pl +3 -0
- package/examples/project-portfolio-optimization.pl +3 -0
- package/examples/proof-contrapositive.pl +3 -0
- package/examples/quadratic-formula.pl +3 -0
- package/examples/quine-mccluskey.pl +3 -0
- package/examples/radioactive-decay.pl +3 -0
- package/examples/sat-dpll.pl +3 -0
- package/examples/security-incident-correlation.pl +3 -0
- package/examples/service-impact.pl +3 -0
- package/examples/sieve.pl +3 -0
- package/examples/skolem-functions.pl +3 -0
- package/examples/socket-age.pl +3 -0
- package/examples/socket-family.pl +3 -0
- package/examples/socrates.pl +3 -0
- package/examples/statistics-summary.pl +3 -0
- package/examples/sudoku.pl +3 -0
- package/examples/superdense-coding.pl +3 -0
- package/examples/traveling-salesman.pl +6 -0
- package/examples/turing.pl +3 -0
- package/examples/vector-similarity.pl +6 -0
- package/examples/witch.pl +3 -0
- package/examples/wolf-goat-cabbage.pl +3 -0
- package/examples/zebra.pl +3 -0
- package/package.json +1 -1
- package/playground.html +2 -0
package/README.md
CHANGED
|
@@ -328,6 +328,7 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
328
328
|
| [`ancestor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/ancestor.pl) | Derives ancestors from parent facts. | [`output/ancestor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/ancestor.pl) |
|
|
329
329
|
| [`animal.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/animal.pl) | Classifies animals from traits. | [`output/animal.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/animal.pl) |
|
|
330
330
|
| [`annotation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/annotation.pl) | Derives facts from quoted annotation data. | [`output/annotation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/annotation.pl) |
|
|
331
|
+
| [`auroracare.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/auroracare.pl) | Evaluates purpose-based medical data access scenarios. | [`output/auroracare.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/auroracare.pl) |
|
|
331
332
|
| [`backward.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/backward.pl) | Shows a backward-rule pattern as a goal-directed numeric rule. | [`output/backward.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/backward.pl) |
|
|
332
333
|
| [`basic-monadic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/basic-monadic.pl) | Runs a monadic benchmark over generated inputs. | [`output/basic-monadic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/basic-monadic.pl) |
|
|
333
334
|
| [`bayes-diagnosis.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/bayes-diagnosis.pl) | Computes scaled Bayesian diagnosis posteriors. | [`output/bayes-diagnosis.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/bayes-diagnosis.pl) |
|
|
@@ -387,6 +388,7 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
387
388
|
| [`fibonacci.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/fibonacci.pl) | Computes large Fibonacci numbers by fast doubling. | [`output/fibonacci.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/fibonacci.pl) |
|
|
388
389
|
| [`field-nitrogen-balance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/field-nitrogen-balance.pl) | Classifies field nitrogen balance. | [`output/field-nitrogen-balance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/field-nitrogen-balance.pl) |
|
|
389
390
|
| [`floating-point.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/floating-point.pl) | Exercises floating-point arithmetic and comparisons. | [`output/floating-point.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/floating-point.pl) |
|
|
391
|
+
| [`flandor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/flandor.pl) | Derives a Flanders macro-insight authorization and retooling package. | [`output/flandor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/flandor.pl) |
|
|
390
392
|
| [`four-color-map.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/four-color-map.pl) | Checks a four-colour map assignment. | [`output/four-color-map.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/four-color-map.pl) |
|
|
391
393
|
| [`fundamental-theorem-arithmetic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/fundamental-theorem-arithmetic.pl) | Factors integers and reconstructs products. | [`output/fundamental-theorem-arithmetic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/fundamental-theorem-arithmetic.pl) |
|
|
392
394
|
| [`gcd-bezout-identity.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/gcd-bezout-identity.pl) | Computes gcd and Bézout coefficients. | [`output/gcd-bezout-identity.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/gcd-bezout-identity.pl) |
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
% finite logical conditions. The universal allOf/noneOf checks use negation
|
|
5
5
|
% as failure over bound policy facts.
|
|
6
6
|
|
|
7
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
7
8
|
materialize(policy, 2).
|
|
8
9
|
materialize(status, 2).
|
|
9
10
|
materialize(reason, 2).
|
|
10
11
|
|
|
12
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
11
13
|
policy_request(test1, policy_x).
|
|
12
14
|
has(test1, claim_a).
|
|
13
15
|
has(test1, claim_b).
|
|
@@ -19,6 +21,7 @@ allOf(policy_x, claim_b).
|
|
|
19
21
|
anyOf(policy_x, claim_c).
|
|
20
22
|
noneOf(policy_x, claim_d).
|
|
21
23
|
|
|
24
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
22
25
|
passes_all_of(Request, Policy) :-
|
|
23
26
|
policy_request(Request, Policy),
|
|
24
27
|
policy(Policy),
|
package/examples/ackermann.pl
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
% The two-argument entry point follows the Eyeling encoding:
|
|
3
3
|
% ackermann(X, Y) = hyper(X, Y + 3, 2) - 3.
|
|
4
4
|
|
|
5
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
5
6
|
materialize(ackermann, 2).
|
|
6
7
|
|
|
8
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
9
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
7
10
|
ackermann(X, Y, A) :-
|
|
8
11
|
add(Y, 3, B),
|
|
9
12
|
hyper(X, B, 2, C),
|
package/examples/age.pl
CHANGED
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
% Is the age of a person above some duration?
|
|
4
4
|
|
|
5
5
|
% Person data.
|
|
6
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
6
7
|
materialize(birthDay, 2).
|
|
7
8
|
materialize(duration, 2).
|
|
8
9
|
materialize(ageAbove, 2).
|
|
9
10
|
materialize(is, 2).
|
|
10
11
|
|
|
12
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
11
13
|
birthDay(patH, "1944-08-21").
|
|
12
14
|
duration(check, "P80Y").
|
|
13
15
|
|
|
14
16
|
% A person is above a duration if the local date minus the birthday is greater
|
|
15
17
|
% than that duration.
|
|
18
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
16
19
|
ageAbove(S, A) :-
|
|
17
20
|
birthDay(S, B),
|
|
18
21
|
duration(check, A),
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
% Built-ins use one native spelling each.
|
|
2
2
|
% Vocabulary predicate names remain ordinary user predicates.
|
|
3
3
|
|
|
4
|
+
% The materialized relations below show that built-ins can coexist with
|
|
5
|
+
% ordinary vocabulary predicates that happen to look namespace-like.
|
|
6
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
4
7
|
materialize(value, 2).
|
|
5
8
|
materialize(ok, 2).
|
|
6
9
|
materialize(tail, 2).
|
|
7
10
|
materialize(label, 2).
|
|
8
11
|
|
|
12
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
13
|
+
% Native operations are called through their canonical predicate names.
|
|
14
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
9
15
|
value(nativeMath, X) :- add(0.125, 0.875, X).
|
|
10
16
|
ok(nativeCompare, true) :- lt(2, 3).
|
|
11
17
|
ok(nativeString, true) :- matches("scoped retail insight", "retail|medical").
|
|
12
18
|
tail(nativeList, Tail) :- rest([a, b, c], Tail).
|
|
13
19
|
|
|
20
|
+
% These names are just user data; eyelang does not give them special meaning.
|
|
14
21
|
example_label(vocabularyExample, "vocabulary names are ordinary predicate names").
|
|
15
22
|
label(vocabularyExample, Text) :- example_label(vocabularyExample, Text).
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
% broader/narrower alignments, their transitive closure, the reflexive
|
|
5
5
|
% narrower-or-equal relation, and the concepts that roll up to ref_car.
|
|
6
6
|
|
|
7
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
7
8
|
materialize(broader, 2).
|
|
8
9
|
materialize(narrower, 2).
|
|
9
10
|
materialize(broaderTransitive, 2).
|
|
@@ -11,6 +12,7 @@ materialize(narrowerTransitive, 2).
|
|
|
11
12
|
materialize(narrowerOrEqualOf, 2).
|
|
12
13
|
materialize(rollsUpTo, 2).
|
|
13
14
|
|
|
15
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
14
16
|
concept(ref_car).
|
|
15
17
|
concept(tel_car).
|
|
16
18
|
concept(tel_heavy_vehicle).
|
|
@@ -22,6 +24,7 @@ assertedBroader(tel_heavy_vehicle, ref_car).
|
|
|
22
24
|
assertedBroader(anpr_vehicle_with_plate, ref_car).
|
|
23
25
|
assertedNarrower(anpr_vehicle_with_plate, anpr_passenger_car).
|
|
24
26
|
|
|
27
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
25
28
|
broader(X, Y) :- assertedBroader(X, Y).
|
|
26
29
|
broader(X, Y) :- assertedNarrower(Y, X).
|
|
27
30
|
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
% The input interval table is a list of records, showing how tabular data can
|
|
5
5
|
% stay scoped as one term instead of many unrelated global start/end facts.
|
|
6
6
|
|
|
7
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
7
8
|
materialize(start, 2).
|
|
8
9
|
materialize(end, 2).
|
|
9
10
|
materialize(duration, 2).
|
|
10
11
|
materialize(statement, 3).
|
|
11
12
|
|
|
13
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
12
14
|
interval_table([
|
|
13
15
|
interval(a, 10, 12),
|
|
14
16
|
interval(b, 13, 15),
|
|
@@ -23,6 +25,7 @@ interval_table([
|
|
|
23
25
|
interval(k, 13, 14)
|
|
24
26
|
]).
|
|
25
27
|
|
|
28
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
26
29
|
interval(I) :- interval_table(Table), member(interval(I, _Start, _End), Table).
|
|
27
30
|
start(I, Start) :- interval_table(Table), member(interval(I, Start, _End), Table).
|
|
28
31
|
end(I, End) :- interval_table(Table), member(interval(I, _Start, End), Table).
|
package/examples/ancestor.pl
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
% Basic recursive relation example.
|
|
2
|
+
% Both input facts and derived recursive answers are printed.
|
|
3
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
2
4
|
materialize(parent, 2).
|
|
3
5
|
materialize(ancestor, 2).
|
|
4
6
|
|
|
7
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
8
|
+
% Direct parent facts form a simple chain.
|
|
5
9
|
parent(pat, jan).
|
|
6
10
|
parent(jan, lies).
|
|
7
11
|
parent(lies, emma).
|
|
8
12
|
|
|
13
|
+
% Base case: every parent is also an ancestor.
|
|
14
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
9
15
|
ancestor(X, Y) :-
|
|
10
16
|
parent(X, Y).
|
|
11
17
|
|
|
18
|
+
% Recursive case: walk one parent edge and continue through the chain.
|
|
12
19
|
ancestor(X, Z) :-
|
|
13
20
|
parent(X, Y),
|
|
14
21
|
ancestor(Y, Z).
|
package/examples/animal.pl
CHANGED
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
% The Eyelet source uses Unicode predicate names; this eyelang version keeps the
|
|
4
4
|
% same tiny inheritance idea with plain vocabulary names.
|
|
5
5
|
|
|
6
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
6
7
|
materialize(type, 2).
|
|
7
8
|
materialize(subclassOf, 2).
|
|
8
9
|
materialize(succeeds, 2).
|
|
9
10
|
|
|
11
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
10
12
|
human(joe).
|
|
11
13
|
animal(human).
|
|
12
14
|
|
|
15
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
13
16
|
animal(X) :- human(X).
|
|
14
17
|
|
|
15
18
|
type(joe, human) :- human(joe).
|
package/examples/annotation.pl
CHANGED
|
@@ -3,17 +3,20 @@
|
|
|
3
3
|
% The program keeps the annotation as data and derives visible relations from it.
|
|
4
4
|
% Formula members become default output only when explicit rules project them.
|
|
5
5
|
|
|
6
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
6
7
|
materialize(name, 2).
|
|
7
8
|
materialize(log_nameOf, 2).
|
|
8
9
|
materialize(statedBy, 2).
|
|
9
10
|
materialize(recorded, 2).
|
|
10
11
|
|
|
12
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
11
13
|
annotation(t, (
|
|
12
14
|
name(a, "Alice"),
|
|
13
15
|
statedBy(t, bob),
|
|
14
16
|
recorded(t, "2021-07-07")
|
|
15
17
|
)).
|
|
16
18
|
|
|
19
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
17
20
|
name(S, O) :-
|
|
18
21
|
annotation(_T, Formula),
|
|
19
22
|
formula_binary(Formula, S, name, O).
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
% AuroraCare purpose-based medical-data exchange case adapted from Eyeling auroracare.n3.
|
|
2
|
+
% The original N3 emits one Markdown block per scenario. This eyelang
|
|
3
|
+
% translation materializes the policy decisions, reasons, traces, and ARC-style
|
|
4
|
+
% check values as ordinary relation output.
|
|
5
|
+
|
|
6
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
7
|
+
materialize(label, 2).
|
|
8
|
+
materialize(description, 2).
|
|
9
|
+
materialize(careTeamLinked, 2).
|
|
10
|
+
materialize(subjectOptIn, 2).
|
|
11
|
+
materialize(subjectOptOut, 2).
|
|
12
|
+
materialize(decision, 2).
|
|
13
|
+
materialize(reason, 2).
|
|
14
|
+
materialize(matchedPolicyUid, 2).
|
|
15
|
+
materialize(matchedProhibition, 2).
|
|
16
|
+
materialize(trace, 2).
|
|
17
|
+
materialize(checkC1, 2).
|
|
18
|
+
materialize(checkC2, 2).
|
|
19
|
+
materialize(checkC3, 2).
|
|
20
|
+
materialize(checkC4, 2).
|
|
21
|
+
materialize(checkC5, 2).
|
|
22
|
+
materialize(checkC6, 2).
|
|
23
|
+
materialize(checkC7, 2).
|
|
24
|
+
materialize(checkC8, 2).
|
|
25
|
+
materialize(checkC9, 2).
|
|
26
|
+
materialize(checkC10Text, 2).
|
|
27
|
+
|
|
28
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
29
|
+
caseName(case, "auroracare").
|
|
30
|
+
question(case, "For each AuroraCare scenario, should the PDP permit or deny the requested use of health data, and why?").
|
|
31
|
+
|
|
32
|
+
% Policies: primary care, quality improvement, research, and an explicit denial.
|
|
33
|
+
policyUid(policyPrimary, "urn:policy:primary-care-001").
|
|
34
|
+
purposeAllowed(policyPrimary, primaryCareManagement).
|
|
35
|
+
purposeAllowed(policyPrimary, patientRemoteMonitoring).
|
|
36
|
+
roleAllowed(policyPrimary, "clinician").
|
|
37
|
+
allowAnyCategory(policyPrimary, patientSummary).
|
|
38
|
+
allowAnyCategory(policyPrimary, labResults).
|
|
39
|
+
|
|
40
|
+
policyUid(policyQi, "urn:policy:qi-2025-aurora").
|
|
41
|
+
purposeAllowed(policyQi, ensureQualitySafetyHealthcare).
|
|
42
|
+
requireEnvironment(policyQi, "secure_env").
|
|
43
|
+
requireAllCategory(policyQi, labResults).
|
|
44
|
+
requireAllCategory(policyQi, patientSummary).
|
|
45
|
+
duty(policyQi, requireConsent).
|
|
46
|
+
duty(policyQi, noExfiltration).
|
|
47
|
+
|
|
48
|
+
policyUid(policyResearch, "urn:policy:research-aurora-diabetes").
|
|
49
|
+
purposeAllowed(policyResearch, healthcareScientificResearch).
|
|
50
|
+
requireEnvironment(policyResearch, "secure_env").
|
|
51
|
+
requireTom(policyResearch, anonymisation).
|
|
52
|
+
allowAnyCategory(policyResearch, labResults).
|
|
53
|
+
allowAnyCategory(policyResearch, patientSummary).
|
|
54
|
+
allowAnyCategory(policyResearch, imagingReport).
|
|
55
|
+
duty(policyResearch, annualOutcomeReport).
|
|
56
|
+
duty(policyResearch, noReidentification).
|
|
57
|
+
duty(policyResearch, noExfiltration).
|
|
58
|
+
|
|
59
|
+
policyUid(policyDenyInsurance, "urn:policy:deny-insurance").
|
|
60
|
+
prohibitPurpose(policyDenyInsurance, insuranceManagement).
|
|
61
|
+
|
|
62
|
+
linkedTo(clinicianAlba, ruben).
|
|
63
|
+
linkedTo(gpRuben, ruben).
|
|
64
|
+
consentAllow(ruben, healthcareScientificResearch).
|
|
65
|
+
consentDeny(ruben, trainTestAndEvaluateAiSystemsAlgorithms).
|
|
66
|
+
primaryPurpose(auroracare, primaryCareManagement).
|
|
67
|
+
primaryPurpose(auroracare, patientRemoteMonitoring).
|
|
68
|
+
prohibitedPurpose(auroracare, insuranceManagement).
|
|
69
|
+
|
|
70
|
+
% Scenarios A-G mirror the upstream Markdown report cases.
|
|
71
|
+
scenario(scenarioA).
|
|
72
|
+
outputKey(scenarioA, out010A).
|
|
73
|
+
scenario_label(scenarioA, "A – Primary care visit").
|
|
74
|
+
scenario_description(scenarioA, "Clinician in the patient's care team accessing the patient summary for primary care management.").
|
|
75
|
+
requester(scenarioA, clinicianAlba).
|
|
76
|
+
requesterRole(scenarioA, "clinician").
|
|
77
|
+
subject(scenarioA, ruben).
|
|
78
|
+
purpose(scenarioA, primaryCareManagement).
|
|
79
|
+
environment(scenarioA, "api_gateway").
|
|
80
|
+
category(scenarioA, patientSummary).
|
|
81
|
+
|
|
82
|
+
scenario(scenarioB).
|
|
83
|
+
outputKey(scenarioB, out020B).
|
|
84
|
+
scenario_label(scenarioB, "B – Quality improvement (in scope)").
|
|
85
|
+
scenario_description(scenarioB, "QI analyst using lab results + summary in a secure environment.").
|
|
86
|
+
requester(scenarioB, qiAnalyst).
|
|
87
|
+
requesterRole(scenarioB, "data_user").
|
|
88
|
+
subject(scenarioB, ruben).
|
|
89
|
+
purpose(scenarioB, ensureQualitySafetyHealthcare).
|
|
90
|
+
environment(scenarioB, "secure_env").
|
|
91
|
+
category(scenarioB, labResults).
|
|
92
|
+
category(scenarioB, patientSummary).
|
|
93
|
+
|
|
94
|
+
scenario(scenarioC).
|
|
95
|
+
outputKey(scenarioC, out030C).
|
|
96
|
+
scenario_label(scenarioC, "C – Quality improvement (out of scope)").
|
|
97
|
+
scenario_description(scenarioC, "QI analyst with only lab results; policy expects labs + summary.").
|
|
98
|
+
requester(scenarioC, qiAnalyst).
|
|
99
|
+
requesterRole(scenarioC, "data_user").
|
|
100
|
+
subject(scenarioC, ruben).
|
|
101
|
+
purpose(scenarioC, ensureQualitySafetyHealthcare).
|
|
102
|
+
environment(scenarioC, "secure_env").
|
|
103
|
+
category(scenarioC, labResults).
|
|
104
|
+
|
|
105
|
+
scenario(scenarioD).
|
|
106
|
+
outputKey(scenarioD, out040D).
|
|
107
|
+
scenario_label(scenarioD, "D – Insurance management").
|
|
108
|
+
scenario_description(scenarioD, "Insurance bot attempting to use health data for insurance management (prohibited purpose).").
|
|
109
|
+
requester(scenarioD, insurerBot).
|
|
110
|
+
requesterRole(scenarioD, "data_user").
|
|
111
|
+
subject(scenarioD, ruben).
|
|
112
|
+
purpose(scenarioD, insuranceManagement).
|
|
113
|
+
environment(scenarioD, "secure_env").
|
|
114
|
+
category(scenarioD, patientSummary).
|
|
115
|
+
|
|
116
|
+
scenario(scenarioE).
|
|
117
|
+
outputKey(scenarioE, out050E).
|
|
118
|
+
scenario_label(scenarioE, "E – GP checks labs").
|
|
119
|
+
scenario_description(scenarioE, "GP for the same patient checking lab results via the API gateway.").
|
|
120
|
+
requester(scenarioE, gpRuben).
|
|
121
|
+
requesterRole(scenarioE, "clinician").
|
|
122
|
+
subject(scenarioE, ruben).
|
|
123
|
+
purpose(scenarioE, primaryCareManagement).
|
|
124
|
+
environment(scenarioE, "api_gateway").
|
|
125
|
+
category(scenarioE, labResults).
|
|
126
|
+
|
|
127
|
+
scenario(scenarioF).
|
|
128
|
+
outputKey(scenarioF, out060F).
|
|
129
|
+
scenario_label(scenarioF, "F – Research on anonymised dataset").
|
|
130
|
+
scenario_description(scenarioF, "Researcher using anonymised labs + summary in a secure environment, with opt-in.").
|
|
131
|
+
requester(scenarioF, researcherAurora).
|
|
132
|
+
requesterRole(scenarioF, "data_user").
|
|
133
|
+
subject(scenarioF, ruben).
|
|
134
|
+
purpose(scenarioF, healthcareScientificResearch).
|
|
135
|
+
environment(scenarioF, "secure_env").
|
|
136
|
+
tom(scenarioF, anonymisation).
|
|
137
|
+
category(scenarioF, patientSummary).
|
|
138
|
+
category(scenarioF, labResults).
|
|
139
|
+
|
|
140
|
+
scenario(scenarioG).
|
|
141
|
+
outputKey(scenarioG, out070G).
|
|
142
|
+
scenario_label(scenarioG, "G – AI training (opt-out)").
|
|
143
|
+
scenario_description(scenarioG, "Data user wants to train AI, but the subject opted out of AI training.").
|
|
144
|
+
requester(scenarioG, mlOps).
|
|
145
|
+
requesterRole(scenarioG, "data_user").
|
|
146
|
+
subject(scenarioG, ruben).
|
|
147
|
+
purpose(scenarioG, trainTestAndEvaluateAiSystemsAlgorithms).
|
|
148
|
+
environment(scenarioG, "secure_env").
|
|
149
|
+
category(scenarioG, patientSummary).
|
|
150
|
+
category(scenarioG, labResults).
|
|
151
|
+
|
|
152
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
153
|
+
label(S, Label) :- scenario_label(S, Label).
|
|
154
|
+
description(S, Description) :- scenario_description(S, Description).
|
|
155
|
+
|
|
156
|
+
care_team_linked(S) :-
|
|
157
|
+
requester(S, Requester),
|
|
158
|
+
subject(S, Subject),
|
|
159
|
+
linkedTo(Requester, Subject).
|
|
160
|
+
|
|
161
|
+
subject_opt_in(S) :-
|
|
162
|
+
subject(S, Subject),
|
|
163
|
+
purpose(S, Purpose),
|
|
164
|
+
consentAllow(Subject, Purpose).
|
|
165
|
+
|
|
166
|
+
subject_opt_out(S) :-
|
|
167
|
+
subject(S, Subject),
|
|
168
|
+
purpose(S, Purpose),
|
|
169
|
+
consentDeny(Subject, Purpose).
|
|
170
|
+
|
|
171
|
+
primary_policy_match(S) :-
|
|
172
|
+
purpose(S, primaryCareManagement),
|
|
173
|
+
requesterRole(S, "clinician"),
|
|
174
|
+
care_team_linked(S),
|
|
175
|
+
category(S, Category),
|
|
176
|
+
allowAnyCategory(policyPrimary, Category).
|
|
177
|
+
|
|
178
|
+
qi_policy_match(S) :-
|
|
179
|
+
purpose(S, ensureQualitySafetyHealthcare),
|
|
180
|
+
environment(S, "secure_env"),
|
|
181
|
+
category(S, labResults),
|
|
182
|
+
category(S, patientSummary).
|
|
183
|
+
|
|
184
|
+
research_policy_match(S) :-
|
|
185
|
+
purpose(S, healthcareScientificResearch),
|
|
186
|
+
environment(S, "secure_env"),
|
|
187
|
+
tom(S, anonymisation),
|
|
188
|
+
subject_opt_in(S),
|
|
189
|
+
category(S, labResults).
|
|
190
|
+
|
|
191
|
+
insurance_prohibition_match(S) :-
|
|
192
|
+
purpose(S, insuranceManagement),
|
|
193
|
+
prohibitPurpose(policyDenyInsurance, insuranceManagement).
|
|
194
|
+
|
|
195
|
+
ai_training_opt_out_match(S) :-
|
|
196
|
+
purpose(S, trainTestAndEvaluateAiSystemsAlgorithms),
|
|
197
|
+
subject_opt_out(S).
|
|
198
|
+
|
|
199
|
+
careTeamLinked(S, true) :- care_team_linked(S).
|
|
200
|
+
subjectOptIn(S, true) :- subject_opt_in(S).
|
|
201
|
+
subjectOptOut(S, true) :- subject_opt_out(S).
|
|
202
|
+
|
|
203
|
+
% Permit when a scenario satisfies one of the allowed policy branches.
|
|
204
|
+
decision(S, "PERMIT") :- primary_policy_match(S).
|
|
205
|
+
decision(S, "PERMIT") :- qi_policy_match(S).
|
|
206
|
+
decision(S, "PERMIT") :- research_policy_match(S).
|
|
207
|
+
% Deny branches preserve the reason that will be materialized for the report.
|
|
208
|
+
decision(S, "DENY") :- insurance_prohibition_match(S).
|
|
209
|
+
decision(S, "DENY") :- ai_training_opt_out_match(S).
|
|
210
|
+
decision(scenarioC, "DENY") :- purpose(scenarioC, ensureQualitySafetyHealthcare).
|
|
211
|
+
|
|
212
|
+
matchedPolicyUid(S, Uid) :- primary_policy_match(S), policyUid(policyPrimary, Uid).
|
|
213
|
+
matchedPolicyUid(S, Uid) :- qi_policy_match(S), policyUid(policyQi, Uid).
|
|
214
|
+
matchedPolicyUid(S, Uid) :- research_policy_match(S), policyUid(policyResearch, Uid).
|
|
215
|
+
matchedProhibition(S, policyDenyInsurance) :- insurance_prohibition_match(S).
|
|
216
|
+
|
|
217
|
+
reason(S, "Permitted: clinician in the patient's care team, and the primary-care policy matched.") :- primary_policy_match(S).
|
|
218
|
+
reason(S, "Permitted: ODRL/DPV policy matched for secondary use.") :- qi_policy_match(S).
|
|
219
|
+
reason(S, "Permitted: subject opted in and an ODRL/DPV policy matched (anonymised dataset in secure environment).") :- research_policy_match(S).
|
|
220
|
+
reason(S, "Denied: the requested purpose (insurance management) is prohibited by policy.") :- insurance_prohibition_match(S).
|
|
221
|
+
reason(S, "Denied: you opted out of your data being used to train AI systems.") :- ai_training_opt_out_match(S).
|
|
222
|
+
reason(scenarioC, "Denied: no policy matched (purpose, environment, TOMs, or categories out of scope).") :- purpose(scenarioC, ensureQualitySafetyHealthcare).
|
|
223
|
+
|
|
224
|
+
trace(S, "permit:primary_care_allowed") :- primary_policy_match(S).
|
|
225
|
+
trace(S, "urn:policy:primary-care-001:permit:odrl:permission_matched") :- primary_policy_match(S).
|
|
226
|
+
trace(S, "urn:policy:qi-2025-aurora:permit:odrl:permission_matched") :- qi_policy_match(S).
|
|
227
|
+
trace(S, "urn:policy:research-aurora-diabetes:permit:odrl:permission_matched") :- research_policy_match(S).
|
|
228
|
+
trace(S, "deny:prohibited_purpose") :- insurance_prohibition_match(S).
|
|
229
|
+
trace(S, "urn:policy:deny-insurance:deny:odrl:prohibition_matched") :- insurance_prohibition_match(S).
|
|
230
|
+
trace(S, "deny:subject_opted_out_ai_training") :- ai_training_opt_out_match(S).
|
|
231
|
+
trace(scenarioC, "urn:policy:qi-2025-aurora:deny:odrl:no_permission_matched") :- purpose(scenarioC, ensureQualitySafetyHealthcare).
|
|
232
|
+
|
|
233
|
+
% C1-C10 below are the ARC-style checklist lines from the upstream output.
|
|
234
|
+
checkC1(scenarioA, "SKIPPED - not a prohibited purpose") :- decision(scenarioA, "PERMIT").
|
|
235
|
+
checkC2(scenarioA, "OK - clinician") :- decision(scenarioA, "PERMIT").
|
|
236
|
+
checkC3(scenarioA, "OK - care-team linked") :- decision(scenarioA, "PERMIT").
|
|
237
|
+
checkC4(scenarioA, "SKIPPED") :- decision(scenarioA, "PERMIT").
|
|
238
|
+
checkC5(scenarioA, "OK - operator=isAnyOf, allowed=[\"https://example.org/health#PATIENT_SUMMARY\", \"https://example.org/health#LAB_RESULTS\"], requested=[\"https://example.org/health#PATIENT_SUMMARY\"]") :- decision(scenarioA, "PERMIT").
|
|
239
|
+
checkC6(scenarioA, "SKIPPED - no prohibition matched") :- decision(scenarioA, "PERMIT").
|
|
240
|
+
checkC7(scenarioA, "OK - trace shows matching permission") :- decision(scenarioA, "PERMIT").
|
|
241
|
+
checkC8(scenarioA, "SKIPPED - no matched policy or no duties") :- decision(scenarioA, "PERMIT").
|
|
242
|
+
checkC9(scenarioA, "SKIPPED - policy has no environment constraint") :- decision(scenarioA, "PERMIT").
|
|
243
|
+
checkC10Text(scenarioA, "INFO - matched policy: urn:policy:primary-care-001") :- decision(scenarioA, "PERMIT").
|
|
244
|
+
|
|
245
|
+
checkC1(scenarioB, "SKIPPED - not a prohibited purpose") :- decision(scenarioB, "PERMIT").
|
|
246
|
+
checkC2(scenarioB, "SKIPPED") :- decision(scenarioB, "PERMIT").
|
|
247
|
+
checkC3(scenarioB, "SKIPPED") :- decision(scenarioB, "PERMIT").
|
|
248
|
+
checkC4(scenarioB, "OK - opt-in present and policy matched") :- decision(scenarioB, "PERMIT").
|
|
249
|
+
checkC5(scenarioB, "OK - operator=isAllOf, allowed=[\"https://example.org/health#LAB_RESULTS\", \"https://example.org/health#PATIENT_SUMMARY\"], requested=[\"https://example.org/health#LAB_RESULTS\", \"https://example.org/health#PATIENT_SUMMARY\"]") :- decision(scenarioB, "PERMIT").
|
|
250
|
+
checkC6(scenarioB, "SKIPPED - no prohibition matched") :- decision(scenarioB, "PERMIT").
|
|
251
|
+
checkC7(scenarioB, "OK - trace shows matching permission") :- decision(scenarioB, "PERMIT").
|
|
252
|
+
checkC8(scenarioB, "INFO - duties attached: duty:https://w3id.org/dpv/legal/eu/ehds#requireConsent, duty:https://w3id.org/dpv/legal/eu/ehds#noExfiltration") :- decision(scenarioB, "PERMIT").
|
|
253
|
+
checkC9(scenarioB, "OK - operator=eq, allowed=\"secure_env\", requested=\"secure_env\"") :- decision(scenarioB, "PERMIT").
|
|
254
|
+
checkC10Text(scenarioB, "INFO - matched policy: urn:policy:qi-2025-aurora") :- decision(scenarioB, "PERMIT").
|
|
255
|
+
|
|
256
|
+
checkC1(scenarioC, "SKIPPED - not a prohibited purpose") :- decision(scenarioC, "DENY").
|
|
257
|
+
checkC2(scenarioC, "SKIPPED") :- decision(scenarioC, "DENY").
|
|
258
|
+
checkC3(scenarioC, "SKIPPED") :- decision(scenarioC, "DENY").
|
|
259
|
+
checkC4(scenarioC, "OK - denied because opt-in missing or no policy match") :- decision(scenarioC, "DENY").
|
|
260
|
+
checkC5(scenarioC, "SKIPPED") :- decision(scenarioC, "DENY").
|
|
261
|
+
checkC6(scenarioC, "SKIPPED - no prohibition matched") :- decision(scenarioC, "DENY").
|
|
262
|
+
checkC7(scenarioC, "SKIPPED") :- decision(scenarioC, "DENY").
|
|
263
|
+
checkC8(scenarioC, "SKIPPED - no matched policy or no duties") :- decision(scenarioC, "DENY").
|
|
264
|
+
checkC9(scenarioC, "SKIPPED") :- decision(scenarioC, "DENY").
|
|
265
|
+
checkC10Text(scenarioC, "SKIPPED - no matched policy") :- decision(scenarioC, "DENY").
|
|
266
|
+
|
|
267
|
+
checkC1(scenarioD, "OK - denied prohibited purpose") :- decision(scenarioD, "DENY").
|
|
268
|
+
checkC2(scenarioD, "SKIPPED") :- decision(scenarioD, "DENY").
|
|
269
|
+
checkC3(scenarioD, "SKIPPED") :- decision(scenarioD, "DENY").
|
|
270
|
+
checkC4(scenarioD, "SKIPPED") :- decision(scenarioD, "DENY").
|
|
271
|
+
checkC5(scenarioD, "SKIPPED") :- decision(scenarioD, "DENY").
|
|
272
|
+
checkC6(scenarioD, "OK - denied due to prohibition") :- decision(scenarioD, "DENY").
|
|
273
|
+
checkC7(scenarioD, "SKIPPED") :- decision(scenarioD, "DENY").
|
|
274
|
+
checkC8(scenarioD, "SKIPPED - no matched policy or no duties") :- decision(scenarioD, "DENY").
|
|
275
|
+
checkC9(scenarioD, "SKIPPED") :- decision(scenarioD, "DENY").
|
|
276
|
+
checkC10Text(scenarioD, "SKIPPED - no matched policy") :- decision(scenarioD, "DENY").
|
|
277
|
+
|
|
278
|
+
checkC1(scenarioE, "SKIPPED - not a prohibited purpose") :- decision(scenarioE, "PERMIT").
|
|
279
|
+
checkC2(scenarioE, "OK - clinician") :- decision(scenarioE, "PERMIT").
|
|
280
|
+
checkC3(scenarioE, "OK - care-team linked") :- decision(scenarioE, "PERMIT").
|
|
281
|
+
checkC4(scenarioE, "SKIPPED") :- decision(scenarioE, "PERMIT").
|
|
282
|
+
checkC5(scenarioE, "OK - operator=isAnyOf, allowed=[\"https://example.org/health#PATIENT_SUMMARY\", \"https://example.org/health#LAB_RESULTS\"], requested=[\"https://example.org/health#LAB_RESULTS\"]") :- decision(scenarioE, "PERMIT").
|
|
283
|
+
checkC6(scenarioE, "SKIPPED - no prohibition matched") :- decision(scenarioE, "PERMIT").
|
|
284
|
+
checkC7(scenarioE, "OK - trace shows matching permission") :- decision(scenarioE, "PERMIT").
|
|
285
|
+
checkC8(scenarioE, "SKIPPED - no matched policy or no duties") :- decision(scenarioE, "PERMIT").
|
|
286
|
+
checkC9(scenarioE, "SKIPPED - policy has no environment constraint") :- decision(scenarioE, "PERMIT").
|
|
287
|
+
checkC10Text(scenarioE, "INFO - matched policy: urn:policy:primary-care-001") :- decision(scenarioE, "PERMIT").
|
|
288
|
+
|
|
289
|
+
checkC1(scenarioF, "SKIPPED - not a prohibited purpose") :- decision(scenarioF, "PERMIT").
|
|
290
|
+
checkC2(scenarioF, "SKIPPED") :- decision(scenarioF, "PERMIT").
|
|
291
|
+
checkC3(scenarioF, "SKIPPED") :- decision(scenarioF, "PERMIT").
|
|
292
|
+
checkC4(scenarioF, "OK - opt-in present and policy matched") :- decision(scenarioF, "PERMIT").
|
|
293
|
+
checkC5(scenarioF, "OK - operator=isAnyOf, allowed=[\"https://example.org/health#LAB_RESULTS\", \"https://example.org/health#PATIENT_SUMMARY\", \"https://example.org/health#IMAGING_REPORT\"], requested=[\"https://example.org/health#PATIENT_SUMMARY\", \"https://example.org/health#LAB_RESULTS\"]") :- decision(scenarioF, "PERMIT").
|
|
294
|
+
checkC6(scenarioF, "SKIPPED - no prohibition matched") :- decision(scenarioF, "PERMIT").
|
|
295
|
+
checkC7(scenarioF, "OK - trace shows matching permission") :- decision(scenarioF, "PERMIT").
|
|
296
|
+
checkC8(scenarioF, "INFO - duties attached: duty:https://w3id.org/dpv/legal/eu/ehds#annualOutcomeReport, duty:https://w3id.org/dpv/legal/eu/ehds#noReidentification, duty:https://w3id.org/dpv/legal/eu/ehds#noExfiltration") :- decision(scenarioF, "PERMIT").
|
|
297
|
+
checkC9(scenarioF, "OK - operator=eq, allowed=\"secure_env\", requested=\"secure_env\"") :- decision(scenarioF, "PERMIT").
|
|
298
|
+
checkC10Text(scenarioF, "INFO - matched policy: urn:policy:research-aurora-diabetes") :- decision(scenarioF, "PERMIT").
|
|
299
|
+
|
|
300
|
+
checkC1(scenarioG, "SKIPPED - not a prohibited purpose") :- decision(scenarioG, "DENY").
|
|
301
|
+
checkC2(scenarioG, "SKIPPED") :- decision(scenarioG, "DENY").
|
|
302
|
+
checkC3(scenarioG, "SKIPPED") :- decision(scenarioG, "DENY").
|
|
303
|
+
checkC4(scenarioG, "OK - denied because opt-in missing or no policy match") :- decision(scenarioG, "DENY").
|
|
304
|
+
checkC5(scenarioG, "SKIPPED") :- decision(scenarioG, "DENY").
|
|
305
|
+
checkC6(scenarioG, "SKIPPED - no prohibition matched") :- decision(scenarioG, "DENY").
|
|
306
|
+
checkC7(scenarioG, "SKIPPED") :- decision(scenarioG, "DENY").
|
|
307
|
+
checkC8(scenarioG, "SKIPPED - no matched policy or no duties") :- decision(scenarioG, "DENY").
|
|
308
|
+
checkC9(scenarioG, "SKIPPED") :- decision(scenarioG, "DENY").
|
|
309
|
+
checkC10Text(scenarioG, "SKIPPED - no matched policy") :- decision(scenarioG, "DENY").
|
package/examples/backward.pl
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
1
2
|
materialize(isIndeedMoreInterestingThan, 2).
|
|
2
3
|
|
|
4
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
3
5
|
% Backward rule example adapted from Eyeling backward.n3.
|
|
4
6
|
% Eyeling writes the interestingness rule backward; eyelang records the same
|
|
5
7
|
% relation as an ordinary rule whose body is the numeric comparison.
|
|
6
8
|
|
|
9
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
7
10
|
moreInterestingThan(X, Y) :- gt(X, Y).
|
|
8
11
|
|
|
9
12
|
isIndeedMoreInterestingThan(5, 3) :- moreInterestingThan(5, 3).
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
% EYE reasoning/basic-monadic/10tt_answer.n3 in cardinality and content
|
|
9
9
|
% after translating N3 statements to eyelang relation terms.
|
|
10
10
|
|
|
11
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
11
12
|
materialize(cycle, 2).
|
|
12
13
|
|
|
14
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
13
15
|
edge(i30, i12, i33).
|
|
14
16
|
edge(i61, i29, i42).
|
|
15
17
|
edge(i57, i46, i87).
|
|
@@ -10011,6 +10013,6 @@ edge(i18, i75, i36).
|
|
|
10011
10013
|
edge(i48, i89, i48).
|
|
10012
10014
|
edge(i26, i42, i54).
|
|
10013
10015
|
|
|
10016
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
10014
10017
|
cycle(R, Cycle) :-
|
|
10015
10018
|
fixed_length_cycle(edge, 10, R, Cycle).
|
|
10016
|
-
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
% points, so this example is comparable with examples/output/bayes-diagnosis.n3
|
|
5
5
|
% in the Eyeling repository.
|
|
6
6
|
|
|
7
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
7
8
|
materialize(scores, 2).
|
|
8
9
|
materialize(evidenceTotal, 2).
|
|
9
10
|
materialize(result, 2).
|
|
@@ -11,6 +12,7 @@ materialize(disease, 2).
|
|
|
11
12
|
materialize(unnormalized, 2).
|
|
12
13
|
materialize(posterior, 2).
|
|
13
14
|
|
|
15
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
14
16
|
disease(covid19).
|
|
15
17
|
disease(influenza).
|
|
16
18
|
disease(allergicRhinitis).
|
|
@@ -53,6 +55,7 @@ evidence([
|
|
|
53
55
|
ev(shortBreath, true)
|
|
54
56
|
]).
|
|
55
57
|
|
|
58
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
56
59
|
factor(Disease, Symptom, true, P) :- p_given(Disease, Symptom, P).
|
|
57
60
|
factor(Disease, Symptom, false, Q) :-
|
|
58
61
|
p_given(Disease, Symptom, P),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
% Memoize shared inference layers: the score vector, disease likelihood tails,
|
|
2
2
|
% and expected therapy success are reused by several report relations.
|
|
3
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
3
4
|
materialize(diseases, 2).
|
|
4
5
|
materialize(therapies, 2).
|
|
5
6
|
materialize(evidence, 2).
|
|
@@ -12,6 +13,7 @@ materialize(expectedAdverse, 2).
|
|
|
12
13
|
materialize(utility, 2).
|
|
13
14
|
materialize(recommendedTherapy, 2).
|
|
14
15
|
|
|
16
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
15
17
|
memoize(scores_for, 2).
|
|
16
18
|
memoize(likelihood, 3).
|
|
17
19
|
memoize(expected_success, 2).
|
|
@@ -81,6 +83,7 @@ adverse(supportiveCare, 0.01).
|
|
|
81
83
|
benefit_weight(10).
|
|
82
84
|
harm_weight(3).
|
|
83
85
|
|
|
86
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
84
87
|
factor(Disease, ev(Symptom, true), P) :- p_given(Disease, Symptom, P).
|
|
85
88
|
factor(Disease, ev(Symptom, false), Q) :-
|
|
86
89
|
p_given(Disease, Symptom, P),
|
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
%
|
|
3
3
|
% The tip deflection for a point load at the free end is F*L^3/(3*E*I).
|
|
4
4
|
|
|
5
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
5
6
|
materialize(type, 2).
|
|
6
7
|
materialize(tipDeflection_m, 2).
|
|
7
8
|
materialize(tipDeflection_mm, 2).
|
|
8
9
|
materialize(limit_mm, 2).
|
|
9
10
|
materialize(status, 2).
|
|
10
11
|
|
|
12
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
11
13
|
beam(beam1, force_N, 1200.0).
|
|
12
14
|
beam(beam1, length_m, 2.5).
|
|
13
15
|
beam(beam1, elasticModulus_Pa, 200000000000.0).
|
|
14
16
|
beam(beam1, secondMoment_m4, 0.000008).
|
|
15
17
|
limit(beam1, maxDeflection_mm, 5.0).
|
|
16
18
|
|
|
19
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
17
20
|
tip_deflection_m(Beam, Deflection) :-
|
|
18
21
|
beam(Beam, force_N, Force),
|
|
19
22
|
beam(Beam, length_m, Length),
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
% are sorted lists of on(Block, Support) facts so equality and visited-state
|
|
5
5
|
% checks are purely structural.
|
|
6
6
|
|
|
7
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
7
8
|
materialize(status, 2).
|
|
8
9
|
materialize(plan, 2).
|
|
9
10
|
materialize(finalState, 2).
|
|
10
11
|
materialize(blockCount, 2).
|
|
11
12
|
|
|
13
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
12
14
|
initial([on(a, table), on(b, a), on(c, b), on(d, c), on(e, d)]).
|
|
13
15
|
goal([on(a, table), on(b, a), on(c, table), on(d, c), on(e, d)]).
|
|
14
16
|
|
|
@@ -19,6 +21,7 @@ block(d).
|
|
|
19
21
|
block(e).
|
|
20
22
|
|
|
21
23
|
support(table, _State).
|
|
24
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
22
25
|
support(Block, State) :-
|
|
23
26
|
block(Block),
|
|
24
27
|
member(on(Block, _Below), State).
|