eyeling 1.33.8 → 1.33.10
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 +1 -1
- package/docs/eyelang-guide.md +5 -2
- package/docs/eyelang-language-reference.md +1 -1
- package/examples/dpv-odrl-purpose-mapping.n3 +54 -0
- package/examples/eyelang/dpv-odrl-purpose-mapping.pl +46 -0
- package/examples/eyelang/knowledge-engineering-alignment-flow.pl +40 -0
- package/examples/eyelang/odrl-dpv-fpv-trust-flow.pl +43 -0
- package/examples/eyelang/output/dpv-odrl-purpose-mapping.pl +18 -0
- package/examples/eyelang/output/knowledge-engineering-alignment-flow.pl +17 -0
- package/examples/eyelang/output/odrl-dpv-fpv-trust-flow.pl +9 -0
- package/examples/eyelang/output/trust-flow-provenance-threshold.pl +6 -0
- package/examples/eyelang/trust-flow-provenance-threshold.pl +40 -0
- package/examples/knowledge-engineering-alignment-flow.n3 +62 -0
- package/examples/odrl-dpv-fpv-trust-flow.n3 +97 -0
- package/examples/output/dpv-odrl-purpose-mapping.n3 +23 -0
- package/examples/output/knowledge-engineering-alignment-flow.n3 +24 -0
- package/examples/output/odrl-dpv-fpv-trust-flow.n3 +14 -0
- package/examples/output/trust-flow-provenance-threshold.n3 +12 -0
- package/examples/trust-flow-provenance-threshold.n3 +54 -0
- package/lib/eyelang/builtins/registry.js +1 -2
- package/package.json +1 -1
- package/examples/eyelang/cryptarithmetic-send-more-money.pl +0 -49
- package/examples/eyelang/output/cryptarithmetic-send-more-money.pl +0 -6
- package/lib/eyelang/builtins/alphametic.js +0 -144
- package/test/eyelang/conformance/cases/extension/045_alphametic_sum_small.pl +0 -3
- package/test/eyelang/conformance/expected/extension/045_alphametic_sum_small.out +0 -4
package/README.md
CHANGED
|
@@ -829,7 +829,7 @@ The eyelang engine has its own built-in registry under `lib/eyelang/builtins/`.
|
|
|
829
829
|
| Aggregation | `findall/3`, `countall/2`, `sumall/3`, `aggregate_min/5`, `aggregate_max/5` |
|
|
830
830
|
| Control | `not/1`, `once/1` |
|
|
831
831
|
| Context terms | `holds/2`, `holds/3` |
|
|
832
|
-
| Search and optimization helpers | `n_queens/2`, `weighted_hamiltonian_cycle/4`, `weighted_hamiltonian_path/4`, `hamiltonian_cycle/3`, `fixed_length_cycle/4`, `bounded_path/5`, `cnf_model/3`, `qm_prime_implicants/4`, `qm_minimal_cover/4
|
|
832
|
+
| Search and optimization helpers | `n_queens/2`, `weighted_hamiltonian_cycle/4`, `weighted_hamiltonian_path/4`, `hamiltonian_cycle/3`, `fixed_length_cycle/4`, `bounded_path/5`, `cnf_model/3`, `qm_prime_implicants/4`, `qm_minimal_cover/4` |
|
|
833
833
|
| Numeric extension helpers | `extended_gcd/5`, `collatz_trajectory/2`, `kaprekar_steps/2`, `goldbach_pair/3` |
|
|
834
834
|
| Matrix helpers | `matrix_sum/2`, `matrix_multiply/2`, `cholesky_decomposition/2`, `determinant/2`, `matrix_inv_triang/2`, `matrix_inversion/2` |
|
|
835
835
|
|
package/docs/eyelang-guide.md
CHANGED
|
@@ -261,7 +261,7 @@ best(Cycle, Cost) :-
|
|
|
261
261
|
weighted_hamiltonian_cycle(edge, Cities, Cycle, Cost).
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
The reusable search and numeric helpers include `n_queens/2`, Hamiltonian path/cycle helpers, `cnf_model/3`, Quine-McCluskey helpers,
|
|
264
|
+
The reusable search and numeric helpers include `n_queens/2`, Hamiltonian path/cycle helpers, `bounded_path/5`, `cnf_model/3`, Quine-McCluskey helpers, number-theory helpers such as `extended_gcd/5`, and matrix helpers such as `matrix_multiply/2`. These helpers are extension builtins of this implementation; [the eyelang language reference](eyelang-language-reference.md) defines the portable core and standard builtin profile.
|
|
265
265
|
|
|
266
266
|
To add a builtin, create or extend a module with `register(registry)` and call `registry.add(name, arity, handler, options)`. The default registry is assembled in [`lib/eyelang/builtins/registry.js`](../lib/eyelang/builtins/registry.js). Builtins that are only safe for specific argument modes should provide a `ready` predicate and `fallbackWhenNotReady: true`, so user-defined clauses remain visible until the builtin is applicable.
|
|
267
267
|
|
|
@@ -336,7 +336,6 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
336
336
|
| [`composition-of-injective-functions-is-injective.pl`](../examples/eyelang/composition-of-injective-functions-is-injective.pl) | Encodes composition and injectivity of finite functions. | [`output/composition-of-injective-functions-is-injective.pl`](../examples/eyelang/output/composition-of-injective-functions-is-injective.pl) |
|
|
337
337
|
| [`context-association.pl`](../examples/eyelang/context-association.pl) | Associates named contexts with their contents. | [`output/context-association.pl`](../examples/eyelang/output/context-association.pl) |
|
|
338
338
|
| [`control-system.pl`](../examples/eyelang/control-system.pl) | Evaluates control-system measurements and targets. | [`output/control-system.pl`](../examples/eyelang/output/control-system.pl) |
|
|
339
|
-
| [`cryptarithmetic-send-more-money.pl`](../examples/eyelang/cryptarithmetic-send-more-money.pl) | Solves SEND+MORE and related puzzles. | [`output/cryptarithmetic-send-more-money.pl`](../examples/eyelang/output/cryptarithmetic-send-more-money.pl) |
|
|
340
339
|
| [`cyclic-path.pl`](../examples/eyelang/cyclic-path.pl) | Computes paths in a cyclic graph. | [`output/cyclic-path.pl`](../examples/eyelang/output/cyclic-path.pl) |
|
|
341
340
|
| [`d3-group.pl`](../examples/eyelang/d3-group.pl) | Enumerates subgroups of the D3 group. | [`output/d3-group.pl`](../examples/eyelang/output/d3-group.pl) |
|
|
342
341
|
| [`dairy-energy-balance.pl`](../examples/eyelang/dairy-energy-balance.pl) | Classifies dairy cow energy balance. | [`output/dairy-energy-balance.pl`](../examples/eyelang/output/dairy-energy-balance.pl) |
|
|
@@ -357,6 +356,7 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
357
356
|
| [`dijkstra.pl`](../examples/eyelang/dijkstra.pl) | Enumerates weighted simple paths. | [`output/dijkstra.pl`](../examples/eyelang/output/dijkstra.pl) |
|
|
358
357
|
| [`dining-philosophers.pl`](../examples/eyelang/dining-philosophers.pl) | Simulates Chandy-Misra fork exchanges. | [`output/dining-philosophers.pl`](../examples/eyelang/output/dining-philosophers.pl) |
|
|
359
358
|
| [`dog.pl`](../examples/eyelang/dog.pl) | Counts dogs and derives when a license is required. | [`output/dog.pl`](../examples/eyelang/output/dog.pl) |
|
|
359
|
+
| [`dpv-odrl-purpose-mapping.pl`](../examples/eyelang/dpv-odrl-purpose-mapping.pl) | Maps a DPV process into an ODRL permission view. | [`output/dpv-odrl-purpose-mapping.pl`](../examples/eyelang/output/dpv-odrl-purpose-mapping.pl) |
|
|
360
360
|
| [`drone-corridor-planner.pl`](../examples/eyelang/drone-corridor-planner.pl) | Plans bounded drone corridor routes. | [`output/drone-corridor-planner.pl`](../examples/eyelang/output/drone-corridor-planner.pl) |
|
|
361
361
|
| [`easter-computus.pl`](../examples/eyelang/easter-computus.pl) | Computes Gregorian Easter dates. | [`output/easter-computus.pl`](../examples/eyelang/output/easter-computus.pl) |
|
|
362
362
|
| [`electrical-rc-filter.pl`](../examples/eyelang/electrical-rc-filter.pl) | Sizes an RC low-pass filter. | [`output/electrical-rc-filter.pl`](../examples/eyelang/output/electrical-rc-filter.pl) |
|
|
@@ -395,6 +395,7 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
395
395
|
| [`ideal-gas-law.pl`](../examples/eyelang/ideal-gas-law.pl) | Applies the ideal gas law. | [`output/ideal-gas-law.pl`](../examples/eyelang/output/ideal-gas-law.pl) |
|
|
396
396
|
| [`illegitimate-reasoning.pl`](../examples/eyelang/illegitimate-reasoning.pl) | Detects suspect reasoning patterns. | [`output/illegitimate-reasoning.pl`](../examples/eyelang/output/illegitimate-reasoning.pl) |
|
|
397
397
|
| [`kaprekar.pl`](../examples/eyelang/kaprekar.pl) | Iterates toward Kaprekar's constant. | [`output/kaprekar.pl`](../examples/eyelang/output/kaprekar.pl) |
|
|
398
|
+
| [`knowledge-engineering-alignment-flow.pl`](../examples/eyelang/knowledge-engineering-alignment-flow.pl) | Specializes reusable alignment rules into a target-shaped flow view. | [`output/knowledge-engineering-alignment-flow.pl`](../examples/eyelang/output/knowledge-engineering-alignment-flow.pl) |
|
|
398
399
|
| [`law-of-cosines.pl`](../examples/eyelang/law-of-cosines.pl) | Computes a triangle side by cosine law. | [`output/law-of-cosines.pl`](../examples/eyelang/output/law-of-cosines.pl) |
|
|
399
400
|
| [`least-squares-regression.pl`](../examples/eyelang/least-squares-regression.pl) | Fits a least-squares regression line. | [`output/least-squares-regression.pl`](../examples/eyelang/output/least-squares-regression.pl) |
|
|
400
401
|
| [`list-collection.pl`](../examples/eyelang/list-collection.pl) | Demonstrates list and collection built-ins. | [`output/list-collection.pl`](../examples/eyelang/output/list-collection.pl) |
|
|
@@ -407,6 +408,7 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
407
408
|
| [`network-sla.pl`](../examples/eyelang/network-sla.pl) | Checks network path SLA compliance. | [`output/network-sla.pl`](../examples/eyelang/output/network-sla.pl) |
|
|
408
409
|
| [`newton-raphson.pl`](../examples/eyelang/newton-raphson.pl) | Finds roots by Newton-Raphson iteration. | [`output/newton-raphson.pl`](../examples/eyelang/output/newton-raphson.pl) |
|
|
409
410
|
| [`nixon-diamond.pl`](../examples/eyelang/nixon-diamond.pl) | Reports the classic Nixon-diamond conflict. | [`output/nixon-diamond.pl`](../examples/eyelang/output/nixon-diamond.pl) |
|
|
411
|
+
| [`odrl-dpv-fpv-trust-flow.pl`](../examples/eyelang/odrl-dpv-fpv-trust-flow.pl) | Decides ODRL/DPV data flows with local FPV trust gates. | [`output/odrl-dpv-fpv-trust-flow.pl`](../examples/eyelang/output/odrl-dpv-fpv-trust-flow.pl) |
|
|
410
412
|
| [`odrl-dpv-healthcare-risk-ranked.pl`](../examples/eyelang/odrl-dpv-healthcare-risk-ranked.pl) | Ranks healthcare policy risks and mitigations. | [`output/odrl-dpv-healthcare-risk-ranked.pl`](../examples/eyelang/output/odrl-dpv-healthcare-risk-ranked.pl) |
|
|
411
413
|
| [`odrl-dpv-risk-ranked.pl`](../examples/eyelang/odrl-dpv-risk-ranked.pl) | Ranks data-policy risks and mitigations. | [`output/odrl-dpv-risk-ranked.pl`](../examples/eyelang/output/odrl-dpv-risk-ranked.pl) |
|
|
412
414
|
| [`orbital-transfer-design.pl`](../examples/eyelang/orbital-transfer-design.pl) | Designs a Hohmann orbital transfer. | [`output/orbital-transfer-design.pl`](../examples/eyelang/output/orbital-transfer-design.pl) |
|
|
@@ -431,6 +433,7 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
431
433
|
| [`statistics-summary.pl`](../examples/eyelang/statistics-summary.pl) | Computes population statistics for a sample. | [`output/statistics-summary.pl`](../examples/eyelang/output/statistics-summary.pl) |
|
|
432
434
|
| [`superdense-coding.pl`](../examples/eyelang/superdense-coding.pl) | Models superdense-coding bit transmission. | [`output/superdense-coding.pl`](../examples/eyelang/output/superdense-coding.pl) |
|
|
433
435
|
| [`traveling-salesman.pl`](../examples/eyelang/traveling-salesman.pl) | Finds an optimal traveling-salesman tour. | [`output/traveling-salesman.pl`](../examples/eyelang/output/traveling-salesman.pl) |
|
|
436
|
+
| [`trust-flow-provenance-threshold.pl`](../examples/eyelang/trust-flow-provenance-threshold.pl) | Classifies message trust from provenance confidence scores. | [`output/trust-flow-provenance-threshold.pl`](../examples/eyelang/output/trust-flow-provenance-threshold.pl) |
|
|
434
437
|
| [`turing.pl`](../examples/eyelang/turing.pl) | Simulates a binary-increment Turing machine. | [`output/turing.pl`](../examples/eyelang/output/turing.pl) |
|
|
435
438
|
| [`vector-similarity.pl`](../examples/eyelang/vector-similarity.pl) | Computes dot product, norm, and cosine similarity. | [`output/vector-similarity.pl`](../examples/eyelang/output/vector-similarity.pl) |
|
|
436
439
|
| [`vulnerability-impact.pl`](../examples/eyelang/vulnerability-impact.pl) | Analyzes vulnerable transitive dependencies and urgent patch impact. | [`output/vulnerability-impact.pl`](../examples/eyelang/output/vulnerability-impact.pl) |
|
|
@@ -468,7 +468,7 @@ An extension built-in SHOULD obey the same surface-language discipline as standa
|
|
|
468
468
|
- it SHOULD document its intended modes, especially which arguments must be ground before it runs deterministically;
|
|
469
469
|
- it MUST NOT change the meaning of ordinary facts, rules, unification, or standard built-ins.
|
|
470
470
|
|
|
471
|
-
For example, an implementation may include extension modules for number-theory algorithms, graph search, matrix operations
|
|
471
|
+
For example, an implementation may include extension modules for number-theory algorithms, graph search, or matrix operations. Those modules may be valuable and may make example programs much faster, but their predicate names, arities, algorithms, and modes are implementation-defined unless they are separately standardized.
|
|
472
472
|
|
|
473
473
|
An implementation that provides explanation output SHOULD make extension built-ins explainable at least as opaque successful or failed built-in calls, so that proof traces do not incorrectly report "no clauses" for a host-provided relation.
|
|
474
474
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# DPV -> ODRL policy view.
|
|
2
|
+
# A DPV process description is made executable by deriving the ODRL permission,
|
|
3
|
+
# target, action, and purpose/legal-basis constraints used by a policy evaluator.
|
|
4
|
+
|
|
5
|
+
@prefix : <https://example.org/dpv-odrl-purpose-mapping#> .
|
|
6
|
+
@prefix dpv: <https://w3id.org/dpv#> .
|
|
7
|
+
@prefix dpv-odrl:<https://w3id.org/dpv/mappings/odrl#> .
|
|
8
|
+
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
|
|
9
|
+
|
|
10
|
+
:AlphaCareProcess a dpv:Process ;
|
|
11
|
+
dpv:hasDataController :HospitalA ;
|
|
12
|
+
dpv:hasRecipient :ResearchPartner ;
|
|
13
|
+
dpv:hasPersonalData :LabResult ;
|
|
14
|
+
dpv:hasProcessing dpv:Use ;
|
|
15
|
+
dpv:hasPurpose dpv:Healthcare ;
|
|
16
|
+
dpv:hasLegalBasis dpv:Consent .
|
|
17
|
+
|
|
18
|
+
:AlphaPolicy :representsProcess :AlphaCareProcess ;
|
|
19
|
+
:permissionNode :AlphaPermission ;
|
|
20
|
+
:purposeConstraint :AlphaPurposeConstraint ;
|
|
21
|
+
:basisConstraint :AlphaBasisConstraint .
|
|
22
|
+
|
|
23
|
+
{ ?policy :representsProcess ?process ; :permissionNode ?permission .
|
|
24
|
+
?process a dpv:Process ;
|
|
25
|
+
dpv:hasDataController ?controller ;
|
|
26
|
+
dpv:hasRecipient ?recipient ;
|
|
27
|
+
dpv:hasPersonalData ?data ;
|
|
28
|
+
dpv:hasProcessing ?processing . }
|
|
29
|
+
=>
|
|
30
|
+
{ ?policy a odrl:Policy ; odrl:permission ?permission .
|
|
31
|
+
?permission a odrl:Permission ;
|
|
32
|
+
odrl:assigner ?controller ;
|
|
33
|
+
odrl:assignee ?recipient ;
|
|
34
|
+
odrl:target ?data ;
|
|
35
|
+
odrl:action ?processing ;
|
|
36
|
+
:derivedFromProcess ?process . } .
|
|
37
|
+
|
|
38
|
+
{ ?policy :representsProcess ?process ; :permissionNode ?permission ; :purposeConstraint ?constraint .
|
|
39
|
+
?process dpv:hasPurpose ?purpose . }
|
|
40
|
+
=>
|
|
41
|
+
{ ?permission odrl:constraint ?constraint .
|
|
42
|
+
?constraint a odrl:Constraint ;
|
|
43
|
+
odrl:leftOperand dpv-odrl:Purpose ;
|
|
44
|
+
odrl:operator odrl:isA ;
|
|
45
|
+
odrl:rightOperand ?purpose . } .
|
|
46
|
+
|
|
47
|
+
{ ?policy :representsProcess ?process ; :permissionNode ?permission ; :basisConstraint ?constraint .
|
|
48
|
+
?process dpv:hasLegalBasis ?basis . }
|
|
49
|
+
=>
|
|
50
|
+
{ ?permission odrl:constraint ?constraint .
|
|
51
|
+
?constraint a odrl:Constraint ;
|
|
52
|
+
odrl:leftOperand dpv-odrl:LegalBasis ;
|
|
53
|
+
odrl:operator odrl:isA ;
|
|
54
|
+
odrl:rightOperand ?basis . } .
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
% DPV process to ODRL policy view in eyelang.
|
|
2
|
+
|
|
3
|
+
materialize(type, 2).
|
|
4
|
+
materialize(odrl_permission, 2).
|
|
5
|
+
materialize(odrl_assigner, 2).
|
|
6
|
+
materialize(odrl_assignee, 2).
|
|
7
|
+
materialize(odrl_target, 2).
|
|
8
|
+
materialize(odrl_action, 2).
|
|
9
|
+
materialize(odrl_constraint, 2).
|
|
10
|
+
materialize(odrl_leftOperand, 2).
|
|
11
|
+
materialize(odrl_operator, 2).
|
|
12
|
+
materialize(odrl_rightOperand, 2).
|
|
13
|
+
materialize(derived_from_process, 2).
|
|
14
|
+
|
|
15
|
+
process(alpha_care_process).
|
|
16
|
+
data_controller(alpha_care_process, hospital_a).
|
|
17
|
+
recipient(alpha_care_process, research_partner).
|
|
18
|
+
personal_data(alpha_care_process, lab_result).
|
|
19
|
+
processing(alpha_care_process, dpv_use).
|
|
20
|
+
purpose(alpha_care_process, dpv_healthcare).
|
|
21
|
+
legal_basis(alpha_care_process, dpv_consent).
|
|
22
|
+
|
|
23
|
+
represents_process(alpha_policy, alpha_care_process).
|
|
24
|
+
permission_node(alpha_policy, alpha_permission).
|
|
25
|
+
purpose_constraint(alpha_policy, alpha_purpose_constraint).
|
|
26
|
+
basis_constraint(alpha_policy, alpha_basis_constraint).
|
|
27
|
+
|
|
28
|
+
type(Policy, odrl_policy) :- represents_process(Policy, _Process).
|
|
29
|
+
odrl_permission(Policy, Permission) :- permission_node(Policy, Permission).
|
|
30
|
+
type(Permission, odrl_permission) :- permission_node(_Policy, Permission).
|
|
31
|
+
derived_from_process(Permission, Process) :- represents_process(Policy, Process), permission_node(Policy, Permission).
|
|
32
|
+
odrl_assigner(Permission, Controller) :- represents_process(Policy, Process), permission_node(Policy, Permission), data_controller(Process, Controller).
|
|
33
|
+
odrl_assignee(Permission, Recipient) :- represents_process(Policy, Process), permission_node(Policy, Permission), recipient(Process, Recipient).
|
|
34
|
+
odrl_target(Permission, Data) :- represents_process(Policy, Process), permission_node(Policy, Permission), personal_data(Process, Data).
|
|
35
|
+
odrl_action(Permission, Action) :- represents_process(Policy, Process), permission_node(Policy, Permission), processing(Process, Action).
|
|
36
|
+
|
|
37
|
+
odrl_constraint(Permission, Constraint) :- permission_node(Policy, Permission), purpose_constraint(Policy, Constraint).
|
|
38
|
+
odrl_constraint(Permission, Constraint) :- permission_node(Policy, Permission), basis_constraint(Policy, Constraint).
|
|
39
|
+
type(Constraint, odrl_constraint) :- purpose_constraint(_Policy, Constraint).
|
|
40
|
+
type(Constraint, odrl_constraint) :- basis_constraint(_Policy, Constraint).
|
|
41
|
+
odrl_leftOperand(Constraint, dpv_odrl_purpose) :- purpose_constraint(_Policy, Constraint).
|
|
42
|
+
odrl_leftOperand(Constraint, dpv_odrl_legal_basis) :- basis_constraint(_Policy, Constraint).
|
|
43
|
+
odrl_operator(Constraint, odrl_isA) :- purpose_constraint(_Policy, Constraint).
|
|
44
|
+
odrl_operator(Constraint, odrl_isA) :- basis_constraint(_Policy, Constraint).
|
|
45
|
+
odrl_rightOperand(Constraint, Purpose) :- represents_process(Policy, Process), purpose_constraint(Policy, Constraint), purpose(Process, Purpose).
|
|
46
|
+
odrl_rightOperand(Constraint, Basis) :- represents_process(Policy, Process), basis_constraint(Policy, Constraint), legal_basis(Process, Basis).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
% Knowledge-engineering alignment flow in eyelang.
|
|
2
|
+
% Local source predicates are aligned once and then reused to produce a target-shaped flow view.
|
|
3
|
+
% fpv_* atoms denote a tiny local Flow/Policy Vocabulary profile.
|
|
4
|
+
|
|
5
|
+
materialize(type, 2).
|
|
6
|
+
materialize(target_fact, 3).
|
|
7
|
+
materialize(runtime_rule, 2).
|
|
8
|
+
materialize(target_predicate, 2).
|
|
9
|
+
materialize(flow_emits, 2).
|
|
10
|
+
materialize(trusted_by, 2).
|
|
11
|
+
|
|
12
|
+
sub_class(local_observation, sosa_observation).
|
|
13
|
+
sub_class(temperature_probe, sosa_sensor).
|
|
14
|
+
sub_property(observed_by, sosa_madeBySensor).
|
|
15
|
+
sub_property(observed_at, sosa_resultTime).
|
|
16
|
+
sub_property(temperature_celsius, sosa_hasSimpleResult).
|
|
17
|
+
sub_property(in_flow, fpv_hasFlowStep).
|
|
18
|
+
equivalent_property(observed_feature, sosa_hasFeatureOfInterest).
|
|
19
|
+
|
|
20
|
+
type(msg1, local_observation).
|
|
21
|
+
type(probe7, temperature_probe).
|
|
22
|
+
triple(msg1, observed_by, probe7).
|
|
23
|
+
triple(msg1, observed_at, "2026-06-17T12:34:56Z").
|
|
24
|
+
triple(msg1, temperature_celsius, 18.6).
|
|
25
|
+
triple(msg1, observed_feature, platform_b).
|
|
26
|
+
triple(msg1, in_flow, ingest_step).
|
|
27
|
+
|
|
28
|
+
% Generic alignment rules.
|
|
29
|
+
type(Thing, Super) :- type(Thing, Class), sub_class(Class, Super).
|
|
30
|
+
target_fact(Subject, SuperPredicate, Object) :- triple(Subject, Predicate, Object), sub_property(Predicate, SuperPredicate).
|
|
31
|
+
target_fact(Subject, TargetPredicate, Object) :- triple(Subject, Predicate, Object), equivalent_property(Predicate, TargetPredicate).
|
|
32
|
+
target_fact(Subject, SourcePredicate, Object) :- triple(Subject, Predicate, Object), equivalent_property(SourcePredicate, Predicate).
|
|
33
|
+
|
|
34
|
+
runtime_rule(SourcePredicate, copy_to_target) :- sub_property(SourcePredicate, _TargetPredicate).
|
|
35
|
+
runtime_rule(SourcePredicate, copy_to_target) :- equivalent_property(SourcePredicate, _TargetPredicate).
|
|
36
|
+
target_predicate(SourcePredicate, TargetPredicate) :- sub_property(SourcePredicate, TargetPredicate).
|
|
37
|
+
target_predicate(SourcePredicate, TargetPredicate) :- equivalent_property(SourcePredicate, TargetPredicate).
|
|
38
|
+
|
|
39
|
+
flow_emits(Step, Message) :- type(Message, sosa_observation), target_fact(Message, fpv_hasFlowStep, Step), target_fact(Message, sosa_madeBySensor, _Sensor).
|
|
40
|
+
trusted_by(Step, Sensor) :- type(Message, sosa_observation), target_fact(Message, fpv_hasFlowStep, Step), target_fact(Message, sosa_madeBySensor, Sensor).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
% ODRL + DPV + local FPV trust-flow decisioning in eyelang.
|
|
2
|
+
|
|
3
|
+
materialize(decision, 2).
|
|
4
|
+
materialize(confidence, 2).
|
|
5
|
+
materialize(status, 2).
|
|
6
|
+
materialize(risk, 2).
|
|
7
|
+
|
|
8
|
+
trust_score(hospital_a, 0.92).
|
|
9
|
+
trust_score(small_clinic, 0.63).
|
|
10
|
+
trust_score(ad_network, 0.28).
|
|
11
|
+
|
|
12
|
+
flow(flow_care, hospital_a, research_partner, lab_result, dpv_use, dpv_healthcare).
|
|
13
|
+
flow(flow_clinic, small_clinic, research_partner, lab_result, dpv_use, dpv_healthcare).
|
|
14
|
+
flow(flow_ads, hospital_a, ad_network, lab_result, dpv_share, dpv_marketing).
|
|
15
|
+
|
|
16
|
+
permission(permit_healthcare_research, research_partner, lab_result, dpv_use, dpv_healthcare, 0.80).
|
|
17
|
+
prohibition(prohibit_marketing_disclosure, ad_network, lab_result, dpv_share, dpv_marketing).
|
|
18
|
+
|
|
19
|
+
permitted_flow(Flow, Score) :-
|
|
20
|
+
flow(Flow, Source, Recipient, Data, Action, Purpose),
|
|
21
|
+
permission(_Permission, Recipient, Data, Action, Purpose, MinTrust),
|
|
22
|
+
trust_score(Source, Score),
|
|
23
|
+
ge(Score, MinTrust).
|
|
24
|
+
|
|
25
|
+
review_flow(Flow, Score) :-
|
|
26
|
+
flow(Flow, Source, Recipient, Data, Action, Purpose),
|
|
27
|
+
permission(_Permission, Recipient, Data, Action, Purpose, MinTrust),
|
|
28
|
+
trust_score(Source, Score),
|
|
29
|
+
lt(Score, MinTrust).
|
|
30
|
+
|
|
31
|
+
denied_flow(Flow) :-
|
|
32
|
+
flow(Flow, _Source, Recipient, Data, Action, Purpose),
|
|
33
|
+
prohibition(_Prohibition, Recipient, Data, Action, Purpose).
|
|
34
|
+
|
|
35
|
+
decision(Flow, fpv_permit) :- permitted_flow(Flow, _Score).
|
|
36
|
+
decision(Flow, fpv_review) :- review_flow(Flow, _Score).
|
|
37
|
+
decision(Flow, fpv_deny) :- denied_flow(Flow).
|
|
38
|
+
confidence(Flow, Score) :- permitted_flow(Flow, Score).
|
|
39
|
+
confidence(Flow, Score) :- review_flow(Flow, Score).
|
|
40
|
+
status(Flow, fpv_executable_flow) :- permitted_flow(Flow, _Score).
|
|
41
|
+
status(Flow, fpv_blocked_flow) :- denied_flow(Flow).
|
|
42
|
+
risk(Flow, risk_trustworthiness_risk) :- review_flow(Flow, _Score).
|
|
43
|
+
risk(Flow, risk_unwanted_disclosure_data) :- denied_flow(Flow).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type(alpha_policy, odrl_policy).
|
|
2
|
+
type(alpha_permission, odrl_permission).
|
|
3
|
+
type(alpha_purpose_constraint, odrl_constraint).
|
|
4
|
+
type(alpha_basis_constraint, odrl_constraint).
|
|
5
|
+
odrl_permission(alpha_policy, alpha_permission).
|
|
6
|
+
derived_from_process(alpha_permission, alpha_care_process).
|
|
7
|
+
odrl_assigner(alpha_permission, hospital_a).
|
|
8
|
+
odrl_assignee(alpha_permission, research_partner).
|
|
9
|
+
odrl_target(alpha_permission, lab_result).
|
|
10
|
+
odrl_action(alpha_permission, dpv_use).
|
|
11
|
+
odrl_constraint(alpha_permission, alpha_purpose_constraint).
|
|
12
|
+
odrl_constraint(alpha_permission, alpha_basis_constraint).
|
|
13
|
+
odrl_leftOperand(alpha_purpose_constraint, dpv_odrl_purpose).
|
|
14
|
+
odrl_leftOperand(alpha_basis_constraint, dpv_odrl_legal_basis).
|
|
15
|
+
odrl_operator(alpha_purpose_constraint, odrl_isA).
|
|
16
|
+
odrl_operator(alpha_basis_constraint, odrl_isA).
|
|
17
|
+
odrl_rightOperand(alpha_purpose_constraint, dpv_healthcare).
|
|
18
|
+
odrl_rightOperand(alpha_basis_constraint, dpv_consent).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
target_fact(msg1, sosa_madeBySensor, probe7).
|
|
2
|
+
target_fact(msg1, sosa_resultTime, "2026-06-17T12:34:56Z").
|
|
3
|
+
target_fact(msg1, sosa_hasSimpleResult, 18.6).
|
|
4
|
+
target_fact(msg1, fpv_hasFlowStep, ingest_step).
|
|
5
|
+
target_fact(msg1, sosa_hasFeatureOfInterest, platform_b).
|
|
6
|
+
runtime_rule(observed_by, copy_to_target).
|
|
7
|
+
runtime_rule(observed_at, copy_to_target).
|
|
8
|
+
runtime_rule(temperature_celsius, copy_to_target).
|
|
9
|
+
runtime_rule(in_flow, copy_to_target).
|
|
10
|
+
runtime_rule(observed_feature, copy_to_target).
|
|
11
|
+
target_predicate(observed_by, sosa_madeBySensor).
|
|
12
|
+
target_predicate(observed_at, sosa_resultTime).
|
|
13
|
+
target_predicate(temperature_celsius, sosa_hasSimpleResult).
|
|
14
|
+
target_predicate(in_flow, fpv_hasFlowStep).
|
|
15
|
+
target_predicate(observed_feature, sosa_hasFeatureOfInterest).
|
|
16
|
+
flow_emits(ingest_step, msg1).
|
|
17
|
+
trusted_by(ingest_step, probe7).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
decision(flow_care, fpv_permit).
|
|
2
|
+
decision(flow_clinic, fpv_review).
|
|
3
|
+
decision(flow_ads, fpv_deny).
|
|
4
|
+
confidence(flow_care, 0.92).
|
|
5
|
+
confidence(flow_clinic, 0.63).
|
|
6
|
+
status(flow_care, fpv_executable_flow).
|
|
7
|
+
status(flow_ads, fpv_blocked_flow).
|
|
8
|
+
risk(flow_clinic, risk_trustworthiness_risk).
|
|
9
|
+
risk(flow_ads, risk_unwanted_disclosure_data).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
confidence(message_a, 0.89375999999999989).
|
|
2
|
+
confidence(message_b, 0.41999999999999993).
|
|
3
|
+
trust_flow_state(message_a, fpv_accepted).
|
|
4
|
+
trust_flow_state(message_b, fpv_quarantine).
|
|
5
|
+
status(message_a, fpv_high_trust_flow).
|
|
6
|
+
risk(message_b, risk_low_trust_data_source).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
% Provenance-derived trust-flow thresholding in eyelang.
|
|
2
|
+
|
|
3
|
+
materialize(confidence, 2).
|
|
4
|
+
materialize(trust_flow_state, 2).
|
|
5
|
+
materialize(status, 2).
|
|
6
|
+
materialize(risk, 2).
|
|
7
|
+
|
|
8
|
+
message(message_a, publisher_a, transform_a, signature_a, receiver_app).
|
|
9
|
+
message(message_b, publisher_b, transform_b, signature_b, receiver_app).
|
|
10
|
+
|
|
11
|
+
publisher_trust(publisher_a, 0.95).
|
|
12
|
+
publisher_trust(publisher_b, 0.70).
|
|
13
|
+
signature_strength(signature_a, 0.98).
|
|
14
|
+
signature_strength(signature_b, 0.75).
|
|
15
|
+
quality_score(transform_a, 0.96).
|
|
16
|
+
quality_score(transform_b, 0.80).
|
|
17
|
+
acceptance_threshold(receiver_app, 0.85).
|
|
18
|
+
|
|
19
|
+
confidence(Message, Confidence) :-
|
|
20
|
+
message(Message, Publisher, Transform, Signature, _Receiver),
|
|
21
|
+
publisher_trust(Publisher, PublisherTrust),
|
|
22
|
+
signature_strength(Signature, SignatureTrust),
|
|
23
|
+
quality_score(Transform, Quality),
|
|
24
|
+
mul(PublisherTrust, SignatureTrust, A),
|
|
25
|
+
mul(A, Quality, Confidence).
|
|
26
|
+
|
|
27
|
+
trust_flow_state(Message, fpv_accepted) :-
|
|
28
|
+
message(Message, _Publisher, _Transform, _Signature, Receiver),
|
|
29
|
+
confidence(Message, Confidence),
|
|
30
|
+
acceptance_threshold(Receiver, Threshold),
|
|
31
|
+
ge(Confidence, Threshold).
|
|
32
|
+
|
|
33
|
+
trust_flow_state(Message, fpv_quarantine) :-
|
|
34
|
+
message(Message, _Publisher, _Transform, _Signature, Receiver),
|
|
35
|
+
confidence(Message, Confidence),
|
|
36
|
+
acceptance_threshold(Receiver, Threshold),
|
|
37
|
+
lt(Confidence, Threshold).
|
|
38
|
+
|
|
39
|
+
status(Message, fpv_high_trust_flow) :- trust_flow_state(Message, fpv_accepted).
|
|
40
|
+
risk(Message, risk_low_trust_data_source) :- trust_flow_state(Message, fpv_quarantine).
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Knowledge-engineering alignment flow inspired by reusable Linked Data artefacts.
|
|
2
|
+
# The example keeps domain terms local, adds generic RDFS/OWL alignment rules once,
|
|
3
|
+
# and derives a target SOSA/FPV-shaped view plus the compact runtime steps that were useful.
|
|
4
|
+
# FPV is used here as a small local Flow/Policy Vocabulary profile, not as a public standard.
|
|
5
|
+
|
|
6
|
+
@prefix : <https://example.org/knowledge-engineering-alignment-flow#> .
|
|
7
|
+
@prefix fpv: <https://example.org/fpv#> .
|
|
8
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
9
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
10
|
+
@prefix sosa: <http://www.w3.org/ns/sosa/> .
|
|
11
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
12
|
+
|
|
13
|
+
# Local vocabulary: useful to the source team, but not yet the application profile.
|
|
14
|
+
:LocalObservation rdfs:subClassOf sosa:Observation .
|
|
15
|
+
:TemperatureProbe rdfs:subClassOf sosa:Sensor .
|
|
16
|
+
:observedBy rdfs:subPropertyOf sosa:madeBySensor .
|
|
17
|
+
:observedAt rdfs:subPropertyOf sosa:resultTime .
|
|
18
|
+
:temperatureCelsius rdfs:subPropertyOf sosa:hasSimpleResult .
|
|
19
|
+
:observedFeature owl:equivalentProperty sosa:hasFeatureOfInterest .
|
|
20
|
+
:inFlow rdfs:subPropertyOf fpv:hasFlowStep .
|
|
21
|
+
|
|
22
|
+
# Incoming message in local terms.
|
|
23
|
+
:msg1 a :LocalObservation ;
|
|
24
|
+
:observedBy :probe7 ;
|
|
25
|
+
:observedAt "2026-06-17T12:34:56Z"^^xsd:dateTime ;
|
|
26
|
+
:temperatureCelsius 18.6 ;
|
|
27
|
+
:observedFeature :platformB ;
|
|
28
|
+
:inFlow :ingestStep .
|
|
29
|
+
|
|
30
|
+
:probe7 a :TemperatureProbe .
|
|
31
|
+
|
|
32
|
+
# Generic rules over vocabulary primitives. They never mention the source classes directly.
|
|
33
|
+
{ ?thing a ?class . ?class rdfs:subClassOf ?super . }
|
|
34
|
+
=>
|
|
35
|
+
{ ?thing a ?super . } .
|
|
36
|
+
|
|
37
|
+
{ ?subject ?property ?object . ?property rdfs:subPropertyOf ?superProperty . }
|
|
38
|
+
=>
|
|
39
|
+
{ ?subject ?superProperty ?object . } .
|
|
40
|
+
|
|
41
|
+
{ ?p owl:equivalentProperty ?q . ?s ?p ?o . }
|
|
42
|
+
=>
|
|
43
|
+
{ ?s ?q ?o . } .
|
|
44
|
+
|
|
45
|
+
{ ?p owl:equivalentProperty ?q . ?s ?q ?o . }
|
|
46
|
+
=>
|
|
47
|
+
{ ?s ?p ?o . } .
|
|
48
|
+
|
|
49
|
+
# Shape-planning trace: when a source predicate is aligned to a target predicate,
|
|
50
|
+
# record the direct rule that a streaming runtime could specialize.
|
|
51
|
+
{ ?sourcePredicate rdfs:subPropertyOf ?targetPredicate . }
|
|
52
|
+
=>
|
|
53
|
+
{ ?sourcePredicate fpv:runtimeRule fpv:copyToTarget ; fpv:targetPredicate ?targetPredicate . } .
|
|
54
|
+
|
|
55
|
+
{ ?sourcePredicate owl:equivalentProperty ?targetPredicate . }
|
|
56
|
+
=>
|
|
57
|
+
{ ?sourcePredicate fpv:runtimeRule fpv:copyToTarget ; fpv:targetPredicate ?targetPredicate . } .
|
|
58
|
+
|
|
59
|
+
# Trust-flow hook: the target-shaped observation can now be attached to a flow step.
|
|
60
|
+
{ ?message a sosa:Observation ; fpv:hasFlowStep ?step ; sosa:madeBySensor ?sensor . }
|
|
61
|
+
=>
|
|
62
|
+
{ ?step fpv:emits ?message ; fpv:trustedBy ?sensor . } .
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# ODRL + DPV + FPV trust-flow decisioning.
|
|
2
|
+
# FPV is a local Flow/Policy Vocabulary profile used to describe data flows and trust gates.
|
|
3
|
+
# ODRL states permissions/prohibitions, DPV gives privacy/risk vocabulary, and rules derive
|
|
4
|
+
# which flow is permitted, denied, or escalated for human review.
|
|
5
|
+
|
|
6
|
+
@prefix : <https://example.org/odrl-dpv-fpv-trust-flow#> .
|
|
7
|
+
@prefix dpv: <https://w3id.org/dpv#> .
|
|
8
|
+
@prefix fpv: <https://example.org/fpv#> .
|
|
9
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
|
|
10
|
+
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
|
|
11
|
+
@prefix risk: <https://w3id.org/dpv/risk#> .
|
|
12
|
+
|
|
13
|
+
:HospitalA :trustScore 0.92 .
|
|
14
|
+
:SmallClinic :trustScore 0.63 .
|
|
15
|
+
:AdNetwork :trustScore 0.28 .
|
|
16
|
+
|
|
17
|
+
:FlowCare a fpv:DataFlow ;
|
|
18
|
+
fpv:source :HospitalA ;
|
|
19
|
+
fpv:recipient :ResearchPartner ;
|
|
20
|
+
fpv:data :LabResult ;
|
|
21
|
+
fpv:processing dpv:Use ;
|
|
22
|
+
fpv:purpose dpv:Healthcare .
|
|
23
|
+
|
|
24
|
+
:FlowClinic a fpv:DataFlow ;
|
|
25
|
+
fpv:source :SmallClinic ;
|
|
26
|
+
fpv:recipient :ResearchPartner ;
|
|
27
|
+
fpv:data :LabResult ;
|
|
28
|
+
fpv:processing dpv:Use ;
|
|
29
|
+
fpv:purpose dpv:Healthcare .
|
|
30
|
+
|
|
31
|
+
:FlowAds a fpv:DataFlow ;
|
|
32
|
+
fpv:source :HospitalA ;
|
|
33
|
+
fpv:recipient :AdNetwork ;
|
|
34
|
+
fpv:data :LabResult ;
|
|
35
|
+
fpv:processing dpv:Share ;
|
|
36
|
+
fpv:purpose dpv:Marketing .
|
|
37
|
+
|
|
38
|
+
:TrustPolicy a odrl:Policy ;
|
|
39
|
+
odrl:permission :PermitHealthcareResearch ;
|
|
40
|
+
odrl:prohibition :ProhibitMarketingDisclosure .
|
|
41
|
+
|
|
42
|
+
:PermitHealthcareResearch a odrl:Permission ;
|
|
43
|
+
odrl:assignee :ResearchPartner ;
|
|
44
|
+
odrl:target :LabResult ;
|
|
45
|
+
odrl:action dpv:Use ;
|
|
46
|
+
odrl:constraint :HealthcarePurpose, :MinTrust .
|
|
47
|
+
|
|
48
|
+
:HealthcarePurpose a odrl:Constraint ;
|
|
49
|
+
odrl:leftOperand fpv:purpose ;
|
|
50
|
+
odrl:operator odrl:isA ;
|
|
51
|
+
odrl:rightOperand dpv:Healthcare .
|
|
52
|
+
|
|
53
|
+
:MinTrust a odrl:Constraint ;
|
|
54
|
+
odrl:leftOperand fpv:sourceTrust ;
|
|
55
|
+
odrl:operator odrl:gteq ;
|
|
56
|
+
odrl:rightOperand 0.80 .
|
|
57
|
+
|
|
58
|
+
:ProhibitMarketingDisclosure a odrl:Prohibition ;
|
|
59
|
+
odrl:assignee :AdNetwork ;
|
|
60
|
+
odrl:target :LabResult ;
|
|
61
|
+
odrl:action dpv:Share ;
|
|
62
|
+
odrl:constraint :MarketingPurpose .
|
|
63
|
+
|
|
64
|
+
:MarketingPurpose a odrl:Constraint ;
|
|
65
|
+
odrl:leftOperand fpv:purpose ;
|
|
66
|
+
odrl:operator odrl:isA ;
|
|
67
|
+
odrl:rightOperand dpv:Marketing .
|
|
68
|
+
|
|
69
|
+
# Permit if ODRL permission matches and the trust gate is satisfied.
|
|
70
|
+
{ ?flow a fpv:DataFlow ; fpv:source ?source ; fpv:recipient ?recipient ; fpv:data ?data ; fpv:processing ?action ; fpv:purpose ?purpose .
|
|
71
|
+
?source :trustScore ?score .
|
|
72
|
+
:TrustPolicy odrl:permission ?permission .
|
|
73
|
+
?permission odrl:assignee ?recipient ; odrl:target ?data ; odrl:action ?action ; odrl:constraint ?purposeConstraint, ?trustConstraint .
|
|
74
|
+
?purposeConstraint odrl:leftOperand fpv:purpose ; odrl:operator odrl:isA ; odrl:rightOperand ?purpose .
|
|
75
|
+
?trustConstraint odrl:leftOperand fpv:sourceTrust ; odrl:operator odrl:gteq ; odrl:rightOperand ?minTrust .
|
|
76
|
+
?score math:notLessThan ?minTrust . }
|
|
77
|
+
=>
|
|
78
|
+
{ ?flow fpv:decision fpv:permit ; fpv:confidence ?score ; dpv:hasStatus fpv:ExecutableFlow . } .
|
|
79
|
+
|
|
80
|
+
# If the flow otherwise matches but the trust gate is too low, escalate rather than silently deny.
|
|
81
|
+
{ ?flow a fpv:DataFlow ; fpv:source ?source ; fpv:recipient ?recipient ; fpv:data ?data ; fpv:processing ?action ; fpv:purpose ?purpose .
|
|
82
|
+
?source :trustScore ?score .
|
|
83
|
+
:TrustPolicy odrl:permission ?permission .
|
|
84
|
+
?permission odrl:assignee ?recipient ; odrl:target ?data ; odrl:action ?action ; odrl:constraint ?purposeConstraint, ?trustConstraint .
|
|
85
|
+
?purposeConstraint odrl:leftOperand fpv:purpose ; odrl:operator odrl:isA ; odrl:rightOperand ?purpose .
|
|
86
|
+
?trustConstraint odrl:leftOperand fpv:sourceTrust ; odrl:operator odrl:gteq ; odrl:rightOperand ?minTrust .
|
|
87
|
+
?score math:lessThan ?minTrust . }
|
|
88
|
+
=>
|
|
89
|
+
{ ?flow fpv:decision fpv:review ; fpv:confidence ?score ; dpv:hasRisk risk:TrustworthinessRisk . } .
|
|
90
|
+
|
|
91
|
+
# Prohibition wins for marketing disclosure to the advertising network.
|
|
92
|
+
{ ?flow a fpv:DataFlow ; fpv:recipient ?recipient ; fpv:data ?data ; fpv:processing ?action ; fpv:purpose ?purpose .
|
|
93
|
+
:TrustPolicy odrl:prohibition ?prohibition .
|
|
94
|
+
?prohibition odrl:assignee ?recipient ; odrl:target ?data ; odrl:action ?action ; odrl:constraint ?purposeConstraint .
|
|
95
|
+
?purposeConstraint odrl:leftOperand fpv:purpose ; odrl:operator odrl:isA ; odrl:rightOperand ?purpose . }
|
|
96
|
+
=>
|
|
97
|
+
{ ?flow fpv:decision fpv:deny ; dpv:hasRisk risk:UnwantedDisclosureData ; dpv:hasStatus fpv:BlockedFlow . } .
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@prefix : <https://example.org/dpv-odrl-purpose-mapping#> .
|
|
2
|
+
@prefix dpv: <https://w3id.org/dpv#> .
|
|
3
|
+
@prefix dpv-odrl: <https://w3id.org/dpv/mappings/odrl#> .
|
|
4
|
+
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
|
|
5
|
+
|
|
6
|
+
:AlphaPolicy a odrl:Policy .
|
|
7
|
+
:AlphaPolicy odrl:permission :AlphaPermission .
|
|
8
|
+
:AlphaPermission a odrl:Permission .
|
|
9
|
+
:AlphaPermission odrl:assigner :HospitalA .
|
|
10
|
+
:AlphaPermission odrl:assignee :ResearchPartner .
|
|
11
|
+
:AlphaPermission odrl:target :LabResult .
|
|
12
|
+
:AlphaPermission odrl:action dpv:Use .
|
|
13
|
+
:AlphaPermission :derivedFromProcess :AlphaCareProcess .
|
|
14
|
+
:AlphaPermission odrl:constraint :AlphaPurposeConstraint .
|
|
15
|
+
:AlphaPurposeConstraint a odrl:Constraint .
|
|
16
|
+
:AlphaPurposeConstraint odrl:leftOperand dpv-odrl:Purpose .
|
|
17
|
+
:AlphaPurposeConstraint odrl:operator odrl:isA .
|
|
18
|
+
:AlphaPurposeConstraint odrl:rightOperand dpv:Healthcare .
|
|
19
|
+
:AlphaPermission odrl:constraint :AlphaBasisConstraint .
|
|
20
|
+
:AlphaBasisConstraint a odrl:Constraint .
|
|
21
|
+
:AlphaBasisConstraint odrl:leftOperand dpv-odrl:LegalBasis .
|
|
22
|
+
:AlphaBasisConstraint odrl:operator odrl:isA .
|
|
23
|
+
:AlphaBasisConstraint odrl:rightOperand dpv:Consent .
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@prefix : <https://example.org/knowledge-engineering-alignment-flow#> .
|
|
2
|
+
@prefix fpv: <https://example.org/fpv#> .
|
|
3
|
+
@prefix sosa: <http://www.w3.org/ns/sosa/> .
|
|
4
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
5
|
+
|
|
6
|
+
:observedBy fpv:runtimeRule fpv:copyToTarget .
|
|
7
|
+
:observedBy fpv:targetPredicate sosa:madeBySensor .
|
|
8
|
+
:observedAt fpv:runtimeRule fpv:copyToTarget .
|
|
9
|
+
:observedAt fpv:targetPredicate sosa:resultTime .
|
|
10
|
+
:temperatureCelsius fpv:runtimeRule fpv:copyToTarget .
|
|
11
|
+
:temperatureCelsius fpv:targetPredicate sosa:hasSimpleResult .
|
|
12
|
+
:observedFeature fpv:runtimeRule fpv:copyToTarget .
|
|
13
|
+
:observedFeature fpv:targetPredicate sosa:hasFeatureOfInterest .
|
|
14
|
+
:inFlow fpv:runtimeRule fpv:copyToTarget .
|
|
15
|
+
:inFlow fpv:targetPredicate fpv:hasFlowStep .
|
|
16
|
+
:msg1 a sosa:Observation .
|
|
17
|
+
:probe7 a sosa:Sensor .
|
|
18
|
+
:msg1 sosa:madeBySensor :probe7 .
|
|
19
|
+
:msg1 sosa:resultTime "2026-06-17T12:34:56Z"^^xsd:dateTime .
|
|
20
|
+
:msg1 sosa:hasSimpleResult 18.6 .
|
|
21
|
+
:msg1 fpv:hasFlowStep :ingestStep .
|
|
22
|
+
:msg1 sosa:hasFeatureOfInterest :platformB .
|
|
23
|
+
:ingestStep fpv:emits :msg1 .
|
|
24
|
+
:ingestStep fpv:trustedBy :probe7 .
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@prefix : <https://example.org/odrl-dpv-fpv-trust-flow#> .
|
|
2
|
+
@prefix dpv: <https://w3id.org/dpv#> .
|
|
3
|
+
@prefix fpv: <https://example.org/fpv#> .
|
|
4
|
+
@prefix risk: <https://w3id.org/dpv/risk#> .
|
|
5
|
+
|
|
6
|
+
:FlowCare fpv:decision fpv:permit .
|
|
7
|
+
:FlowCare fpv:confidence 0.92 .
|
|
8
|
+
:FlowCare dpv:hasStatus fpv:ExecutableFlow .
|
|
9
|
+
:FlowClinic fpv:decision fpv:review .
|
|
10
|
+
:FlowClinic fpv:confidence 0.63 .
|
|
11
|
+
:FlowClinic dpv:hasRisk risk:TrustworthinessRisk .
|
|
12
|
+
:FlowAds fpv:decision fpv:deny .
|
|
13
|
+
:FlowAds dpv:hasRisk risk:UnwantedDisclosureData .
|
|
14
|
+
:FlowAds dpv:hasStatus fpv:BlockedFlow .
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@prefix : <https://example.org/trust-flow-provenance-threshold#> .
|
|
2
|
+
@prefix dpv: <https://w3id.org/dpv#> .
|
|
3
|
+
@prefix fpv: <https://example.org/fpv#> .
|
|
4
|
+
@prefix risk: <https://w3id.org/dpv/risk#> .
|
|
5
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
6
|
+
|
|
7
|
+
:messageA fpv:confidence "0.8937599999999999"^^xsd:decimal .
|
|
8
|
+
:messageB fpv:confidence "0.41999999999999993"^^xsd:decimal .
|
|
9
|
+
:messageA fpv:trustFlowState fpv:accepted .
|
|
10
|
+
:messageA dpv:hasStatus fpv:HighTrustFlow .
|
|
11
|
+
:messageB fpv:trustFlowState fpv:quarantine .
|
|
12
|
+
:messageB dpv:hasRisk risk:LowTrustDataSource .
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Trust flow with provenance-derived confidence.
|
|
2
|
+
# A message is considered high-trust only when publisher trust, signature strength,
|
|
3
|
+
# and transformation quality combine above the receiver threshold.
|
|
4
|
+
|
|
5
|
+
@prefix : <https://example.org/trust-flow-provenance-threshold#> .
|
|
6
|
+
@prefix dpv: <https://w3id.org/dpv#> .
|
|
7
|
+
@prefix fpv: <https://example.org/fpv#> .
|
|
8
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
|
|
9
|
+
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
10
|
+
@prefix risk: <https://w3id.org/dpv/risk#> .
|
|
11
|
+
|
|
12
|
+
:messageA a fpv:Message ;
|
|
13
|
+
prov:wasAttributedTo :PublisherA ;
|
|
14
|
+
prov:wasGeneratedBy :TransformA ;
|
|
15
|
+
fpv:hasSignature :SignatureA ;
|
|
16
|
+
fpv:receiver :ReceiverApp .
|
|
17
|
+
|
|
18
|
+
:messageB a fpv:Message ;
|
|
19
|
+
prov:wasAttributedTo :PublisherB ;
|
|
20
|
+
prov:wasGeneratedBy :TransformB ;
|
|
21
|
+
fpv:hasSignature :SignatureB ;
|
|
22
|
+
fpv:receiver :ReceiverApp .
|
|
23
|
+
|
|
24
|
+
:PublisherA fpv:publisherTrust 0.95 .
|
|
25
|
+
:PublisherB fpv:publisherTrust 0.70 .
|
|
26
|
+
:SignatureA fpv:signatureStrength 0.98 .
|
|
27
|
+
:SignatureB fpv:signatureStrength 0.75 .
|
|
28
|
+
:TransformA fpv:qualityScore 0.96 .
|
|
29
|
+
:TransformB fpv:qualityScore 0.80 .
|
|
30
|
+
:ReceiverApp fpv:acceptanceThreshold 0.85 .
|
|
31
|
+
|
|
32
|
+
{ ?message a fpv:Message ;
|
|
33
|
+
prov:wasAttributedTo ?publisher ;
|
|
34
|
+
prov:wasGeneratedBy ?transform ;
|
|
35
|
+
fpv:hasSignature ?signature ;
|
|
36
|
+
fpv:receiver ?receiver .
|
|
37
|
+
?publisher fpv:publisherTrust ?publisherTrust .
|
|
38
|
+
?signature fpv:signatureStrength ?signatureTrust .
|
|
39
|
+
?transform fpv:qualityScore ?quality .
|
|
40
|
+
( ?publisherTrust ?signatureTrust ?quality ) math:product ?confidence . }
|
|
41
|
+
=>
|
|
42
|
+
{ ?message fpv:confidence ?confidence . } .
|
|
43
|
+
|
|
44
|
+
{ ?message fpv:confidence ?confidence ; fpv:receiver ?receiver .
|
|
45
|
+
?receiver fpv:acceptanceThreshold ?threshold .
|
|
46
|
+
?confidence math:notLessThan ?threshold . }
|
|
47
|
+
=>
|
|
48
|
+
{ ?message fpv:trustFlowState fpv:accepted ; dpv:hasStatus fpv:HighTrustFlow . } .
|
|
49
|
+
|
|
50
|
+
{ ?message fpv:confidence ?confidence ; fpv:receiver ?receiver .
|
|
51
|
+
?receiver fpv:acceptanceThreshold ?threshold .
|
|
52
|
+
?confidence math:lessThan ?threshold . }
|
|
53
|
+
=>
|
|
54
|
+
{ ?message fpv:trustFlowState fpv:quarantine ; dpv:hasRisk risk:LowTrustDataSource . } .
|
|
@@ -10,7 +10,6 @@ import { controlBuiltins } from './control.js';
|
|
|
10
10
|
import { searchBuiltins } from './search.js';
|
|
11
11
|
import { numberTheoryBuiltins } from './number-theory.js';
|
|
12
12
|
import { matrixBuiltins } from './matrix.js';
|
|
13
|
-
import { alphameticBuiltins } from './alphametic.js';
|
|
14
13
|
|
|
15
14
|
export class BuiltinRegistry {
|
|
16
15
|
constructor() {
|
|
@@ -37,7 +36,7 @@ export class BuiltinRegistry {
|
|
|
37
36
|
|
|
38
37
|
export function createDefaultRegistry() {
|
|
39
38
|
const registry = new BuiltinRegistry();
|
|
40
|
-
for (const mod of [coreBuiltins, arithmeticBuiltins, stringBuiltins, listBuiltins, aggregationBuiltins, contextBuiltins, controlBuiltins, searchBuiltins, numberTheoryBuiltins, matrixBuiltins
|
|
39
|
+
for (const mod of [coreBuiltins, arithmeticBuiltins, stringBuiltins, listBuiltins, aggregationBuiltins, contextBuiltins, controlBuiltins, searchBuiltins, numberTheoryBuiltins, matrixBuiltins]) {
|
|
41
40
|
mod.register(registry);
|
|
42
41
|
}
|
|
43
42
|
return registry;
|
package/package.json
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
% Cryptarithmetic without cut.
|
|
2
|
-
%
|
|
3
|
-
% Two column-pruned puzzles are included. SEND + MORE = MONEY is the classic
|
|
4
|
-
% eight-letter puzzle, and DONALD + GERALD = ROBERT uses all ten digits across
|
|
5
|
-
% a six-column addition. Each column constraint is applied as soon as possible
|
|
6
|
-
% so the finite digit search prunes early without cut.
|
|
7
|
-
|
|
8
|
-
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
9
|
-
materialize(status, 2).
|
|
10
|
-
materialize(assignment, 2).
|
|
11
|
-
materialize(equation, 2).
|
|
12
|
-
|
|
13
|
-
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
14
|
-
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
15
|
-
send_more_money(solution(S, E, N, D, M, O, R, Y), Send, More, Money) :-
|
|
16
|
-
alphametic_sum(
|
|
17
|
-
[s, e, n, d, m, o, r, y],
|
|
18
|
-
[[s, e, n, d], [m, o, r, e]],
|
|
19
|
-
[m, o, n, e, y],
|
|
20
|
-
[S, E, N, D, M, O, R, Y],
|
|
21
|
-
[Send, More, Money]
|
|
22
|
-
).
|
|
23
|
-
|
|
24
|
-
donald_gerald_robert(solution(D, O, N, A, L, G, E, R, B, T), Donald, Gerald, Robert) :-
|
|
25
|
-
alphametic_sum(
|
|
26
|
-
[d, o, n, a, l, g, e, r, b, t],
|
|
27
|
-
[[d, o, n, a, l, d], [g, e, r, a, l, d]],
|
|
28
|
-
[r, o, b, e, r, t],
|
|
29
|
-
[D, O, N, A, L, G, E, R, B, T],
|
|
30
|
-
[Donald, Gerald, Robert]
|
|
31
|
-
).
|
|
32
|
-
|
|
33
|
-
status(send_more_money, solved) :-
|
|
34
|
-
once(send_more_money(_Solution, _Send, _More, _Money)).
|
|
35
|
-
|
|
36
|
-
assignment(send_more_money, Solution) :-
|
|
37
|
-
once(send_more_money(Solution, _Send, _More, _Money)).
|
|
38
|
-
|
|
39
|
-
equation(send_more_money, plus(Send, More, Money)) :-
|
|
40
|
-
once(send_more_money(_Solution, Send, More, Money)).
|
|
41
|
-
|
|
42
|
-
status(donald_gerald_robert, solved) :-
|
|
43
|
-
once(donald_gerald_robert(_Solution, _Donald, _Gerald, _Robert)).
|
|
44
|
-
|
|
45
|
-
assignment(donald_gerald_robert, Solution) :-
|
|
46
|
-
once(donald_gerald_robert(Solution, _Donald, _Gerald, _Robert)).
|
|
47
|
-
|
|
48
|
-
equation(donald_gerald_robert, plus(Donald, Gerald, Robert)) :-
|
|
49
|
-
once(donald_gerald_robert(_Solution, Donald, Gerald, Robert)).
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
status(send_more_money, solved).
|
|
2
|
-
status(donald_gerald_robert, solved).
|
|
3
|
-
assignment(send_more_money, solution(9, 5, 6, 7, 1, 0, 8, 2)).
|
|
4
|
-
assignment(donald_gerald_robert, solution(5, 2, 6, 4, 8, 1, 9, 7, 3, 0)).
|
|
5
|
-
equation(send_more_money, plus(9567, 1085, 10652)).
|
|
6
|
-
equation(donald_gerald_robert, plus(526485, 197485, 723970)).
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
// Reusable alphametic addition solver.
|
|
2
|
-
// It evaluates column constraints right-to-left, so examples such as
|
|
3
|
-
// SEND+MORE=MONEY and DONALD+GERALD=ROBERT do not need to express digit search
|
|
4
|
-
// with many relational select/3 and arithmetic goals.
|
|
5
|
-
import { atom, deref, listFromItems, numberTerm, properListItems, unify } from '../term.js';
|
|
6
|
-
|
|
7
|
-
export const alphameticBuiltins = {
|
|
8
|
-
register(registry) {
|
|
9
|
-
registry.add('alphametic_sum', 5, alphameticSum, {
|
|
10
|
-
fallbackWhenNotReady: true,
|
|
11
|
-
ready: alphameticReady,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
function alphameticReady(goal, env) {
|
|
17
|
-
return atomList(goal.args[0], env) !== null && wordList(goal.args[1], env) !== null && atomList(goal.args[2], env) !== null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function* alphameticSum({ goal, env }) {
|
|
21
|
-
const letters = atomList(goal.args[0], env);
|
|
22
|
-
const addends = wordList(goal.args[1], env);
|
|
23
|
-
const result = atomList(goal.args[2], env);
|
|
24
|
-
if (!letters || !addends || !result || letters.length > 10 || addends.length === 0) return;
|
|
25
|
-
|
|
26
|
-
const letterSet = new Set(letters);
|
|
27
|
-
for (const word of [...addends, result]) for (const letter of word) if (!letterSet.has(letter)) return;
|
|
28
|
-
|
|
29
|
-
const leading = new Set();
|
|
30
|
-
for (const word of [...addends, result]) if (word.length > 1) leading.add(word[0]);
|
|
31
|
-
const maxLen = Math.max(result.length, ...addends.map((word) => word.length));
|
|
32
|
-
const assignment = new Map();
|
|
33
|
-
const used = Array(10).fill(false);
|
|
34
|
-
|
|
35
|
-
function canUse(letter, digit) {
|
|
36
|
-
return !used[digit] && !(digit === 0 && leading.has(letter));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function assignDigit(letter, digit) {
|
|
40
|
-
assignment.set(letter, digit);
|
|
41
|
-
used[digit] = true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function unassignDigit(letter, digit) {
|
|
45
|
-
assignment.delete(letter);
|
|
46
|
-
used[digit] = false;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function* assignAddends(column, carry, index, sum) {
|
|
50
|
-
if (index >= addends.length) {
|
|
51
|
-
yield* finishColumn(column, sum);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const word = addends[index];
|
|
55
|
-
const letter = word[word.length - 1 - column];
|
|
56
|
-
if (letter === undefined) {
|
|
57
|
-
yield* assignAddends(column, carry, index + 1, sum);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const assigned = assignment.get(letter);
|
|
61
|
-
if (assigned !== undefined) {
|
|
62
|
-
yield* assignAddends(column, carry, index + 1, sum + assigned);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
for (let digit = 0; digit <= 9; digit++) {
|
|
66
|
-
if (!canUse(letter, digit)) continue;
|
|
67
|
-
assignDigit(letter, digit);
|
|
68
|
-
yield* assignAddends(column, carry, index + 1, sum + digit);
|
|
69
|
-
unassignDigit(letter, digit);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function* finishColumn(column, sum) {
|
|
74
|
-
const resultLetter = result[result.length - 1 - column];
|
|
75
|
-
const digit = sum % 10;
|
|
76
|
-
const nextCarry = Math.floor(sum / 10);
|
|
77
|
-
if (resultLetter === undefined) {
|
|
78
|
-
if (digit === 0) yield* solveColumn(column + 1, nextCarry);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const assigned = assignment.get(resultLetter);
|
|
82
|
-
if (assigned !== undefined) {
|
|
83
|
-
if (assigned === digit) yield* solveColumn(column + 1, nextCarry);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (!canUse(resultLetter, digit)) return;
|
|
87
|
-
assignDigit(resultLetter, digit);
|
|
88
|
-
yield* solveColumn(column + 1, nextCarry);
|
|
89
|
-
unassignDigit(resultLetter, digit);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function* solveColumn(column, carry) {
|
|
93
|
-
if (column >= maxLen) {
|
|
94
|
-
if (carry !== 0) return;
|
|
95
|
-
if (assignment.size !== letters.length) return;
|
|
96
|
-
yield new Map(assignment);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
yield* assignAddends(column, carry, 0, carry);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
for (const solution of solveColumn(0, 0)) {
|
|
103
|
-
const digitTerms = letters.map((letter) => numberTerm(String(solution.get(letter))));
|
|
104
|
-
const values = [...addends, result].map((word) => wordValue(word, solution));
|
|
105
|
-
const valueTerms = values.map((value) => numberTerm(String(value)));
|
|
106
|
-
const next = env.clone();
|
|
107
|
-
if (unify(goal.args[3], listFromItems(digitTerms), next) && unify(goal.args[4], listFromItems(valueTerms), next)) yield next;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function wordValue(word, assignment) {
|
|
112
|
-
let value = 0;
|
|
113
|
-
for (const letter of word) value = value * 10 + assignment.get(letter);
|
|
114
|
-
return value;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function atomList(term, env) {
|
|
118
|
-
const items = properListItems(term, env);
|
|
119
|
-
if (!items) return null;
|
|
120
|
-
const out = [];
|
|
121
|
-
for (const item of items) {
|
|
122
|
-
const text = atomKey(deref(item, env));
|
|
123
|
-
if (text == null) return null;
|
|
124
|
-
out.push(text);
|
|
125
|
-
}
|
|
126
|
-
return out;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function wordList(term, env) {
|
|
130
|
-
const items = properListItems(term, env);
|
|
131
|
-
if (!items) return null;
|
|
132
|
-
const out = [];
|
|
133
|
-
for (const item of items) {
|
|
134
|
-
const word = atomList(item, env);
|
|
135
|
-
if (!word) return null;
|
|
136
|
-
out.push(word);
|
|
137
|
-
}
|
|
138
|
-
return out;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function atomKey(term) {
|
|
142
|
-
if (term.type === 'atom' || term.type === 'string' || term.type === 'number') return term.name;
|
|
143
|
-
return null;
|
|
144
|
-
}
|