eyeling 1.32.1 → 1.33.1
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 +87 -16
- package/bin/eyeling.cjs +56 -4
- package/dist/browser/eyeling.browser.js +2 -11
- package/examples/eyelang/INTEGRATION.md +13 -0
- package/examples/eyelang/README.md +628 -0
- package/examples/eyelang/SPEC.md +684 -0
- package/examples/eyelang/access-control-policy.pl +52 -0
- package/examples/eyelang/ackermann.pl +46 -0
- package/examples/eyelang/age.pl +28 -0
- package/examples/eyelang/aliases-and-namespaces.pl +22 -0
- package/examples/eyelang/alignment-demo.pl +44 -0
- package/examples/eyelang/allen-interval-calculus.pl +64 -0
- package/examples/eyelang/ancestor.pl +21 -0
- package/examples/eyelang/animal.pl +21 -0
- package/examples/eyelang/annotation-rdf12.ttl +12 -0
- package/examples/eyelang/annotation.pl +34 -0
- package/examples/eyelang/auroracare.pl +309 -0
- package/examples/eyelang/backward.pl +12 -0
- package/examples/eyelang/basic-monadic.pl +10018 -0
- package/examples/eyelang/bayes-diagnosis.pl +108 -0
- package/examples/eyelang/bayes-therapy.pl +182 -0
- package/examples/eyelang/beam-deflection.pl +50 -0
- package/examples/eyelang/blocks-world-planning.pl +75 -0
- package/examples/eyelang/bmi.pl +232 -0
- package/examples/eyelang/braking-safety-worlds.pl +69 -0
- package/examples/eyelang/buck-converter-design.pl +78 -0
- package/examples/eyelang/cache-performance.pl +54 -0
- package/examples/eyelang/canary-release.pl +49 -0
- package/examples/eyelang/cat-koko.pl +24 -0
- package/examples/eyelang/clinical-trial-screening.pl +92 -0
- package/examples/eyelang/collatz-1000.pl +14 -0
- package/examples/eyelang/combinatorics-findall-sort.pl +37 -0
- package/examples/eyelang/competitive-enzyme-kinetics.pl +78 -0
- package/examples/eyelang/complex-matrix-stability.pl +45 -0
- package/examples/eyelang/complex.pl +121 -0
- package/examples/eyelang/composition-of-injective-functions-is-injective.pl +50 -0
- package/examples/eyelang/context-association.pl +53 -0
- package/examples/eyelang/control-system.pl +72 -0
- package/examples/eyelang/cryptarithmetic-send-more-money.pl +49 -0
- package/examples/eyelang/cyclic-path.pl +16 -0
- package/examples/eyelang/d3-group.pl +100 -0
- package/examples/eyelang/dairy-energy-balance.pl +65 -0
- package/examples/eyelang/data-negotiation.pl +39 -0
- package/examples/eyelang/deep-taxonomy-10.pl +115 -0
- package/examples/eyelang/deep-taxonomy-100.pl +385 -0
- package/examples/eyelang/deep-taxonomy-1000.pl +3085 -0
- package/examples/eyelang/deep-taxonomy-10000.pl +30094 -0
- package/examples/eyelang/deep-taxonomy-100000.pl +300184 -0
- package/examples/eyelang/delfour.pl +281 -0
- package/examples/eyelang/dense-hamiltonian-cycle.pl +92 -0
- package/examples/eyelang/deontic-logic.pl +52 -0
- package/examples/eyelang/derived-backward-rule.pl +30 -0
- package/examples/eyelang/derived-rule.pl +27 -0
- package/examples/eyelang/diamond-property.pl +38 -0
- package/examples/eyelang/dijkstra-findall-sort.pl +44 -0
- package/examples/eyelang/dijkstra-risk-path.pl +86 -0
- package/examples/eyelang/dijkstra.pl +46 -0
- package/examples/eyelang/dining-philosophers.pl +140 -0
- package/examples/eyelang/directional-language.ttl +9 -0
- package/examples/eyelang/dog.pl +25 -0
- package/examples/eyelang/drone-corridor-planner.pl +51 -0
- package/examples/eyelang/easter-computus.pl +89 -0
- package/examples/eyelang/electrical-rc-filter.pl +36 -0
- package/examples/eyelang/epidemic-policy.pl +67 -0
- package/examples/eyelang/equivalence-classes-overlap-implies-same-class.pl +27 -0
- package/examples/eyelang/eulerian-path.pl +85 -0
- package/examples/eyelang/ev-range-worlds.pl +82 -0
- package/examples/eyelang/exact-cover-sudoku.pl +113 -0
- package/examples/eyelang/existential-rule.pl +18 -0
- package/examples/eyelang/exoplanet-validation-worlds.pl +88 -0
- package/examples/eyelang/expression-eval.pl +43 -0
- package/examples/eyelang/eyeling-ackermann.n3 +41 -0
- package/examples/eyelang/eyeling-age-threshold.n3 +12 -0
- package/examples/eyelang/eyeling-alignment-demo.n3 +11 -0
- package/examples/eyelang/eyeling-allen-interval-calculus-small.n3 +13 -0
- package/examples/eyelang/eyeling-backward-recursion.n3 +11 -0
- package/examples/eyelang/eyeling-backward.n3 +10 -0
- package/examples/eyelang/eyeling-basic-monadic-small.n3 +11 -0
- package/examples/eyelang/eyeling-bmi.n3 +10 -0
- package/examples/eyelang/eyeling-cat-koko.n3 +15 -0
- package/examples/eyelang/eyeling-collatz-small.n3 +11 -0
- package/examples/eyelang/eyeling-collection.n3 +11 -0
- package/examples/eyelang/eyeling-complex-arithmetic.n3 +10 -0
- package/examples/eyelang/eyeling-context-association.n3 +11 -0
- package/examples/eyelang/eyeling-control-system-small.n3 +11 -0
- package/examples/eyelang/eyeling-crypto-builtins-extra.n3 +10 -0
- package/examples/eyelang/eyeling-crypto-builtins.n3 +8 -0
- package/examples/eyelang/eyeling-deep-taxonomy-10.n3 +18 -0
- package/examples/eyelang/eyeling-derived-backward-rule-flat.n3 +10 -0
- package/examples/eyelang/eyeling-derived-rule-flat.n3 +9 -0
- package/examples/eyelang/eyeling-digital-product-passport-small.n3 +11 -0
- package/examples/eyelang/eyeling-dijkstra-tiny.n3 +14 -0
- package/examples/eyelang/eyeling-dog-license.n3 +13 -0
- package/examples/eyelang/eyeling-drone-corridor-planner-small.n3 +13 -0
- package/examples/eyelang/eyeling-equals.n3 +8 -0
- package/examples/eyelang/eyeling-equivalence-classes.n3 +11 -0
- package/examples/eyelang/eyeling-euler-identity.n3 +9 -0
- package/examples/eyelang/eyeling-existential-rule.n3 +9 -0
- package/examples/eyelang/eyeling-expression-eval.n3 +11 -0
- package/examples/eyelang/eyeling-family-cousins-extended.n3 +12 -0
- package/examples/eyelang/eyeling-fastpow.n3 +10 -0
- package/examples/eyelang/eyeling-fibonacci.n3 +44 -0
- package/examples/eyelang/eyeling-french-cities-reachability.n3 +22 -0
- package/examples/eyelang/eyeling-goldbach-small.n3 +22 -0
- package/examples/eyelang/eyeling-good-cobbler.n3 +9 -0
- package/examples/eyelang/eyeling-list-builtins.n3 +10 -0
- package/examples/eyelang/eyeling-list-collection-extra.n3 +9 -0
- package/examples/eyelang/eyeling-math-builtins.n3 +9 -0
- package/examples/eyelang/eyeling-string-builtins-extra.n3 +9 -0
- package/examples/eyelang/eyeling-string-builtins.n3 +10 -0
- package/examples/eyelang/eyeling-time-builtins.n3 +11 -0
- package/examples/eyelang/eyeling-time-components-extra.n3 +10 -0
- package/examples/eyelang/eyeling-witch.n3 +10 -0
- package/examples/eyelang/family-cousins.n3 +17 -0
- package/examples/eyelang/family-cousins.pl +65 -0
- package/examples/eyelang/fastpow.pl +53 -0
- package/examples/eyelang/fft8-numeric.pl +83 -0
- package/examples/eyelang/fibonacci.pl +53 -0
- package/examples/eyelang/field-nitrogen-balance.pl +70 -0
- package/examples/eyelang/flandor.pl +296 -0
- package/examples/eyelang/floating-point.pl +23 -0
- package/examples/eyelang/four-color-map.pl +127 -0
- package/examples/eyelang/fundamental-theorem-arithmetic.pl +113 -0
- package/examples/eyelang/gcd-bezout-identity.pl +48 -0
- package/examples/eyelang/gd-step-certified.pl +158 -0
- package/examples/eyelang/gdpr-compliance.pl +69 -0
- package/examples/eyelang/goldbach-1000.pl +185 -0
- package/examples/eyelang/good-cobbler.pl +14 -0
- package/examples/eyelang/gps.pl +152 -0
- package/examples/eyelang/graph-reachability.pl +36 -0
- package/examples/eyelang/gray-code-counter.pl +48 -0
- package/examples/eyelang/greatest-lower-bound-uniqueness.pl +28 -0
- package/examples/eyelang/group-inverse-uniqueness.pl +34 -0
- package/examples/eyelang/hamiltonian-cycle.pl +55 -0
- package/examples/eyelang/hamiltonian-path.pl +49 -0
- package/examples/eyelang/hamming-code.pl +105 -0
- package/examples/eyelang/hanoi.pl +20 -0
- package/examples/eyelang/heat-loss.pl +51 -0
- package/examples/eyelang/heron-theorem.pl +36 -0
- package/examples/eyelang/ideal-gas-law.pl +37 -0
- package/examples/eyelang/illegitimate-reasoning.pl +88 -0
- package/examples/eyelang/kaprekar.pl +32 -0
- package/examples/eyelang/law-of-cosines.pl +31 -0
- package/examples/eyelang/least-squares-regression.pl +81 -0
- package/examples/eyelang/list-collection.pl +33 -0
- package/examples/eyelang/lldm.pl +78 -0
- package/examples/eyelang/manufacturing-quality-control.pl +73 -0
- package/examples/eyelang/matrix.pl +296 -0
- package/examples/eyelang/microgrid-dispatch.pl +85 -0
- package/examples/eyelang/monkey-bananas.pl +45 -0
- package/examples/eyelang/n-queens.pl +23 -0
- package/examples/eyelang/n3-builtins.n3 +28 -0
- package/examples/eyelang/network-sla.pl +48 -0
- package/examples/eyelang/newton-raphson.pl +49 -0
- package/examples/eyelang/nixon-diamond.pl +37 -0
- package/examples/eyelang/odrl-dpv-healthcare-risk-ranked.pl +266 -0
- package/examples/eyelang/odrl-dpv-risk-ranked.pl +320 -0
- package/examples/eyelang/orbital-transfer-design.pl +113 -0
- package/examples/eyelang/output/access-control-policy.pl +2 -0
- package/examples/eyelang/output/ackermann.pl +12 -0
- package/examples/eyelang/output/age.pl +2 -0
- package/examples/eyelang/output/aliases-and-namespaces.pl +5 -0
- package/examples/eyelang/output/alignment-demo.pl +32 -0
- package/examples/eyelang/output/allen-interval-calculus.pl +154 -0
- package/examples/eyelang/output/ancestor.pl +6 -0
- package/examples/eyelang/output/animal.pl +4 -0
- package/examples/eyelang/output/annotation-rdf12.ttl +1 -0
- package/examples/eyelang/output/annotation.pl +4 -0
- package/examples/eyelang/output/auroracare.pl +117 -0
- package/examples/eyelang/output/backward.pl +1 -0
- package/examples/eyelang/output/basic-monadic.pl +1518 -0
- package/examples/eyelang/output/bayes-diagnosis.pl +13 -0
- package/examples/eyelang/output/bayes-therapy.pl +23 -0
- package/examples/eyelang/output/beam-deflection.pl +5 -0
- package/examples/eyelang/output/blocks-world-planning.pl +4 -0
- package/examples/eyelang/output/bmi.pl +32 -0
- package/examples/eyelang/output/braking-safety-worlds.pl +18 -0
- package/examples/eyelang/output/buck-converter-design.pl +6 -0
- package/examples/eyelang/output/cache-performance.pl +4 -0
- package/examples/eyelang/output/canary-release.pl +5 -0
- package/examples/eyelang/output/cat-koko.pl +3 -0
- package/examples/eyelang/output/clinical-trial-screening.pl +9 -0
- package/examples/eyelang/output/collatz-1000.pl +1000 -0
- package/examples/eyelang/output/combinatorics-findall-sort.pl +2 -0
- package/examples/eyelang/output/competitive-enzyme-kinetics.pl +6 -0
- package/examples/eyelang/output/complex-matrix-stability.pl +5 -0
- package/examples/eyelang/output/complex.pl +1 -0
- package/examples/eyelang/output/composition-of-injective-functions-is-injective.pl +2 -0
- package/examples/eyelang/output/context-association.pl +3 -0
- package/examples/eyelang/output/control-system.pl +6 -0
- package/examples/eyelang/output/cryptarithmetic-send-more-money.pl +6 -0
- package/examples/eyelang/output/cyclic-path.pl +16 -0
- package/examples/eyelang/output/d3-group.pl +2 -0
- package/examples/eyelang/output/dairy-energy-balance.pl +13 -0
- package/examples/eyelang/output/data-negotiation.pl +1 -0
- package/examples/eyelang/output/deep-taxonomy-10.pl +16 -0
- package/examples/eyelang/output/deep-taxonomy-100.pl +16 -0
- package/examples/eyelang/output/deep-taxonomy-1000.pl +16 -0
- package/examples/eyelang/output/deep-taxonomy-10000.pl +16 -0
- package/examples/eyelang/output/deep-taxonomy-100000.pl +16 -0
- package/examples/eyelang/output/delfour.pl +31 -0
- package/examples/eyelang/output/dense-hamiltonian-cycle.pl +4 -0
- package/examples/eyelang/output/deontic-logic.pl +4 -0
- package/examples/eyelang/output/derived-backward-rule.pl +3 -0
- package/examples/eyelang/output/derived-rule.pl +2 -0
- package/examples/eyelang/output/diamond-property.pl +4 -0
- package/examples/eyelang/output/dijkstra-findall-sort.pl +2 -0
- package/examples/eyelang/output/dijkstra-risk-path.pl +29 -0
- package/examples/eyelang/output/dijkstra.pl +16 -0
- package/examples/eyelang/output/dining-philosophers.pl +350 -0
- package/examples/eyelang/output/directional-language.ttl +1 -0
- package/examples/eyelang/output/dog.pl +1 -0
- package/examples/eyelang/output/drone-corridor-planner.pl +17 -0
- package/examples/eyelang/output/easter-computus.pl +30 -0
- package/examples/eyelang/output/electrical-rc-filter.pl +3 -0
- package/examples/eyelang/output/epidemic-policy.pl +14 -0
- package/examples/eyelang/output/equivalence-classes-overlap-implies-same-class.pl +18 -0
- package/examples/eyelang/output/eulerian-path.pl +3 -0
- package/examples/eyelang/output/ev-range-worlds.pl +19 -0
- package/examples/eyelang/output/exact-cover-sudoku.pl +3 -0
- package/examples/eyelang/output/existential-rule.pl +2 -0
- package/examples/eyelang/output/exoplanet-validation-worlds.pl +22 -0
- package/examples/eyelang/output/expression-eval.pl +1 -0
- package/examples/eyelang/output/eyeling-ackermann.n3 +12 -0
- package/examples/eyelang/output/eyeling-age-threshold.n3 +4 -0
- package/examples/eyelang/output/eyeling-alignment-demo.n3 +1 -0
- package/examples/eyelang/output/eyeling-allen-interval-calculus-small.n3 +3 -0
- package/examples/eyelang/output/eyeling-backward-recursion.n3 +9 -0
- package/examples/eyelang/output/eyeling-backward.n3 +1 -0
- package/examples/eyelang/output/eyeling-basic-monadic-small.n3 +8 -0
- package/examples/eyelang/output/eyeling-bmi.n3 +2 -0
- package/examples/eyelang/output/eyeling-cat-koko.n3 +3 -0
- package/examples/eyelang/output/eyeling-collatz-small.n3 +3 -0
- package/examples/eyelang/output/eyeling-collection.n3 +1 -0
- package/examples/eyelang/output/eyeling-complex-arithmetic.n3 +5 -0
- package/examples/eyelang/output/eyeling-context-association.n3 +4 -0
- package/examples/eyelang/output/eyeling-control-system-small.n3 +4 -0
- package/examples/eyelang/output/eyeling-crypto-builtins-extra.n3 +3 -0
- package/examples/eyelang/output/eyeling-crypto-builtins.n3 +2 -0
- package/examples/eyelang/output/eyeling-deep-taxonomy-10.n3 +32 -0
- package/examples/eyelang/output/eyeling-derived-backward-rule-flat.n3 +4 -0
- package/examples/eyelang/output/eyeling-derived-rule-flat.n3 +2 -0
- package/examples/eyelang/output/eyeling-digital-product-passport-small.n3 +3 -0
- package/examples/eyelang/output/eyeling-dijkstra-tiny.n3 +9 -0
- package/examples/eyelang/output/eyeling-dog-license.n3 +1 -0
- package/examples/eyelang/output/eyeling-drone-corridor-planner-small.n3 +5 -0
- package/examples/eyelang/output/eyeling-equals.n3 +1 -0
- package/examples/eyelang/output/eyeling-equivalence-classes.n3 +2 -0
- package/examples/eyelang/output/eyeling-euler-identity.n3 +3 -0
- package/examples/eyelang/output/eyeling-existential-rule.n3 +4 -0
- package/examples/eyelang/output/eyeling-expression-eval.n3 +3 -0
- package/examples/eyelang/output/eyeling-family-cousins-extended.n3 +6 -0
- package/examples/eyelang/output/eyeling-fastpow.n3 +4 -0
- package/examples/eyelang/output/eyeling-fibonacci.n3 +6 -0
- package/examples/eyelang/output/eyeling-french-cities-reachability.n3 +25 -0
- package/examples/eyelang/output/eyeling-goldbach-small.n3 +2 -0
- package/examples/eyelang/output/eyeling-good-cobbler.n3 +2 -0
- package/examples/eyelang/output/eyeling-list-builtins.n3 +6 -0
- package/examples/eyelang/output/eyeling-list-collection-extra.n3 +5 -0
- package/examples/eyelang/output/eyeling-math-builtins.n3 +5 -0
- package/examples/eyelang/output/eyeling-string-builtins-extra.n3 +3 -0
- package/examples/eyelang/output/eyeling-string-builtins.n3 +4 -0
- package/examples/eyelang/output/eyeling-time-builtins.n3 +4 -0
- package/examples/eyelang/output/eyeling-time-components-extra.n3 +5 -0
- package/examples/eyelang/output/eyeling-witch.n3 +2 -0
- package/examples/eyelang/output/family-cousins.n3 +8 -0
- package/examples/eyelang/output/family-cousins.pl +28 -0
- package/examples/eyelang/output/fastpow.pl +6 -0
- package/examples/eyelang/output/fft8-numeric.pl +4 -0
- package/examples/eyelang/output/fibonacci.pl +6 -0
- package/examples/eyelang/output/field-nitrogen-balance.pl +21 -0
- package/examples/eyelang/output/flandor.pl +43 -0
- package/examples/eyelang/output/floating-point.pl +9 -0
- package/examples/eyelang/output/four-color-map.pl +3 -0
- package/examples/eyelang/output/fundamental-theorem-arithmetic.pl +9 -0
- package/examples/eyelang/output/gcd-bezout-identity.pl +36 -0
- package/examples/eyelang/output/gd-step-certified.pl +79 -0
- package/examples/eyelang/output/gdpr-compliance.pl +6 -0
- package/examples/eyelang/output/goldbach-1000.pl +667 -0
- package/examples/eyelang/output/good-cobbler.pl +1 -0
- package/examples/eyelang/output/gps.pl +21 -0
- package/examples/eyelang/output/graph-reachability.pl +3 -0
- package/examples/eyelang/output/gray-code-counter.pl +1 -0
- package/examples/eyelang/output/greatest-lower-bound-uniqueness.pl +2 -0
- package/examples/eyelang/output/group-inverse-uniqueness.pl +2 -0
- package/examples/eyelang/output/hamiltonian-cycle.pl +4 -0
- package/examples/eyelang/output/hamiltonian-path.pl +121 -0
- package/examples/eyelang/output/hamming-code.pl +6 -0
- package/examples/eyelang/output/hanoi.pl +1 -0
- package/examples/eyelang/output/heat-loss.pl +5 -0
- package/examples/eyelang/output/heron-theorem.pl +4 -0
- package/examples/eyelang/output/ideal-gas-law.pl +3 -0
- package/examples/eyelang/output/illegitimate-reasoning.pl +15 -0
- package/examples/eyelang/output/kaprekar.pl +8 -0
- package/examples/eyelang/output/law-of-cosines.pl +3 -0
- package/examples/eyelang/output/least-squares-regression.pl +5 -0
- package/examples/eyelang/output/list-collection.pl +3 -0
- package/examples/eyelang/output/lldm.pl +6 -0
- package/examples/eyelang/output/manufacturing-quality-control.pl +6 -0
- package/examples/eyelang/output/matrix.pl +10 -0
- package/examples/eyelang/output/microgrid-dispatch.pl +6 -0
- package/examples/eyelang/output/monkey-bananas.pl +5 -0
- package/examples/eyelang/output/n-queens.pl +93 -0
- package/examples/eyelang/output/n3-builtins.n3 +6 -0
- package/examples/eyelang/output/network-sla.pl +4 -0
- package/examples/eyelang/output/newton-raphson.pl +3 -0
- package/examples/eyelang/output/nixon-diamond.pl +5 -0
- package/examples/eyelang/output/odrl-dpv-healthcare-risk-ranked.pl +42 -0
- package/examples/eyelang/output/odrl-dpv-risk-ranked.pl +120 -0
- package/examples/eyelang/output/orbital-transfer-design.pl +7 -0
- package/examples/eyelang/output/path-discovery.pl +3 -0
- package/examples/eyelang/output/peano-arithmetic.pl +3 -0
- package/examples/eyelang/output/peasant.pl +10 -0
- package/examples/eyelang/output/pendulum-period.pl +4 -0
- package/examples/eyelang/output/polynomial.pl +14 -0
- package/examples/eyelang/output/project-portfolio-optimization.pl +6 -0
- package/examples/eyelang/output/proof-contrapositive.pl +3 -0
- package/examples/eyelang/output/quadratic-formula.pl +6 -0
- package/examples/eyelang/output/quine-mccluskey.pl +3 -0
- package/examples/eyelang/output/radioactive-decay.pl +5 -0
- package/examples/eyelang/output/resilient-city-orchestration.pl +67 -0
- package/examples/eyelang/output/riemann-hypothesis.pl +12 -0
- package/examples/eyelang/output/sat-dpll.pl +5 -0
- package/examples/eyelang/output/security-incident-correlation.pl +3 -0
- package/examples/eyelang/output/service-impact.pl +11 -0
- package/examples/eyelang/output/sieve.pl +1 -0
- package/examples/eyelang/output/skolem-functions.pl +16 -0
- package/examples/eyelang/output/socket-age.pl +1 -0
- package/examples/eyelang/output/socket-family.pl +3 -0
- package/examples/eyelang/output/socrates.n3 +1 -0
- package/examples/eyelang/output/socrates.pl +2 -0
- package/examples/eyelang/output/statistics-summary.pl +4 -0
- package/examples/eyelang/output/sudoku.pl +2 -0
- package/examples/eyelang/output/superdense-coding.pl +6 -0
- package/examples/eyelang/output/traveling-salesman.pl +1 -0
- package/examples/eyelang/output/triple-term.n3 +2 -0
- package/examples/eyelang/output/turing.pl +12 -0
- package/examples/eyelang/output/vector-similarity.pl +4 -0
- package/examples/eyelang/output/witch.pl +7 -0
- package/examples/eyelang/output/wolf-goat-cabbage.pl +3 -0
- package/examples/eyelang/output/zebra.pl +3 -0
- package/examples/eyelang/path-discovery.pl +44998 -0
- package/examples/eyelang/peano-arithmetic.pl +31 -0
- package/examples/eyelang/peasant.pl +30 -0
- package/examples/eyelang/pendulum-period.pl +50 -0
- package/examples/eyelang/polynomial.pl +124 -0
- package/examples/eyelang/project-portfolio-optimization.pl +101 -0
- package/examples/eyelang/proof/age.pl +71 -0
- package/examples/eyelang/proof/aliases-and-namespaces.pl +78 -0
- package/examples/eyelang/proof/ancestor.pl +140 -0
- package/examples/eyelang/proof/animal.pl +68 -0
- package/examples/eyelang/proof/annotation.pl +80 -0
- package/examples/eyelang/proof/backward.pl +22 -0
- package/examples/eyelang/proof/cat-koko.pl +86 -0
- package/examples/eyelang/proof/data-negotiation.pl +76 -0
- package/examples/eyelang/proof/derived-rule.pl +43 -0
- package/examples/eyelang/proof/dog.pl +31 -0
- package/examples/eyelang/proof/electrical-rc-filter.pl +105 -0
- package/examples/eyelang/proof/existential-rule.pl +40 -0
- package/examples/eyelang/proof/floating-point.pl +160 -0
- package/examples/eyelang/proof/good-cobbler.pl +16 -0
- package/examples/eyelang/proof/group-inverse-uniqueness.pl +84 -0
- package/examples/eyelang/proof/list-collection.pl +52 -0
- package/examples/eyelang/proof/proof-contrapositive.pl +78 -0
- package/examples/eyelang/proof/socket-age.pl +32 -0
- package/examples/eyelang/proof/socket-family.pl +59 -0
- package/examples/eyelang/proof/socrates.pl +38 -0
- package/examples/eyelang/proof-contrapositive.pl +27 -0
- package/examples/eyelang/quadratic-formula.pl +54 -0
- package/examples/eyelang/quine-mccluskey.pl +143 -0
- package/examples/eyelang/radioactive-decay.pl +56 -0
- package/examples/eyelang/resilient-city-orchestration.pl +303 -0
- package/examples/eyelang/riemann-hypothesis.pl +110 -0
- package/examples/eyelang/sat-dpll.pl +80 -0
- package/examples/eyelang/security-incident-correlation.pl +69 -0
- package/examples/eyelang/service-impact.pl +41 -0
- package/examples/eyelang/sieve.pl +20 -0
- package/examples/eyelang/skolem-functions.pl +52 -0
- package/examples/eyelang/socket-age.pl +39 -0
- package/examples/eyelang/socket-family.pl +28 -0
- package/examples/eyelang/socrates.n3 +11 -0
- package/examples/eyelang/socrates.pl +19 -0
- package/examples/eyelang/statistics-summary.pl +54 -0
- package/examples/eyelang/sudoku.pl +20 -0
- package/examples/eyelang/superdense-coding.pl +84 -0
- package/examples/eyelang/traveling-salesman.pl +64 -0
- package/examples/eyelang/triple-term.n3 +9 -0
- package/examples/eyelang/turing.pl +67 -0
- package/examples/eyelang/vector-similarity.pl +56 -0
- package/examples/eyelang/witch.pl +38 -0
- package/examples/eyelang/wolf-goat-cabbage.pl +56 -0
- package/examples/eyelang/zebra.pl +44 -0
- package/eyelang.d.ts +92 -0
- package/eyeling-builtins.ttl +1 -1
- package/eyeling.js +2 -11
- package/index.d.ts +50 -2
- package/index.js +95 -1
- package/lib/builtins.js +1 -11
- package/lib/cli.js +1 -0
- package/lib/eyelang/bin.js +7 -0
- package/lib/eyelang/builtins/aggregation.mjs +81 -0
- package/lib/eyelang/builtins/alphametic.mjs +144 -0
- package/lib/eyelang/builtins/arithmetic.mjs +197 -0
- package/lib/eyelang/builtins/control.mjs +22 -0
- package/lib/eyelang/builtins/core.mjs +78 -0
- package/lib/eyelang/builtins/formula.mjs +42 -0
- package/lib/eyelang/builtins/lists.mjs +149 -0
- package/lib/eyelang/builtins/matrix.mjs +226 -0
- package/lib/eyelang/builtins/n3.mjs +483 -0
- package/lib/eyelang/builtins/number-theory.mjs +114 -0
- package/lib/eyelang/builtins/portfolio.mjs +73 -0
- package/lib/eyelang/builtins/registry.mjs +54 -0
- package/lib/eyelang/builtins/search.mjs +579 -0
- package/lib/eyelang/builtins/strings.mjs +41 -0
- package/lib/eyelang/builtins/sudoku.mjs +141 -0
- package/lib/eyelang/cli.mjs +192 -0
- package/lib/eyelang/explain.mjs +324 -0
- package/lib/eyelang/hash.mjs +294 -0
- package/lib/eyelang/index.mjs +48 -0
- package/lib/eyelang/parser.mjs +428 -0
- package/lib/eyelang/program.mjs +244 -0
- package/lib/eyelang/rdf.mjs +747 -0
- package/lib/eyelang/solver.mjs +237 -0
- package/lib/eyelang/term.mjs +328 -0
- package/package.json +12 -3
- package/test/builtins.test.js +15 -2
- package/test/eyelang/conformance/README.md +45 -0
- package/test/eyelang/conformance/cases/core/001_fact_output.pl +4 -0
- package/test/eyelang/conformance/cases/core/001_fact_query.query +1 -0
- package/test/eyelang/conformance/cases/core/002_rule_recursion.pl +7 -0
- package/test/eyelang/conformance/cases/core/002_rule_recursion.query +1 -0
- package/test/eyelang/conformance/cases/core/003_terms_and_readback.pl +16 -0
- package/test/eyelang/conformance/cases/core/003_terms_and_readback.query +1 -0
- package/test/eyelang/conformance/cases/core/004_conjunction_and_parentheses.pl +5 -0
- package/test/eyelang/conformance/cases/core/004_conjunction_and_parentheses.query +1 -0
- package/test/eyelang/conformance/cases/core/005_list_deconstruction.pl +6 -0
- package/test/eyelang/conformance/cases/core/005_list_deconstruction.query +1 -0
- package/test/eyelang/conformance/cases/core/006_comma_formula_data.pl +4 -0
- package/test/eyelang/conformance/cases/core/006_comma_formula_data.query +1 -0
- package/test/eyelang/conformance/cases/core/007_anonymous_variables.pl +5 -0
- package/test/eyelang/conformance/cases/core/007_anonymous_variables.query +1 -0
- package/test/eyelang/conformance/cases/core/008_graphic_atoms.pl +6 -0
- package/test/eyelang/conformance/cases/core/008_graphic_atoms.query +1 -0
- package/test/eyelang/conformance/cases/core/009_comments_and_whitespace.pl +5 -0
- package/test/eyelang/conformance/cases/core/009_comments_and_whitespace.query +1 -0
- package/test/eyelang/conformance/cases/core/010_variable_scope_and_reuse.pl +8 -0
- package/test/eyelang/conformance/cases/core/010_variable_scope_and_reuse.query +1 -0
- package/test/eyelang/conformance/cases/core/011_predicate_arity.pl +6 -0
- package/test/eyelang/conformance/cases/core/011_predicate_arity.query +1 -0
- package/test/eyelang/conformance/cases/core/012_nested_compound_unification.pl +5 -0
- package/test/eyelang/conformance/cases/core/012_nested_compound_unification.query +1 -0
- package/test/eyelang/conformance/cases/core/013_multiple_clauses_order.pl +6 -0
- package/test/eyelang/conformance/cases/core/013_multiple_clauses_order.query +1 -0
- package/test/eyelang/conformance/cases/core/014_failure_filters_answers.pl +7 -0
- package/test/eyelang/conformance/cases/core/014_failure_filters_answers.query +1 -0
- package/test/eyelang/conformance/cases/core/015_improper_list_unification.pl +6 -0
- package/test/eyelang/conformance/cases/core/015_improper_list_unification.query +1 -0
- package/test/eyelang/conformance/cases/core/016_zero_arity_compound.pl +4 -0
- package/test/eyelang/conformance/cases/core/016_zero_arity_compound.query +1 -0
- package/test/eyelang/conformance/cases/core/017_three_step_recursion.pl +8 -0
- package/test/eyelang/conformance/cases/core/017_three_step_recursion.query +1 -0
- package/test/eyelang/conformance/cases/core/018_quoted_atom_readback.pl +6 -0
- package/test/eyelang/conformance/cases/core/018_quoted_atom_readback.query +1 -0
- package/test/eyelang/conformance/cases/core/019_parenthesized_three_conjuncts.pl +7 -0
- package/test/eyelang/conformance/cases/core/019_parenthesized_three_conjuncts.query +1 -0
- package/test/eyelang/conformance/cases/core/020_nested_list_terms.pl +5 -0
- package/test/eyelang/conformance/cases/core/020_nested_list_terms.query +1 -0
- package/test/eyelang/conformance/cases/core/021_repeated_variable_head.pl +7 -0
- package/test/eyelang/conformance/cases/core/022_rule_head_structure.pl +5 -0
- package/test/eyelang/conformance/cases/core/023_quoted_escapes_readback.pl +5 -0
- package/test/eyelang/conformance/cases/core/024_numeric_literal_readback.pl +6 -0
- package/test/eyelang/conformance/cases/core/025_body_parentheses_with_formula_data.pl +5 -0
- package/test/eyelang/conformance/cases/core/026_underscore_named_variable_reuse.pl +5 -0
- package/test/eyelang/conformance/cases/extension/001_default_derived_output.pl +5 -0
- package/test/eyelang/conformance/cases/extension/002_materialize_focus.pl +5 -0
- package/test/eyelang/conformance/cases/extension/003_arithmetic_and_comparison.pl +12 -0
- package/test/eyelang/conformance/cases/extension/003_arithmetic_and_comparison.query +1 -0
- package/test/eyelang/conformance/cases/extension/004_strings_and_atoms.pl +6 -0
- package/test/eyelang/conformance/cases/extension/004_strings_and_atoms.query +1 -0
- package/test/eyelang/conformance/cases/extension/005_lists_aggregation_ordering.pl +10 -0
- package/test/eyelang/conformance/cases/extension/005_lists_aggregation_ordering.query +1 -0
- package/test/eyelang/conformance/cases/extension/006_formula_terms.pl +5 -0
- package/test/eyelang/conformance/cases/extension/006_formula_terms.query +1 -0
- package/test/eyelang/conformance/cases/extension/007_negation_once_generators.pl +7 -0
- package/test/eyelang/conformance/cases/extension/007_negation_once_generators.query +1 -0
- package/test/eyelang/conformance/cases/extension/008_equality_and_inequality.pl +6 -0
- package/test/eyelang/conformance/cases/extension/008_equality_and_inequality.query +1 -0
- package/test/eyelang/conformance/cases/extension/009_list_relations.pl +6 -0
- package/test/eyelang/conformance/cases/extension/009_list_relations.query +1 -0
- package/test/eyelang/conformance/cases/extension/010_append_splits.pl +3 -0
- package/test/eyelang/conformance/cases/extension/010_append_splits.query +1 -0
- package/test/eyelang/conformance/cases/extension/011_matching_and_comparison.pl +7 -0
- package/test/eyelang/conformance/cases/extension/011_matching_and_comparison.query +1 -0
- package/test/eyelang/conformance/cases/extension/012_memoize_declaration.pl +8 -0
- package/test/eyelang/conformance/cases/extension/012_memoize_declaration.query +1 -0
- package/test/eyelang/conformance/cases/extension/013_numeric_functions.pl +9 -0
- package/test/eyelang/conformance/cases/extension/013_numeric_functions.query +1 -0
- package/test/eyelang/conformance/cases/extension/014_between_enumeration.pl +3 -0
- package/test/eyelang/conformance/cases/extension/014_between_enumeration.query +1 -0
- package/test/eyelang/conformance/cases/extension/015_smallest_divisor.pl +3 -0
- package/test/eyelang/conformance/cases/extension/015_smallest_divisor.query +1 -0
- package/test/eyelang/conformance/cases/extension/016_negation_filter.pl +7 -0
- package/test/eyelang/conformance/cases/extension/016_negation_filter.query +1 -0
- package/test/eyelang/conformance/cases/extension/017_once_user_predicate.pl +5 -0
- package/test/eyelang/conformance/cases/extension/017_once_user_predicate.query +1 -0
- package/test/eyelang/conformance/cases/extension/018_findall_user_goal.pl +6 -0
- package/test/eyelang/conformance/cases/extension/018_findall_user_goal.query +1 -0
- package/test/eyelang/conformance/cases/extension/019_sort_deduplicates_atoms.pl +3 -0
- package/test/eyelang/conformance/cases/extension/019_sort_deduplicates_atoms.query +1 -0
- package/test/eyelang/conformance/cases/extension/020_append_bound_prefix_suffix.pl +4 -0
- package/test/eyelang/conformance/cases/extension/020_append_bound_prefix_suffix.query +1 -0
- package/test/eyelang/conformance/cases/extension/021_nth0_index_generation.pl +3 -0
- package/test/eyelang/conformance/cases/extension/021_nth0_index_generation.query +1 -0
- package/test/eyelang/conformance/cases/extension/022_set_nth0_edges.pl +4 -0
- package/test/eyelang/conformance/cases/extension/022_set_nth0_edges.query +1 -0
- package/test/eyelang/conformance/cases/extension/023_select_duplicate_occurrences.pl +3 -0
- package/test/eyelang/conformance/cases/extension/023_select_duplicate_occurrences.query +1 -0
- package/test/eyelang/conformance/cases/extension/024_not_member_filter.pl +6 -0
- package/test/eyelang/conformance/cases/extension/024_not_member_filter.query +1 -0
- package/test/eyelang/conformance/cases/extension/025_is_list_filter.pl +5 -0
- package/test/eyelang/conformance/cases/extension/025_is_list_filter.query +1 -0
- package/test/eyelang/conformance/cases/extension/026_nested_formula_terms.pl +5 -0
- package/test/eyelang/conformance/cases/extension/026_nested_formula_terms.query +1 -0
- package/test/eyelang/conformance/cases/extension/027_materialize_excludes_source_fact.pl +6 -0
- package/test/eyelang/conformance/cases/extension/028_numeric_and_lexical_comparison.pl +5 -0
- package/test/eyelang/conformance/cases/extension/028_numeric_and_lexical_comparison.query +1 -0
- package/test/eyelang/conformance/cases/extension/029_string_matching_filters.pl +6 -0
- package/test/eyelang/conformance/cases/extension/029_string_matching_filters.query +1 -0
- package/test/eyelang/conformance/cases/extension/030_string_and_atom_concat.pl +4 -0
- package/test/eyelang/conformance/cases/extension/030_string_and_atom_concat.query +1 -0
- package/test/eyelang/conformance/cases/extension/031_countall_empty_and_nonempty.pl +4 -0
- package/test/eyelang/conformance/cases/extension/031_countall_empty_and_nonempty.query +1 -0
- package/test/eyelang/conformance/cases/extension/032_sumall_numeric_template.pl +5 -0
- package/test/eyelang/conformance/cases/extension/032_sumall_numeric_template.query +1 -0
- package/test/eyelang/conformance/cases/extension/033_aggregate_min_template.pl +5 -0
- package/test/eyelang/conformance/cases/extension/033_aggregate_min_template.query +1 -0
- package/test/eyelang/conformance/cases/extension/034_aggregate_max_compound_key.pl +5 -0
- package/test/eyelang/conformance/cases/extension/034_aggregate_max_compound_key.query +1 -0
- package/test/eyelang/conformance/cases/extension/035_date_difference.pl +4 -0
- package/test/eyelang/conformance/cases/extension/036_extended_gcd.pl +3 -0
- package/test/eyelang/conformance/cases/extension/037_collatz_trajectory.pl +3 -0
- package/test/eyelang/conformance/cases/extension/038_kaprekar_steps.pl +3 -0
- package/test/eyelang/conformance/cases/extension/039_goldbach_pair.pl +3 -0
- package/test/eyelang/conformance/cases/extension/040_matrix_operations.pl +5 -0
- package/test/eyelang/conformance/cases/extension/041_atom_range_generators.pl +5 -0
- package/test/eyelang/conformance/cases/extension/042_n_queens_small.pl +3 -0
- package/test/eyelang/conformance/cases/extension/043_cnf_model.pl +3 -0
- package/test/eyelang/conformance/cases/extension/044_cover9_filter.pl +6 -0
- package/test/eyelang/conformance/cases/extension/045_alphametic_sum_small.pl +3 -0
- package/test/eyelang/conformance/cases/extension/046_bounded_subset.pl +4 -0
- package/test/eyelang/conformance/expected/core/001_fact_output.out +1 -0
- package/test/eyelang/conformance/expected/core/002_rule_recursion.out +2 -0
- package/test/eyelang/conformance/expected/core/003_terms_and_readback.out +13 -0
- package/test/eyelang/conformance/expected/core/004_conjunction_and_parentheses.out +1 -0
- package/test/eyelang/conformance/expected/core/005_list_deconstruction.out +2 -0
- package/test/eyelang/conformance/expected/core/006_comma_formula_data.out +1 -0
- package/test/eyelang/conformance/expected/core/007_anonymous_variables.out +1 -0
- package/test/eyelang/conformance/expected/core/008_graphic_atoms.out +3 -0
- package/test/eyelang/conformance/expected/core/009_comments_and_whitespace.out +2 -0
- package/test/eyelang/conformance/expected/core/010_variable_scope_and_reuse.out +2 -0
- package/test/eyelang/conformance/expected/core/011_predicate_arity.out +2 -0
- package/test/eyelang/conformance/expected/core/012_nested_compound_unification.out +2 -0
- package/test/eyelang/conformance/expected/core/013_multiple_clauses_order.out +2 -0
- package/test/eyelang/conformance/expected/core/014_failure_filters_answers.out +1 -0
- package/test/eyelang/conformance/expected/core/015_improper_list_unification.out +3 -0
- package/test/eyelang/conformance/expected/core/016_zero_arity_compound.out +1 -0
- package/test/eyelang/conformance/expected/core/017_three_step_recursion.out +3 -0
- package/test/eyelang/conformance/expected/core/018_quoted_atom_readback.out +3 -0
- package/test/eyelang/conformance/expected/core/019_parenthesized_three_conjuncts.out +1 -0
- package/test/eyelang/conformance/expected/core/020_nested_list_terms.out +2 -0
- package/test/eyelang/conformance/expected/core/021_repeated_variable_head.out +2 -0
- package/test/eyelang/conformance/expected/core/022_rule_head_structure.out +2 -0
- package/test/eyelang/conformance/expected/core/023_quoted_escapes_readback.out +2 -0
- package/test/eyelang/conformance/expected/core/024_numeric_literal_readback.out +3 -0
- package/test/eyelang/conformance/expected/core/025_body_parentheses_with_formula_data.out +1 -0
- package/test/eyelang/conformance/expected/core/026_underscore_named_variable_reuse.out +1 -0
- package/test/eyelang/conformance/expected/extension/001_default_derived_output.out +3 -0
- package/test/eyelang/conformance/expected/extension/002_materialize_focus.out +1 -0
- package/test/eyelang/conformance/expected/extension/003_arithmetic_and_comparison.out +10 -0
- package/test/eyelang/conformance/expected/extension/004_strings_and_atoms.out +4 -0
- package/test/eyelang/conformance/expected/extension/005_lists_aggregation_ordering.out +9 -0
- package/test/eyelang/conformance/expected/extension/006_formula_terms.out +4 -0
- package/test/eyelang/conformance/expected/extension/007_negation_once_generators.out +2 -0
- package/test/eyelang/conformance/expected/extension/008_equality_and_inequality.out +4 -0
- package/test/eyelang/conformance/expected/extension/009_list_relations.out +5 -0
- package/test/eyelang/conformance/expected/extension/010_append_splits.out +3 -0
- package/test/eyelang/conformance/expected/extension/011_matching_and_comparison.out +5 -0
- package/test/eyelang/conformance/expected/extension/012_memoize_declaration.out +2 -0
- package/test/eyelang/conformance/expected/extension/013_numeric_functions.out +7 -0
- package/test/eyelang/conformance/expected/extension/014_between_enumeration.out +3 -0
- package/test/eyelang/conformance/expected/extension/015_smallest_divisor.out +1 -0
- package/test/eyelang/conformance/expected/extension/016_negation_filter.out +2 -0
- package/test/eyelang/conformance/expected/extension/017_once_user_predicate.out +1 -0
- package/test/eyelang/conformance/expected/extension/018_findall_user_goal.out +1 -0
- package/test/eyelang/conformance/expected/extension/019_sort_deduplicates_atoms.out +1 -0
- package/test/eyelang/conformance/expected/extension/020_append_bound_prefix_suffix.out +2 -0
- package/test/eyelang/conformance/expected/extension/021_nth0_index_generation.out +1 -0
- package/test/eyelang/conformance/expected/extension/022_set_nth0_edges.out +2 -0
- package/test/eyelang/conformance/expected/extension/023_select_duplicate_occurrences.out +2 -0
- package/test/eyelang/conformance/expected/extension/024_not_member_filter.out +1 -0
- package/test/eyelang/conformance/expected/extension/025_is_list_filter.out +1 -0
- package/test/eyelang/conformance/expected/extension/026_nested_formula_terms.out +6 -0
- package/test/eyelang/conformance/expected/extension/027_materialize_excludes_source_fact.out +1 -0
- package/test/eyelang/conformance/expected/extension/028_numeric_and_lexical_comparison.out +3 -0
- package/test/eyelang/conformance/expected/extension/029_string_matching_filters.out +2 -0
- package/test/eyelang/conformance/expected/extension/030_string_and_atom_concat.out +2 -0
- package/test/eyelang/conformance/expected/extension/031_countall_empty_and_nonempty.out +1 -0
- package/test/eyelang/conformance/expected/extension/032_sumall_numeric_template.out +1 -0
- package/test/eyelang/conformance/expected/extension/033_aggregate_min_template.out +1 -0
- package/test/eyelang/conformance/expected/extension/034_aggregate_max_compound_key.out +1 -0
- package/test/eyelang/conformance/expected/extension/035_date_difference.out +2 -0
- package/test/eyelang/conformance/expected/extension/036_extended_gcd.out +1 -0
- package/test/eyelang/conformance/expected/extension/037_collatz_trajectory.out +1 -0
- package/test/eyelang/conformance/expected/extension/038_kaprekar_steps.out +1 -0
- package/test/eyelang/conformance/expected/extension/039_goldbach_pair.out +2 -0
- package/test/eyelang/conformance/expected/extension/040_matrix_operations.out +3 -0
- package/test/eyelang/conformance/expected/extension/041_atom_range_generators.out +8 -0
- package/test/eyelang/conformance/expected/extension/042_n_queens_small.out +2 -0
- package/test/eyelang/conformance/expected/extension/043_cnf_model.out +1 -0
- package/test/eyelang/conformance/expected/extension/044_cover9_filter.out +2 -0
- package/test/eyelang/conformance/expected/extension/045_alphametic_sum_small.out +4 -0
- package/test/eyelang/conformance/expected/extension/046_bounded_subset.out +5 -0
- package/test/eyelang/run-all.mjs +20 -0
- package/test/eyelang/run-conformance.mjs +80 -0
- package/test/eyelang/run-examples.mjs +126 -0
- package/test/eyelang/run-regression.mjs +640 -0
- package/test/eyelang/test-style.mjs +91 -0
- package/test/eyelang.test.js +58 -0
- package/test/run.js +1 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
% Newton-Raphson root finding, adapted from Eyelet input/newton-raphson.pl.
|
|
2
|
+
% The selected roots match Eyelet output-swipl/newton-raphson.pl.
|
|
3
|
+
|
|
4
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
5
|
+
materialize(findRoot, 2).
|
|
6
|
+
|
|
7
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
8
|
+
want_root([1, 1.0, 1.0e-15]).
|
|
9
|
+
want_root([2, 2.0, 1.0e-15]).
|
|
10
|
+
want_root([3, 3.0, 1.0e-15]).
|
|
11
|
+
|
|
12
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
13
|
+
findRoot(Input, Root) :-
|
|
14
|
+
want_root(Input),
|
|
15
|
+
find_root(Input, Root).
|
|
16
|
+
|
|
17
|
+
% f(1, X) = X^2 - 2
|
|
18
|
+
f(1, X, Y) :-
|
|
19
|
+
mul(X, X, XX),
|
|
20
|
+
sub(XX, 2, Y).
|
|
21
|
+
|
|
22
|
+
% f(2, X) = log(X) - 1
|
|
23
|
+
f(2, X, Y) :-
|
|
24
|
+
log(X, LX),
|
|
25
|
+
sub(LX, 1, Y).
|
|
26
|
+
|
|
27
|
+
% f(3, X) = sin(X)
|
|
28
|
+
f(3, X, Y) :-
|
|
29
|
+
sin(X, Y).
|
|
30
|
+
|
|
31
|
+
fd(1, X, Y) :-
|
|
32
|
+
mul(2, X, Y).
|
|
33
|
+
fd(2, X, Y) :-
|
|
34
|
+
div(1, X, Y).
|
|
35
|
+
fd(3, X, Y) :-
|
|
36
|
+
cos(X, Y).
|
|
37
|
+
|
|
38
|
+
find_root([N, X, Tolerance], X) :-
|
|
39
|
+
f(N, X, FX),
|
|
40
|
+
abs(FX, AFX),
|
|
41
|
+
lt(AFX, Tolerance).
|
|
42
|
+
find_root([N, X, Tolerance], Root) :-
|
|
43
|
+
f(N, X, FX),
|
|
44
|
+
abs(FX, AFX),
|
|
45
|
+
ge(AFX, Tolerance),
|
|
46
|
+
fd(N, X, FDX),
|
|
47
|
+
div(FX, FDX, Step),
|
|
48
|
+
sub(X, Step, NewX),
|
|
49
|
+
find_root([N, NewX, Tolerance], Root).
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
% Nixon diamond: two independent defaults support incompatible conclusions.
|
|
2
|
+
% This mirrors the classic EYE reasoning theme while keeping the conclusion explicit:
|
|
3
|
+
% a subject with both defaults is reported as conflicted rather than forced to
|
|
4
|
+
% choose one extension.
|
|
5
|
+
|
|
6
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
7
|
+
materialize(defaultSupports, 2).
|
|
8
|
+
materialize(conflict, 2).
|
|
9
|
+
materialize(status, 2).
|
|
10
|
+
|
|
11
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
12
|
+
kind(nixon, quaker).
|
|
13
|
+
kind(nixon, republican).
|
|
14
|
+
|
|
15
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
16
|
+
supports_default(Person, pacifist) :-
|
|
17
|
+
kind(Person, quaker).
|
|
18
|
+
|
|
19
|
+
supports_default(Person, hawk) :-
|
|
20
|
+
kind(Person, republican).
|
|
21
|
+
|
|
22
|
+
contrary(pacifist, hawk).
|
|
23
|
+
contrary(hawk, pacifist).
|
|
24
|
+
|
|
25
|
+
conflicted(Person, A, B) :-
|
|
26
|
+
supports_default(Person, A),
|
|
27
|
+
supports_default(Person, B),
|
|
28
|
+
contrary(A, B).
|
|
29
|
+
|
|
30
|
+
defaultSupports(Person, Conclusion) :-
|
|
31
|
+
supports_default(Person, Conclusion).
|
|
32
|
+
|
|
33
|
+
conflict(Person, conflict(A, B)) :-
|
|
34
|
+
conflicted(Person, A, B).
|
|
35
|
+
|
|
36
|
+
status(Person, conflicted_default_case) :-
|
|
37
|
+
conflicted(Person, _A, _B).
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
% ODRL + DPV healthcare risk ranking adapted from Eyeling
|
|
2
|
+
% odrl-dpv-healthcare-risk-ranked.n3.
|
|
3
|
+
% The agreement policy and mitigation suggestions are formula-valued terms.
|
|
4
|
+
|
|
5
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
6
|
+
materialize(policyGraph, 2).
|
|
7
|
+
materialize(contains, 2).
|
|
8
|
+
materialize(dpv_hasRisk, 2).
|
|
9
|
+
materialize(type, 2).
|
|
10
|
+
materialize(scoreRaw, 2).
|
|
11
|
+
materialize(score, 2).
|
|
12
|
+
materialize(dpv_hasRiskLevel, 2).
|
|
13
|
+
materialize(dpv_hasSeverity, 2).
|
|
14
|
+
materialize(aboutClause, 2).
|
|
15
|
+
materialize(violatesNeed, 2).
|
|
16
|
+
materialize(dct_source, 2).
|
|
17
|
+
materialize(dct_description, 2).
|
|
18
|
+
materialize(reportKey, 2).
|
|
19
|
+
materialize(dpv_isMitigatedByMeasure, 2).
|
|
20
|
+
materialize(suggestAddGraph, 2).
|
|
21
|
+
materialize(firstRisk, 2).
|
|
22
|
+
materialize(retentionRiskScore, 2).
|
|
23
|
+
|
|
24
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
25
|
+
party(hospital).
|
|
26
|
+
party(researchUnit).
|
|
27
|
+
party(pharmaPartner).
|
|
28
|
+
party(clinicalAIService).
|
|
29
|
+
data_asset(healthRecordData).
|
|
30
|
+
data_asset(genomicData).
|
|
31
|
+
process(processContextHC1).
|
|
32
|
+
|
|
33
|
+
title(agreementHC1, "Example Healthcare & Life-Sciences Data Use Agreement").
|
|
34
|
+
title(patientExample, "Example patient profile").
|
|
35
|
+
|
|
36
|
+
has_need(patientExample, need_ConsentForResearch).
|
|
37
|
+
has_need(patientExample, need_DeIdentifyBeforeSharing).
|
|
38
|
+
has_need(patientExample, need_HumanReviewForAutomatedTriage).
|
|
39
|
+
has_need(patientExample, need_RetentionLimit3y).
|
|
40
|
+
|
|
41
|
+
importance(need_ConsentForResearch, 35).
|
|
42
|
+
importance(need_DeIdentifyBeforeSharing, 35).
|
|
43
|
+
importance(need_HumanReviewForAutomatedTriage, 25).
|
|
44
|
+
importance(need_RetentionLimit3y, 15).
|
|
45
|
+
max_retention_days(need_RetentionLimit3y, 1095).
|
|
46
|
+
|
|
47
|
+
clause_id(clauseH1, "H1").
|
|
48
|
+
clause_text(clauseH1, "Hospital may use EHR and genomic data for internal clinical research and publication.").
|
|
49
|
+
clause_id(clauseH2, "H2").
|
|
50
|
+
clause_text(clauseH2, "Hospital may share genomic data with pharmaceutical partners for drug discovery and R&D.").
|
|
51
|
+
clause_id(clauseH3, "H3").
|
|
52
|
+
clause_text(clauseH3, "Hospital may use automated triage and prioritisation systems using EHR data.").
|
|
53
|
+
clause_id(clauseH4, "H4").
|
|
54
|
+
clause_text(clauseH4, "Hospital retains patient health records for 10 years.").
|
|
55
|
+
|
|
56
|
+
agreement_policy_graph(agreementHC1, policyGraphHC1).
|
|
57
|
+
|
|
58
|
+
policy_graph(policyGraphHC1, (
|
|
59
|
+
type(policyHC1, odrl_Policy),
|
|
60
|
+
odrl_permission(policyHC1, permResearchUse),
|
|
61
|
+
odrl_permission(policyHC1, permShareWithPharma),
|
|
62
|
+
odrl_permission(policyHC1, permAutomatedTriage),
|
|
63
|
+
odrl_permission(policyHC1, permRetention10y),
|
|
64
|
+
|
|
65
|
+
type(permResearchUse, odrl_Permission),
|
|
66
|
+
odrl_assigner(permResearchUse, hospital),
|
|
67
|
+
odrl_assignee(permResearchUse, researchUnit),
|
|
68
|
+
odrl_action(permResearchUse, hl7ca_use),
|
|
69
|
+
odrl_target(permResearchUse, healthRecordData),
|
|
70
|
+
odrl_target(permResearchUse, genomicData),
|
|
71
|
+
odrl_constraint(permResearchUse, cResearchPurpose),
|
|
72
|
+
odrl_leftOperand(cResearchPurpose, odrl_purpose),
|
|
73
|
+
odrl_rightOperandReference(cResearchPurpose, purposeHMB),
|
|
74
|
+
clause(permResearchUse, clauseH1),
|
|
75
|
+
|
|
76
|
+
type(permShareWithPharma, odrl_Permission),
|
|
77
|
+
odrl_assigner(permShareWithPharma, hospital),
|
|
78
|
+
odrl_assignee(permShareWithPharma, pharmaPartner),
|
|
79
|
+
odrl_action(permShareWithPharma, hl7ca_disclose),
|
|
80
|
+
odrl_target(permShareWithPharma, genomicData),
|
|
81
|
+
odrl_constraint(permShareWithPharma, cSharePurpose),
|
|
82
|
+
odrl_leftOperand(cSharePurpose, odrl_purpose),
|
|
83
|
+
odrl_rightOperandReference(cSharePurpose, purposeHMB),
|
|
84
|
+
clause(permShareWithPharma, clauseH2),
|
|
85
|
+
|
|
86
|
+
type(permAutomatedTriage, odrl_Permission),
|
|
87
|
+
odrl_assigner(permAutomatedTriage, hospital),
|
|
88
|
+
odrl_assignee(permAutomatedTriage, clinicalAIService),
|
|
89
|
+
odrl_action(permAutomatedTriage, hl7ca_use),
|
|
90
|
+
odrl_target(permAutomatedTriage, healthRecordData),
|
|
91
|
+
odrl_constraint(permAutomatedTriage, cTriagePurpose),
|
|
92
|
+
odrl_leftOperand(cTriagePurpose, odrl_purpose),
|
|
93
|
+
odrl_rightOperandReference(cTriagePurpose, purposeCC),
|
|
94
|
+
odrl_duty(permAutomatedTriage, dutyHumanReview),
|
|
95
|
+
odrl_action(dutyHumanReview, humanReview),
|
|
96
|
+
odrl_constraint(dutyHumanReview, cTriageEncryption),
|
|
97
|
+
odrl_leftOperand(cTriageEncryption, encryptionAtRest),
|
|
98
|
+
odrl_rightOperand(cTriageEncryption, true),
|
|
99
|
+
clause(permAutomatedTriage, clauseH3),
|
|
100
|
+
|
|
101
|
+
type(permRetention10y, odrl_Permission),
|
|
102
|
+
odrl_assigner(permRetention10y, hospital),
|
|
103
|
+
odrl_assignee(permRetention10y, hospital),
|
|
104
|
+
odrl_action(permRetention10y, hl7ca_collect),
|
|
105
|
+
odrl_target(permRetention10y, healthRecordData),
|
|
106
|
+
odrl_constraint(permRetention10y, cRetentionPurpose),
|
|
107
|
+
odrl_leftOperand(cRetentionPurpose, odrl_purpose),
|
|
108
|
+
odrl_rightOperandReference(cRetentionPurpose, purposeCC),
|
|
109
|
+
odrl_constraint(permRetention10y, cRetentionDays),
|
|
110
|
+
odrl_leftOperand(cRetentionDays, retentionDays),
|
|
111
|
+
odrl_rightOperand(cRetentionDays, 3650),
|
|
112
|
+
clause(permRetention10y, clauseH4)
|
|
113
|
+
)).
|
|
114
|
+
|
|
115
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
116
|
+
policy_statement(GraphName, Subject, Predicate, Object) :-
|
|
117
|
+
policy_graph(GraphName, Formula),
|
|
118
|
+
formula_binary(Formula, Subject, Predicate, Object).
|
|
119
|
+
|
|
120
|
+
permission(Graph, Permission) :- policy_statement(Graph, policyHC1, odrl_permission, Permission).
|
|
121
|
+
clause(Graph, Permission, Clause) :- policy_statement(Graph, Permission, clause, Clause).
|
|
122
|
+
action(Graph, Permission, Action) :- policy_statement(Graph, Permission, odrl_action, Action).
|
|
123
|
+
target(Graph, Permission, Target) :- policy_statement(Graph, Permission, odrl_target, Target).
|
|
124
|
+
duty(Graph, Permission, Duty) :- policy_statement(Graph, Permission, odrl_duty, Duty).
|
|
125
|
+
duty_action(Graph, Duty, Action) :- policy_statement(Graph, Duty, odrl_action, Action).
|
|
126
|
+
constraint(Graph, Permission, Constraint) :- policy_statement(Graph, Permission, odrl_constraint, Constraint).
|
|
127
|
+
constraint_left(Graph, Constraint, Left) :- policy_statement(Graph, Constraint, odrl_leftOperand, Left).
|
|
128
|
+
constraint_right(Graph, Constraint, Right) :- policy_statement(Graph, Constraint, odrl_rightOperand, Right).
|
|
129
|
+
|
|
130
|
+
has_constraint(Graph, Permission, Left, Right) :-
|
|
131
|
+
constraint(Graph, Permission, Constraint),
|
|
132
|
+
constraint_left(Graph, Constraint, Left),
|
|
133
|
+
constraint_right(Graph, Constraint, Right).
|
|
134
|
+
|
|
135
|
+
has_duty_action(Graph, Permission, Action) :-
|
|
136
|
+
duty(Graph, Permission, Duty),
|
|
137
|
+
duty_action(Graph, Duty, Action).
|
|
138
|
+
|
|
139
|
+
missing_explicit_consent(Graph, Permission) :-
|
|
140
|
+
permission(Graph, Permission),
|
|
141
|
+
not(has_constraint(Graph, Permission, explicitConsent, true)).
|
|
142
|
+
|
|
143
|
+
missing_deidentified(Graph, Permission) :-
|
|
144
|
+
permission(Graph, Permission),
|
|
145
|
+
not(has_constraint(Graph, Permission, deIdentified, true)).
|
|
146
|
+
|
|
147
|
+
missing_human_review(Graph, Permission) :-
|
|
148
|
+
permission(Graph, Permission),
|
|
149
|
+
not(has_duty_action(Graph, Permission, humanReview)).
|
|
150
|
+
|
|
151
|
+
retention_days(Graph, Permission, Days) :-
|
|
152
|
+
has_constraint(Graph, Permission, retentionDays, Days).
|
|
153
|
+
|
|
154
|
+
risk(riskH1) :-
|
|
155
|
+
agreement_policy_graph(agreementHC1, Graph),
|
|
156
|
+
has_need(patientExample, need_ConsentForResearch),
|
|
157
|
+
permission(Graph, permResearchUse),
|
|
158
|
+
clause(Graph, permResearchUse, clauseH1),
|
|
159
|
+
missing_explicit_consent(Graph, permResearchUse).
|
|
160
|
+
|
|
161
|
+
risk(riskH2) :-
|
|
162
|
+
agreement_policy_graph(agreementHC1, Graph),
|
|
163
|
+
has_need(patientExample, need_DeIdentifyBeforeSharing),
|
|
164
|
+
permission(Graph, permShareWithPharma),
|
|
165
|
+
target(Graph, permShareWithPharma, genomicData),
|
|
166
|
+
clause(Graph, permShareWithPharma, clauseH2),
|
|
167
|
+
missing_deidentified(Graph, permShareWithPharma).
|
|
168
|
+
|
|
169
|
+
risk(riskH3) :-
|
|
170
|
+
agreement_policy_graph(agreementHC1, Graph),
|
|
171
|
+
has_need(patientExample, need_HumanReviewForAutomatedTriage),
|
|
172
|
+
permission(Graph, permAutomatedTriage),
|
|
173
|
+
clause(Graph, permAutomatedTriage, clauseH3),
|
|
174
|
+
missing_human_review(Graph, permAutomatedTriage).
|
|
175
|
+
|
|
176
|
+
risk(riskH4) :-
|
|
177
|
+
agreement_policy_graph(agreementHC1, Graph),
|
|
178
|
+
has_need(patientExample, need_RetentionLimit3y),
|
|
179
|
+
max_retention_days(need_RetentionLimit3y, Max),
|
|
180
|
+
permission(Graph, permRetention10y),
|
|
181
|
+
clause(Graph, permRetention10y, clauseH4),
|
|
182
|
+
retention_days(Graph, permRetention10y, Days),
|
|
183
|
+
gt(Days, Max).
|
|
184
|
+
|
|
185
|
+
base_score(riskH1, 85).
|
|
186
|
+
base_score(riskH2, 90).
|
|
187
|
+
base_score(riskH3, 80).
|
|
188
|
+
base_score(riskH4, 55).
|
|
189
|
+
violates_need(riskH1, need_ConsentForResearch).
|
|
190
|
+
violates_need(riskH2, need_DeIdentifyBeforeSharing).
|
|
191
|
+
violates_need(riskH3, need_HumanReviewForAutomatedTriage).
|
|
192
|
+
violates_need(riskH4, need_RetentionLimit3y).
|
|
193
|
+
about_clause(riskH1, clauseH1).
|
|
194
|
+
about_clause(riskH2, clauseH2).
|
|
195
|
+
about_clause(riskH3, clauseH3).
|
|
196
|
+
about_clause(riskH4, clauseH4).
|
|
197
|
+
risk_source_of(riskH1, permResearchUse).
|
|
198
|
+
risk_source_of(riskH2, permShareWithPharma).
|
|
199
|
+
risk_source_of(riskH3, permAutomatedTriage).
|
|
200
|
+
risk_source_of(riskH4, permRetention10y).
|
|
201
|
+
|
|
202
|
+
description(riskH1, "Risk: health/genomic data may be used for research without explicit opt-in consent.").
|
|
203
|
+
description(riskH2, "Risk: genomic data may be shared with external pharma partners without a de-identification/pseudonymisation requirement.").
|
|
204
|
+
description(riskH3, "Risk: automated triage may affect care pathways without a human review/override safeguard.").
|
|
205
|
+
description(riskH4, "Risk: retention (3650 days) exceeds patient preference (1095 days).").
|
|
206
|
+
|
|
207
|
+
mitigation_graph(riskH1, mitigateConsent, (
|
|
208
|
+
odrl_constraint(permResearchUse, cExplicitConsent),
|
|
209
|
+
odrl_leftOperand(cExplicitConsent, explicitConsent),
|
|
210
|
+
odrl_rightOperand(cExplicitConsent, true)
|
|
211
|
+
)).
|
|
212
|
+
mitigation_graph(riskH2, mitigateDeId, (
|
|
213
|
+
odrl_constraint(permShareWithPharma, cDeIdentified),
|
|
214
|
+
odrl_leftOperand(cDeIdentified, deIdentified),
|
|
215
|
+
odrl_rightOperand(cDeIdentified, true),
|
|
216
|
+
odrl_duty(permShareWithPharma, dutyDeIdentify),
|
|
217
|
+
odrl_action(dutyDeIdentify, deIdentify)
|
|
218
|
+
)).
|
|
219
|
+
mitigation_graph(riskH3, mitigateHumanReview, (
|
|
220
|
+
odrl_duty(permAutomatedTriage, dutyHumanReview),
|
|
221
|
+
odrl_action(dutyHumanReview, humanReview)
|
|
222
|
+
)).
|
|
223
|
+
mitigation_graph(riskH4, mitigateRetention, (
|
|
224
|
+
odrl_constraint(permRetention10y, cRetentionLimit),
|
|
225
|
+
odrl_leftOperand(cRetentionLimit, retentionDays),
|
|
226
|
+
odrl_rightOperand(cRetentionLimit, 1095)
|
|
227
|
+
)).
|
|
228
|
+
|
|
229
|
+
score_raw(Risk, Raw) :-
|
|
230
|
+
risk(Risk),
|
|
231
|
+
base_score(Risk, Base),
|
|
232
|
+
violates_need(Risk, Need),
|
|
233
|
+
importance(Need, Weight),
|
|
234
|
+
add(Base, Weight, Raw).
|
|
235
|
+
|
|
236
|
+
score(Risk, 100) :- score_raw(Risk, Raw), gt(Raw, 100).
|
|
237
|
+
score(Risk, Raw) :- score_raw(Risk, Raw), ge(100, Raw).
|
|
238
|
+
|
|
239
|
+
severity(Risk, risk_HighSeverity) :- score(Risk, Score), gt(Score, 79).
|
|
240
|
+
severity(Risk, risk_ModerateSeverity) :- score(Risk, Score), lt(Score, 80), gt(Score, 49).
|
|
241
|
+
risk_level(Risk, risk_HighRisk) :- score(Risk, Score), gt(Score, 79).
|
|
242
|
+
risk_level(Risk, risk_ModerateRisk) :- score(Risk, Score), lt(Score, 80), gt(Score, 49).
|
|
243
|
+
|
|
244
|
+
report_key(Risk, Key) :- score(Risk, Score), sub(1000, Score, Key).
|
|
245
|
+
|
|
246
|
+
policyGraph(agreementHC1, GraphTerm) :-
|
|
247
|
+
agreement_policy_graph(agreementHC1, Graph),
|
|
248
|
+
policy_graph(Graph, GraphTerm).
|
|
249
|
+
|
|
250
|
+
contains(policyGraphHC1, statement(Subject, Predicate, Object)) :-
|
|
251
|
+
policy_statement(policyGraphHC1, Subject, Predicate, Object).
|
|
252
|
+
|
|
253
|
+
dpv_hasRisk(processContextHC1, Risk) :- risk(Risk).
|
|
254
|
+
type(Risk, dpv_Risk) :- risk(Risk).
|
|
255
|
+
scoreRaw(Risk, Raw) :- score_raw(Risk, Raw).
|
|
256
|
+
dpv_hasRiskLevel(Risk, Level) :- risk_level(Risk, Level).
|
|
257
|
+
dpv_hasSeverity(Risk, Severity) :- severity(Risk, Severity).
|
|
258
|
+
aboutClause(Risk, Clause) :- risk(Risk), about_clause(Risk, Clause).
|
|
259
|
+
violatesNeed(Risk, Need) :- risk(Risk), violates_need(Risk, Need).
|
|
260
|
+
dct_source(Risk, Source) :- risk(Risk), risk_source_of(Risk, Source).
|
|
261
|
+
dct_description(Risk, Description) :- risk(Risk), description(Risk, Description).
|
|
262
|
+
reportKey(Risk, Key) :- report_key(Risk, Key).
|
|
263
|
+
dpv_isMitigatedByMeasure(Risk, Mitigation) :- risk(Risk), mitigation_graph(Risk, Mitigation, _Graph).
|
|
264
|
+
suggestAddGraph(Mitigation, Graph) :- mitigation_graph(Risk, Mitigation, Graph), risk(Risk).
|
|
265
|
+
firstRisk(report, riskH1) :- score(riskH1, 100), score(riskH2, 100).
|
|
266
|
+
retentionRiskScore(report, Score) :- score(riskH4, Score).
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
% ODRL + DPV ranked-risk assessment adapted from Eyeling odrl-dpv-risk-ranked.n3.
|
|
2
|
+
% Eyeling keeps the ODRL rules inside an N3 quoted policy formula and prints a
|
|
3
|
+
% Markdown report. This eyelang translation also keeps the
|
|
4
|
+
% policy as a formula-valued term, projects local predicates from that formula for
|
|
5
|
+
% reasoning, and materializes the derived DPV risks as relation output.
|
|
6
|
+
|
|
7
|
+
% Consumer profile and needs.
|
|
8
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
9
|
+
materialize(dct_title, 2).
|
|
10
|
+
materialize(dpv_hasRisk, 2).
|
|
11
|
+
materialize(type, 2).
|
|
12
|
+
materialize(policyGraph, 2).
|
|
13
|
+
materialize(contains, 2).
|
|
14
|
+
materialize(source, 2).
|
|
15
|
+
materialize(profile, 2).
|
|
16
|
+
materialize(firstRisk, 2).
|
|
17
|
+
materialize(before, 2).
|
|
18
|
+
materialize(dct_source, 2).
|
|
19
|
+
materialize(risk_hasRiskSource, 2).
|
|
20
|
+
materialize(dpv_hasConsequence, 2).
|
|
21
|
+
materialize(dpv_hasImpact, 2).
|
|
22
|
+
materialize(aboutClause, 2).
|
|
23
|
+
materialize(violatesNeed, 2).
|
|
24
|
+
materialize(scoreRaw, 2).
|
|
25
|
+
materialize(score, 2).
|
|
26
|
+
materialize(dpv_hasSeverity, 2).
|
|
27
|
+
materialize(dpv_hasRiskLevel, 2).
|
|
28
|
+
materialize(dct_description, 2).
|
|
29
|
+
materialize(reportKey, 2).
|
|
30
|
+
materialize(dpv_isMitigatedByMeasure, 2).
|
|
31
|
+
materialize(dpv_mitigatesRisk, 2).
|
|
32
|
+
materialize(clauseId, 2).
|
|
33
|
+
materialize(text, 2).
|
|
34
|
+
|
|
35
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
36
|
+
consumer(consumerExample).
|
|
37
|
+
title(consumerExample, "Example consumer profile").
|
|
38
|
+
has_need(consumerExample, need_DataCannotBeRemoved).
|
|
39
|
+
has_need(consumerExample, need_ChangeOnlyWithPriorNotice).
|
|
40
|
+
has_need(consumerExample, need_NoSharingWithoutConsent).
|
|
41
|
+
has_need(consumerExample, need_DataPortability).
|
|
42
|
+
|
|
43
|
+
importance(need_DataCannotBeRemoved, 20).
|
|
44
|
+
description(need_DataCannotBeRemoved, "Provider must not remove the consumer account/data.").
|
|
45
|
+
importance(need_ChangeOnlyWithPriorNotice, 15).
|
|
46
|
+
min_notice_days(need_ChangeOnlyWithPriorNotice, 14).
|
|
47
|
+
description(need_ChangeOnlyWithPriorNotice, "Agreement may change only with prior notice (>= 14 days).").
|
|
48
|
+
importance(need_NoSharingWithoutConsent, 12).
|
|
49
|
+
description(need_NoSharingWithoutConsent, "No data sharing without explicit consent.").
|
|
50
|
+
importance(need_DataPortability, 10).
|
|
51
|
+
description(need_DataPortability, "Consumer must be able to export their data.").
|
|
52
|
+
|
|
53
|
+
% Agreement and ODRL-style policy structure.
|
|
54
|
+
agreement(agreement1).
|
|
55
|
+
title(agreement1, "Example Agreement").
|
|
56
|
+
process_context(processContext1, agreement1).
|
|
57
|
+
title(processContext1, "Service operation under Agreement1").
|
|
58
|
+
|
|
59
|
+
% The ODRL policy is kept as a graph value. The clauses below are not asserted
|
|
60
|
+
% globally as permission/2, prohibition/2, action/2, ... facts; they are
|
|
61
|
+
% binary terms inside policyGraph1. The local projection predicates below read from the
|
|
62
|
+
% formula when evaluating this agreement. This mirrors N3 quoted formulae and avoids
|
|
63
|
+
% making policy statements true outside the formula that contains them.
|
|
64
|
+
policy_graph(policyGraph1, (
|
|
65
|
+
type(policy1, odrl_Policy),
|
|
66
|
+
odrl_appliesTo(policy1, agreement1),
|
|
67
|
+
odrl_permission(policy1, permDeleteAccount),
|
|
68
|
+
odrl_permission(policy1, permChangeTerms),
|
|
69
|
+
odrl_permission(policy1, permShareData),
|
|
70
|
+
odrl_prohibition(policy1, prohibitExportData),
|
|
71
|
+
|
|
72
|
+
odrl_assigner(permDeleteAccount, provider),
|
|
73
|
+
odrl_assignee(permDeleteAccount, consumerExample),
|
|
74
|
+
odrl_action(permDeleteAccount, tosl_removeAccount),
|
|
75
|
+
odrl_target(permDeleteAccount, userAccount),
|
|
76
|
+
clause(permDeleteAccount, clauseC1),
|
|
77
|
+
|
|
78
|
+
odrl_assigner(permChangeTerms, provider),
|
|
79
|
+
odrl_assignee(permChangeTerms, consumerExample),
|
|
80
|
+
odrl_action(permChangeTerms, tosl_changeTerms),
|
|
81
|
+
odrl_target(permChangeTerms, agreementText),
|
|
82
|
+
clause(permChangeTerms, clauseC2),
|
|
83
|
+
odrl_duty(permChangeTerms, odrl_inform),
|
|
84
|
+
noticeDays(permChangeTerms, 3),
|
|
85
|
+
|
|
86
|
+
odrl_assigner(permShareData, provider),
|
|
87
|
+
odrl_assignee(permShareData, consumerExample),
|
|
88
|
+
odrl_action(permShareData, tosl_shareData),
|
|
89
|
+
odrl_target(permShareData, userData),
|
|
90
|
+
clause(permShareData, clauseC3),
|
|
91
|
+
|
|
92
|
+
odrl_assigner(prohibitExportData, provider),
|
|
93
|
+
odrl_assignee(prohibitExportData, consumerExample),
|
|
94
|
+
odrl_action(prohibitExportData, tosl_exportData),
|
|
95
|
+
odrl_target(prohibitExportData, userData),
|
|
96
|
+
clause(prohibitExportData, clauseC4)
|
|
97
|
+
)).
|
|
98
|
+
|
|
99
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
100
|
+
policy_statement(Subject, Predicate, Object) :-
|
|
101
|
+
policy_graph(_Graph, Formula),
|
|
102
|
+
formula_binary(Formula, Subject, Predicate, Object).
|
|
103
|
+
|
|
104
|
+
policy(Policy, Agreement) :- policy_statement(Policy, odrl_appliesTo, Agreement).
|
|
105
|
+
permission(Policy, Rule) :- policy_statement(Policy, odrl_permission, Rule).
|
|
106
|
+
prohibition(Policy, Rule) :- policy_statement(Policy, odrl_prohibition, Rule).
|
|
107
|
+
assigner(Rule, Party) :- policy_statement(Rule, odrl_assigner, Party).
|
|
108
|
+
assignee(Rule, Party) :- policy_statement(Rule, odrl_assignee, Party).
|
|
109
|
+
action(Rule, Action) :- policy_statement(Rule, odrl_action, Action).
|
|
110
|
+
target(Rule, Target) :- policy_statement(Rule, odrl_target, Target).
|
|
111
|
+
clause(Rule, Clause) :- policy_statement(Rule, clause, Clause).
|
|
112
|
+
duty(Rule, Duty) :- policy_statement(Rule, odrl_duty, Duty).
|
|
113
|
+
notice_days(Rule, Days) :- policy_statement(Rule, noticeDays, Days).
|
|
114
|
+
consent_constraint(Rule, Value) :- policy_statement(Rule, consentConstraint, Value).
|
|
115
|
+
|
|
116
|
+
clause_id(clauseC1, "C1").
|
|
117
|
+
clause_text(clauseC1, "Provider may remove the user account (and associated data) at its discretion.").
|
|
118
|
+
clause_id(clauseC2, "C2").
|
|
119
|
+
clause_text(clauseC2, "Provider may change terms by informing users at least 3 days in advance.").
|
|
120
|
+
clause_id(clauseC3, "C3").
|
|
121
|
+
clause_text(clauseC3, "Provider may share user data with partners for business purposes.").
|
|
122
|
+
clause_id(clauseC4, "C4").
|
|
123
|
+
clause_text(clauseC4, "Users are not permitted to export their data.").
|
|
124
|
+
|
|
125
|
+
% Missing-safeguard checks corresponding to the log_notIncludes tests in N3.
|
|
126
|
+
missing_notice_constraint(Perm) :-
|
|
127
|
+
permission(policy1, Perm),
|
|
128
|
+
not(notice_days(Perm, _Days)).
|
|
129
|
+
|
|
130
|
+
missing_inform_duty(Perm) :-
|
|
131
|
+
permission(policy1, Perm),
|
|
132
|
+
not(duty(Perm, odrl_inform)).
|
|
133
|
+
|
|
134
|
+
missing_consent_constraint(Perm) :-
|
|
135
|
+
permission(policy1, Perm),
|
|
136
|
+
action(Perm, tosl_shareData),
|
|
137
|
+
not(consent_constraint(Perm, true)).
|
|
138
|
+
|
|
139
|
+
% ODRL -> DPV risk derivation.
|
|
140
|
+
risk(risk1) :-
|
|
141
|
+
has_need(consumerExample, need_DataCannotBeRemoved),
|
|
142
|
+
permission(policy1, permDeleteAccount),
|
|
143
|
+
action(permDeleteAccount, tosl_removeAccount),
|
|
144
|
+
missing_notice_constraint(permDeleteAccount),
|
|
145
|
+
missing_inform_duty(permDeleteAccount).
|
|
146
|
+
|
|
147
|
+
risk_source(risk1, src1).
|
|
148
|
+
risk_class(risk1, risk_UnwantedDataDeletion).
|
|
149
|
+
risk_class(risk1, risk_DataUnavailable).
|
|
150
|
+
risk_class(risk1, risk_DataErasureError).
|
|
151
|
+
risk_class(risk1, risk_DataLoss).
|
|
152
|
+
risk_source_class(src1, risk_LegalComplianceRisk).
|
|
153
|
+
risk_source_of(src1, permDeleteAccount).
|
|
154
|
+
risk_consequence(risk1, risk_DataLoss).
|
|
155
|
+
risk_consequence(risk1, risk_DataUnavailable).
|
|
156
|
+
risk_consequence(risk1, risk_CustomerConfidenceLoss).
|
|
157
|
+
risk_impact(risk1, risk_FinancialLoss).
|
|
158
|
+
risk_impact(risk1, risk_NonMaterialDamage).
|
|
159
|
+
about_clause(risk1, clauseC1).
|
|
160
|
+
violates_need(risk1, need_DataCannotBeRemoved).
|
|
161
|
+
risk_description(risk1, "Risk: account/data removal is permitted without notice safeguards (no notice constraint and no duty to inform). Clause C1: Provider may remove the user account (and associated data) at its discretion.").
|
|
162
|
+
base_score(risk1, 90).
|
|
163
|
+
mitigation(risk1, m11, "Add a notice constraint (minimum noticeDays) before account removal.").
|
|
164
|
+
mitigation(risk1, m21, "Add a duty to inform the consumer prior to account removal.").
|
|
165
|
+
|
|
166
|
+
risk(risk2) :-
|
|
167
|
+
has_need(consumerExample, need_ChangeOnlyWithPriorNotice),
|
|
168
|
+
min_notice_days(need_ChangeOnlyWithPriorNotice, Required),
|
|
169
|
+
permission(policy1, permChangeTerms),
|
|
170
|
+
action(permChangeTerms, tosl_changeTerms),
|
|
171
|
+
duty(permChangeTerms, odrl_inform),
|
|
172
|
+
notice_days(permChangeTerms, Days),
|
|
173
|
+
lt(Days, Required).
|
|
174
|
+
|
|
175
|
+
risk_source(risk2, src2).
|
|
176
|
+
risk_class(risk2, risk_PolicyRisk).
|
|
177
|
+
risk_class(risk2, risk_CustomerConfidenceLoss).
|
|
178
|
+
risk_source_class(src2, risk_PolicyRisk).
|
|
179
|
+
risk_source_of(src2, permChangeTerms).
|
|
180
|
+
risk_consequence(risk2, risk_CustomerConfidenceLoss).
|
|
181
|
+
risk_impact(risk2, risk_NonMaterialDamage).
|
|
182
|
+
about_clause(risk2, clauseC2).
|
|
183
|
+
violates_need(risk2, need_ChangeOnlyWithPriorNotice).
|
|
184
|
+
risk_description(risk2, "Risk: terms may change with notice (3 days) below consumer requirement (14 days). Clause C2: Provider may change terms by informing users at least 3 days in advance.").
|
|
185
|
+
base_score(risk2, 70).
|
|
186
|
+
mitigation(risk2, m12, "Increase minimum noticeDays in the inform duty to meet the consumer requirement.").
|
|
187
|
+
|
|
188
|
+
risk(risk3) :-
|
|
189
|
+
has_need(consumerExample, need_NoSharingWithoutConsent),
|
|
190
|
+
permission(policy1, permShareData),
|
|
191
|
+
action(permShareData, tosl_shareData),
|
|
192
|
+
missing_consent_constraint(permShareData).
|
|
193
|
+
|
|
194
|
+
risk_source(risk3, src3).
|
|
195
|
+
risk_class(risk3, risk_UnwantedDisclosureData).
|
|
196
|
+
risk_class(risk3, risk_CustomerConfidenceLoss).
|
|
197
|
+
risk_source_class(src3, risk_PolicyRisk).
|
|
198
|
+
risk_source_of(src3, permShareData).
|
|
199
|
+
risk_consequence(risk3, risk_CustomerConfidenceLoss).
|
|
200
|
+
risk_impact(risk3, risk_NonMaterialDamage).
|
|
201
|
+
risk_impact(risk3, risk_FinancialLoss).
|
|
202
|
+
about_clause(risk3, clauseC3).
|
|
203
|
+
violates_need(risk3, need_NoSharingWithoutConsent).
|
|
204
|
+
risk_description(risk3, "Risk: user data sharing is permitted without an explicit consent constraint. Clause C3: Provider may share user data with partners for business purposes.").
|
|
205
|
+
base_score(risk3, 85).
|
|
206
|
+
mitigation(risk3, m13, "Add an explicit consent constraint before data sharing.").
|
|
207
|
+
|
|
208
|
+
risk(risk4) :-
|
|
209
|
+
has_need(consumerExample, need_DataPortability),
|
|
210
|
+
prohibition(policy1, prohibitExportData),
|
|
211
|
+
action(prohibitExportData, tosl_exportData).
|
|
212
|
+
|
|
213
|
+
risk_source(risk4, src4).
|
|
214
|
+
risk_class(risk4, risk_PolicyRisk).
|
|
215
|
+
risk_class(risk4, risk_CustomerConfidenceLoss).
|
|
216
|
+
risk_source_class(src4, risk_PolicyRisk).
|
|
217
|
+
risk_source_of(src4, prohibitExportData).
|
|
218
|
+
risk_consequence(risk4, risk_CustomerConfidenceLoss).
|
|
219
|
+
risk_impact(risk4, risk_NonMaterialDamage).
|
|
220
|
+
about_clause(risk4, clauseC4).
|
|
221
|
+
violates_need(risk4, need_DataPortability).
|
|
222
|
+
risk_description(risk4, "Risk: portability is restricted because exporting user data is prohibited. Clause C4: Users are not permitted to export their data.").
|
|
223
|
+
base_score(risk4, 60).
|
|
224
|
+
mitigation(risk4, m14, "Add a permission allowing data export (or remove the prohibition) to support portability.").
|
|
225
|
+
|
|
226
|
+
score_raw(Risk, Raw) :-
|
|
227
|
+
risk(Risk),
|
|
228
|
+
base_score(Risk, Base),
|
|
229
|
+
violates_need(Risk, Need),
|
|
230
|
+
importance(Need, Weight),
|
|
231
|
+
add(Base, Weight, Raw).
|
|
232
|
+
|
|
233
|
+
score(Risk, 100) :-
|
|
234
|
+
score_raw(Risk, Raw),
|
|
235
|
+
gt(Raw, 100).
|
|
236
|
+
|
|
237
|
+
score(Risk, Raw) :-
|
|
238
|
+
score_raw(Risk, Raw),
|
|
239
|
+
ge(100, Raw).
|
|
240
|
+
|
|
241
|
+
severity(Risk, risk_HighSeverity) :-
|
|
242
|
+
score(Risk, Score),
|
|
243
|
+
gt(Score, 79).
|
|
244
|
+
|
|
245
|
+
risk_level(Risk, risk_HighRisk) :-
|
|
246
|
+
score(Risk, Score),
|
|
247
|
+
gt(Score, 79).
|
|
248
|
+
|
|
249
|
+
severity(Risk, risk_ModerateSeverity) :-
|
|
250
|
+
score(Risk, Score),
|
|
251
|
+
lt(Score, 80),
|
|
252
|
+
gt(Score, 49).
|
|
253
|
+
|
|
254
|
+
risk_level(Risk, risk_ModerateRisk) :-
|
|
255
|
+
score(Risk, Score),
|
|
256
|
+
lt(Score, 80),
|
|
257
|
+
gt(Score, 49).
|
|
258
|
+
|
|
259
|
+
severity(Risk, risk_LowSeverity) :-
|
|
260
|
+
score(Risk, Score),
|
|
261
|
+
lt(Score, 50).
|
|
262
|
+
|
|
263
|
+
risk_level(Risk, risk_LowRisk) :-
|
|
264
|
+
score(Risk, Score),
|
|
265
|
+
lt(Score, 50).
|
|
266
|
+
|
|
267
|
+
report_key(Risk, key(InvScore, ClauseId)) :-
|
|
268
|
+
risk(Risk),
|
|
269
|
+
score(Risk, Score),
|
|
270
|
+
sub(1000, Score, InvScore),
|
|
271
|
+
about_clause(Risk, Clause),
|
|
272
|
+
clause_id(Clause, ClauseId).
|
|
273
|
+
|
|
274
|
+
ranked_before(Left, Right) :-
|
|
275
|
+
report_key(Left, key(LeftInv, _LeftClause)),
|
|
276
|
+
report_key(Right, key(RightInv, _RightClause)),
|
|
277
|
+
lt(LeftInv, RightInv).
|
|
278
|
+
|
|
279
|
+
ranked_before(Left, Right) :-
|
|
280
|
+
report_key(Left, key(Inv, LeftClause)),
|
|
281
|
+
report_key(Right, key(Inv, RightClause)),
|
|
282
|
+
not_matches(LeftClause, RightClause),
|
|
283
|
+
lt(LeftClause, RightClause).
|
|
284
|
+
|
|
285
|
+
% Output layer.
|
|
286
|
+
dct_title(agreement1, Title) :- title(agreement1, Title).
|
|
287
|
+
dct_title(consumerExample, Title) :- title(consumerExample, Title).
|
|
288
|
+
dct_title(processContext1, Title) :- title(processContext1, Title).
|
|
289
|
+
dpv_hasRisk(processContext1, Risk) :- risk(Risk).
|
|
290
|
+
type(policyGraph1, policyGraph).
|
|
291
|
+
policyGraph(agreement1, policyGraph1).
|
|
292
|
+
contains(policyGraph1, statement(Subject, Predicate, Object)) :-
|
|
293
|
+
policy_statement(Subject, Predicate, Object).
|
|
294
|
+
source(report, agreement1).
|
|
295
|
+
profile(report, consumerExample).
|
|
296
|
+
firstRisk(report, Risk) :- risk(Risk), not(ranked_before(_Other, Risk)).
|
|
297
|
+
before(riskRanking, pair(Left, Right)) :- ranked_before(Left, Right).
|
|
298
|
+
|
|
299
|
+
type(Risk, dpv_Risk) :- risk(Risk).
|
|
300
|
+
type(Risk, Class) :- risk(Risk), risk_class(Risk, Class).
|
|
301
|
+
dct_source(Risk, Source) :- risk(Risk), risk_source(Risk, Src), risk_source_of(Src, Source).
|
|
302
|
+
risk_hasRiskSource(Risk, Src) :- risk(Risk), risk_source(Risk, Src).
|
|
303
|
+
type(Src, risk_RiskSource) :- risk_source(_Risk, Src).
|
|
304
|
+
type(Src, Class) :- risk_source_class(Src, Class).
|
|
305
|
+
dct_source(Src, Source) :- risk_source_of(Src, Source).
|
|
306
|
+
dpv_hasConsequence(Risk, Consequence) :- risk(Risk), risk_consequence(Risk, Consequence).
|
|
307
|
+
dpv_hasImpact(Risk, Impact) :- risk(Risk), risk_impact(Risk, Impact).
|
|
308
|
+
aboutClause(Risk, Clause) :- risk(Risk), about_clause(Risk, Clause).
|
|
309
|
+
violatesNeed(Risk, Need) :- risk(Risk), violates_need(Risk, Need).
|
|
310
|
+
scoreRaw(Risk, Raw) :- score_raw(Risk, Raw).
|
|
311
|
+
dpv_hasSeverity(Risk, Severity) :- severity(Risk, Severity).
|
|
312
|
+
dpv_hasRiskLevel(Risk, Level) :- risk_level(Risk, Level).
|
|
313
|
+
dct_description(Risk, Text) :- risk(Risk), risk_description(Risk, Text).
|
|
314
|
+
reportKey(Risk, Key) :- report_key(Risk, Key).
|
|
315
|
+
dpv_isMitigatedByMeasure(Risk, Measure) :- mitigation(Risk, Measure, _Text).
|
|
316
|
+
type(Measure, dpv_RiskMitigationMeasure) :- mitigation(_Risk, Measure, _Text).
|
|
317
|
+
dpv_mitigatesRisk(Measure, Risk) :- mitigation(Risk, Measure, _Text).
|
|
318
|
+
dct_description(Measure, Text) :- mitigation(_Risk, Measure, Text).
|
|
319
|
+
clauseId(Clause, Id) :- clause_id(Clause, Id).
|
|
320
|
+
text(Clause, Text) :- clause_text(Clause, Text).
|