eyemind 0.8.49 → 0.8.51
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/LE-SPEC.md +0 -1
- package/LS-SPEC.md +1 -1
- package/README.md +3 -2
- package/package.json +1 -1
- package/src/shacl.js +21 -2
- package/src/version.js +1 -1
package/LE-SPEC.md
CHANGED
|
@@ -331,7 +331,6 @@ These programs use the grammar above without additional syntax:
|
|
|
331
331
|
| [Symbolic differentiation](https://eyereasoner.github.io/eyemind/examples/deck/symbolic-derivative-le) | Structural recursion over expression trees, constructed derivatives and evaluation at separate points. |
|
|
332
332
|
| [British citizenship](https://eyereasoner.github.io/eyemind/examples/deck/british-citizenship-le) | Section 1 of the British Nationality Act 1981: alternative premises, a presumption that holds unless the contrary is shown, date comparisons and citizenship through a derived parent. |
|
|
333
333
|
| [Library fines](https://eyereasoner.github.io/eyemind/examples/deck/library-fines-le) | Charges from alternative rules, then the sum, number and maximum per member over distinct combinations. |
|
|
334
|
-
| [The zeta function](https://eyereasoner.github.io/eyemind/examples/deck/zeta-le) | Exact Bernoulli numbers with `pow`, `floordiv`, `gcd` and `lcm`; zeta at the negative and even integers; Borwein's series with `exp`, `log`, `cos` and `sin` checking zeros on the critical line. |
|
|
335
334
|
| [Election tally](https://eyereasoner.github.io/eyemind/examples/deck/election-tally-le) | Eligibility by alternatives, distinct choices, an absence test inside a count, winners by maximum with ties, and a quorum. |
|
|
336
335
|
| [International data transfers](https://eyereasoner.github.io/eyemind/examples/deck/data-transfers-le) | An ODRL snapshot with rules: GDPR Chapter V observations derived with alternative premises and absence tests over DPV, location and GDPR-extension names, decided by one permission per basis and a prohibition that wins. |
|
|
337
336
|
| [Breach notification](https://eyereasoner.github.io/eyemind/examples/deck/breach-notification-le) | An ODRL snapshot with rules: GDPR Articles 33 and 34 as permissions and prohibitions, with requests, observations and a processor's duty evidence derived from breach records by comparisons over hours. |
|
package/LS-SPEC.md
CHANGED
package/README.md
CHANGED
|
@@ -435,8 +435,9 @@ query(rdf(O, iri('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), sosa('Obser
|
|
|
435
435
|
entailments, without integrity checks or SKOS-XL.
|
|
436
436
|
- `--shacl` compiles shapes to LS and writes a standard `sh:ValidationReport`.
|
|
437
437
|
It implements SHACL 1.2 Core, including list, reifier and targeting
|
|
438
|
-
constraints
|
|
439
|
-
custom functions. All
|
|
438
|
+
constraints and `sh:condition`, and SHACL 1.2 node expressions with the
|
|
439
|
+
`sparql:` functions and custom functions. All 173 W3C Core and 284
|
|
440
|
+
node-expression tests pass with
|
|
440
441
|
complete reports. Recursive shapes, SHACL-SPARQL and rules are not
|
|
441
442
|
supported.
|
|
442
443
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eyemind",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.51",
|
|
4
4
|
"description": "A dependency-free Logic Script (LS) reasoner with forward and backward reasoning, checkable proofs, and RDF 1.2, Notation3 (N3), SPARQL 1.2 RL (SRL) and Logical English (LE) interoperability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/shacl.js
CHANGED
|
@@ -24,9 +24,9 @@ const CONSTRAINTS = ['class', 'datatype', 'nodeKind', 'minCount', 'maxCount', 'm
|
|
|
24
24
|
'closed', 'hasValue', 'in', 'rootClass', 'uniqueValuesFor', 'expression', 'nodeByExpression'];
|
|
25
25
|
const ANNOTATIONS = ['severity', 'message', 'deactivated', 'name', 'description', 'order', 'group', 'defaultValue', 'unit',
|
|
26
26
|
'intent', 'agentInstruction', 'codeIdentifier', 'codeType', 'keyParameter', 'optional'];
|
|
27
|
-
const ALLOWED = new Set([...TARGETS, ...CONSTRAINTS, ...ANNOTATIONS, 'path', 'values', 'flags', 'ignoredProperties']);
|
|
27
|
+
const ALLOWED = new Set([...TARGETS, ...CONSTRAINTS, ...ANNOTATIONS, 'path', 'values', 'flags', 'ignoredProperties', 'condition']);
|
|
28
28
|
// Shape-expecting parameters, whose values are compiled as shapes and checked for recursion.
|
|
29
|
-
const SHAPE_PARAMETERS = ['node', 'not', 'qualifiedValueShape', 'property', 'memberShape', 'reifierShape', 'someValue', 'targetWhere'];
|
|
29
|
+
const SHAPE_PARAMETERS = ['node', 'not', 'qualifiedValueShape', 'property', 'memberShape', 'reifierShape', 'someValue', 'targetWhere', 'condition'];
|
|
30
30
|
const PATH_OPERATORS = ['inversePath', 'alternativePath', 'zeroOrMorePath', 'oneOrMorePath', 'zeroOrOnePath'];
|
|
31
31
|
// The default conformance-disallow set of SHACL 1.2.
|
|
32
32
|
export const SHACL_DISALLOWS = ['Violation', 'Warning', 'Info'].map((n) => SH + n);
|
|
@@ -110,6 +110,24 @@ export function compileShacl(quads, { disallows = SHACL_DISALLOWS, needs = new S
|
|
|
110
110
|
const target = shape(child, depth + 1); node.refs.push(target);
|
|
111
111
|
if (p === 'property') node.properties.push(target);
|
|
112
112
|
}
|
|
113
|
+
// A focus node meets sh:condition when it conforms to every condition
|
|
114
|
+
// shape; one that is a class also brings the node shapes of its
|
|
115
|
+
// superclasses.
|
|
116
|
+
node.conditions = [];
|
|
117
|
+
for (const condition of values(s, 'condition')) {
|
|
118
|
+
const seen = new Set(), pending = [condition];
|
|
119
|
+
while (pending.length) {
|
|
120
|
+
const t = pending.pop();
|
|
121
|
+
if (seen.has(write(t))) continue;
|
|
122
|
+
seen.add(write(t));
|
|
123
|
+
if (write(t) === write(condition) || isNodeShape(t)) {
|
|
124
|
+
const target = shape(t, depth + 1);
|
|
125
|
+
node.conditions.push(target);
|
|
126
|
+
if (!node.refs.includes(target)) node.refs.push(target);
|
|
127
|
+
}
|
|
128
|
+
if (isClass(t)) pending.push(...values(t, RDFS + 'subClassOf'));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
113
131
|
for (const p of ['and', 'or', 'xone']) {
|
|
114
132
|
const root = one(s, p);
|
|
115
133
|
if (root) {
|
|
@@ -287,6 +305,7 @@ export function compileShacl(quads, { disallows = SHACL_DISALLOWS, needs = new S
|
|
|
287
305
|
lines.push(`implied_by(sh_inactive_${id}(F), ${expression(deactivated)}(F, [], nodes([${TRUE_TERM}])));`);
|
|
288
306
|
guard.push(`not(sh_inactive_${id}(F))`);
|
|
289
307
|
}
|
|
308
|
+
for (const condition of node.conditions) guard.push(`sh_ok_${condition.id}(F)`);
|
|
290
309
|
const all = (property, fn) => values(s, property).forEach(fn);
|
|
291
310
|
all('targetNode', (t) => lines.push(t instanceof Struct && t.name === 'bnode' ?
|
|
292
311
|
`implies([${expression(t)}('sh_none', [], nodes(L)), ent_member(T, L)], ${target}(T));` :
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// The release this checkout is; ./release keeps it in step with package.json.
|
|
2
|
-
export const VERSION = '0.8.
|
|
2
|
+
export const VERSION = '0.8.51';
|