eyemind 0.8.13 → 0.8.15

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/LS-SPEC.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ```text
4
4
  Title: The Logic Script (LS) Language and Proof Format
5
- Version: eyemind 0.8.13
5
+ Version: eyemind 0.8.15
6
6
  ```
7
7
 
8
8
  This document specifies Logic Script (LS): the syntax and meaning of its
package/README.md CHANGED
@@ -12,7 +12,7 @@ program, a JavaScript library and a browser application.
12
12
 
13
13
  [Playground](https://eyereasoner.github.io/eyemind/playground/) · [Examples](https://eyereasoner.github.io/eyemind/examples/) · [Specification](https://eyereasoner.github.io/eyemind/LS-SPEC) · [Conformance](https://eyereasoner.github.io/eyemind/conformance/)
14
14
 
15
- The examples are 157 runnable programs, each with a card deck and saved
15
+ The examples are 158 runnable programs, each with a card deck and saved
16
16
  conclusions; all but one streamed example also save proofs and check reports. The specification defines the language,
17
17
  the proof format and how a proof is checked; its conformance suite has
18
18
  1247 cases that test language and proof behavior, and runs
@@ -387,7 +387,14 @@ query(rdf(O, iri('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), sosa('Obser
387
387
  [MobiBench](https://github.com/william-vw/mobibench) OWL 2 RL suite.
388
388
  - `--qudt` normalizes QUDT quantity values and CDT literals to SI units from
389
389
  an offline catalog adapted from [QUDT.org](https://qudt.org/) (CC BY 4.0):
390
- `"36 km/h"^^cdt:speed` yields `"10.0 m/s"^^cdt:speed`.
390
+ `"36 km/h"^^cdt:speed` yields `"10.0 m/s"^^cdt:speed`. Input metadata adds
391
+ units: with `qudt:conversionMultiplier` and `qudt:hasDimensionVector`,
392
+ composed from QUDT units with `qudt:hasFactorUnit` or `qudt:prefix` and
393
+ `qudt:scalingOf`, or aligned with `owl:sameAs` or `skos:exactMatch`; QUDT
394
+ names such as `unit:NanoGM` resolve as a prefix and a catalog unit. A
395
+ dimension without a CDT datatype normalizes to its coherent SI unit as a
396
+ `cdt:ucum` literal, and a quantity whose unit cannot be resolved, such as a
397
+ currency, is reported with `qconv:unresolvedUnit`.
391
398
  - `--skos` adds positive [SKOS Core](https://www.w3.org/TR/skos-reference/)
392
399
  entailments, without integrity checks or SKOS-XL.
393
400
  - `--shacl` compiles shapes to LS and writes a standard `sh:ValidationReport`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyemind",
3
- "version": "0.8.13",
3
+ "version": "0.8.15",
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/qudt.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // Offline QUDT/CDT normalization. Metadata facts are a small, explicit selection
2
2
  // from QUDT.org (CC BY 4.0), https://qudt.org/vocab/unit/ . Input metadata can
3
3
  // extend or override it; there is no ontology download during compilation.
4
+ import { write } from './writer.js';
5
+
4
6
  const Q = 'http://qudt.org/schema/qudt/';
5
7
  const U = 'http://qudt.org/vocab/unit/';
6
8
  const C = 'https://eyereasoner.github.io/eyemind/qudt#';
@@ -11,6 +13,7 @@ const dimensions = {
11
13
  acceleration: 'A0E0L1I0M0H0T-2D0', temperature: 'A0E0L0I0M0H1T0D0',
12
14
  pressure: 'A0E0L-1I0M1H0T-2D0', energy: 'A0E0L2I0M1H0T-2D0', power: 'A0E0L2I0M1H0T-3D0',
13
15
  dimensionless: 'A0E0L0I0M0H0T0D1', current: 'A0E1L0I0M0H0T0D0', amountOfSubstance: 'A1E0L0I0M0H0T0D0',
16
+ massDensity: 'A0E0L-3I0M1H0T0D0',
14
17
  };
15
18
  const units = [
16
19
  ['M', 'length', 1, 0, ['m']], ['CentiM', 'length', 0.01, 0, ['cm']], ['MilliM', 'length', 0.001, 0, ['mm']],
@@ -18,7 +21,9 @@ const units = [
18
21
  ['FT', 'length', 0.3048, 0, ['[ft_i]', 'ft']], ['MI', 'length', 1609.344, 0, ['[mi_i]', 'mi']],
19
22
  ['SEC', 'time', 1, 0, ['s']], ['MIN', 'time', 60, 0, ['min']], ['HR', 'time', 3600, 0, ['h']], ['DAY', 'time', 86400, 0, ['d']],
20
23
  ['KiloGM', 'mass', 1, 0, ['kg']], ['GM', 'mass', 0.001, 0, ['g']], ['MilliGM', 'mass', 0.000001, 0, ['mg']],
21
- ['LB', 'mass', 0.45359237, 0, ['[lb_av]', 'lb']],
24
+ ['LB', 'mass', 0.45359237, 0, ['[lb_av]', 'lb']], ['OZ', 'mass', 0.028349523125, 0, ['[oz_av]', 'oz']],
25
+ ['OZ_TROY', 'mass', 0.0311034768, 0, ['[oz_tr]']], ['TONNE', 'mass', 1000, 0, ['t']],
26
+ ['KiloTONNE', 'mass', 1e6, 0, ['kt']], ['MegaTONNE', 'mass', 1e9, 0, ['Mt']],
22
27
  ['M-PER-SEC', 'speed', 1, 0, ['m/s', 'm.s-1']], ['KiloM-PER-HR', 'speed', 1 / 3.6, 0, ['km/h', 'km.h-1']],
23
28
  ['MI-PER-HR', 'speed', 0.44704, 0, ['[mi_i]/h', 'mph']], ['KN', 'speed', 1852 / 3600, 0, ['[kn_i]', 'kn']],
24
29
  ['M-PER-SEC2', 'acceleration', 1, 0, ['m/s2', 'm.s-2']],
@@ -26,16 +31,26 @@ const units = [
26
31
  ['DEG_F', 'temperature', 5 / 9, 459.67, ['[degF]', '°F']],
27
32
  ['M2', 'area', 1, 0, ['m2']], ['CentiM2', 'area', 0.0001, 0, ['cm2']],
28
33
  ['M3', 'volume', 1, 0, ['m3']], ['L', 'volume', 0.001, 0, ['L', 'l']], ['MilliL', 'volume', 0.000001, 0, ['mL']],
29
- ['PA', 'pressure', 1, 0, ['Pa']], ['KiloPA', 'pressure', 1000, 0, ['kPa']], ['BAR', 'pressure', 100000, 0, ['bar']],
30
- ['J', 'energy', 1, 0, ['J']], ['KiloJ', 'energy', 1000, 0, ['kJ']],
31
- ['W', 'power', 1, 0, ['W']], ['KiloW', 'power', 1000, 0, ['kW']],
32
- ['UNITLESS', 'dimensionless', 1, 0, ['1']], ['PERCENT', 'dimensionless', 0.01, 0, ['%']],
34
+ ['BBL', 'volume', 0.1589873, 0, ['[bbl_us]']],
35
+ ['PA', 'pressure', 1, 0, ['Pa']], ['HectoPA', 'pressure', 100, 0, ['hPa']], ['KiloPA', 'pressure', 1000, 0, ['kPa']],
36
+ ['MilliBAR', 'pressure', 100, 0, ['mbar']], ['BAR', 'pressure', 100000, 0, ['bar']],
37
+ ['J', 'energy', 1, 0, ['J']], ['KiloJ', 'energy', 1000, 0, ['kJ']], ['MegaJ', 'energy', 1e6, 0, ['MJ']],
38
+ ['W-HR', 'energy', 3600, 0, ['W.h']], ['KiloW-HR', 'energy', 3.6e6, 0, ['kW.h']], ['MegaW-HR', 'energy', 3.6e9, 0, ['MW.h']],
39
+ ['BTU_IT', 'energy', 1055.05585262, 0, ['[Btu_IT]']], ['MegaBTU_IT', 'energy', 1055055852.62, 0, ['M[Btu_IT]']],
40
+ ['W', 'power', 1, 0, ['W']], ['KiloW', 'power', 1000, 0, ['kW']], ['MegaW', 'power', 1e6, 0, ['MW']],
41
+ ['UNITLESS', 'dimensionless', 1, 0, ['1']], ['NUM', 'dimensionless', 1, 0, []], ['PERCENT', 'dimensionless', 0.01, 0, ['%']],
42
+ ['PPTH', 'dimensionless', 0.001, 0, ['[ppth]']], ['PPM', 'dimensionless', 1e-6, 0, ['[ppm]']],
43
+ ['PPB', 'dimensionless', 1e-9, 0, ['[ppb]']],
44
+ ['KiloGM-PER-M3', 'massDensity', 1, 0, ['kg/m3']], ['GM-PER-M3', 'massDensity', 0.001, 0, ['g/m3']],
45
+ ['MilliGM-PER-M3', 'massDensity', 1e-6, 0, ['mg/m3']], ['MicroGM-PER-M3', 'massDensity', 1e-9, 0, ['ug/m3', 'µg/m3']],
33
46
  ['A', 'current', 1, 0, ['A']], ['MOL', 'amountOfSubstance', 1, 0, ['mol']],
34
47
  ];
35
48
  const targets = [['length', 'M', 'm'], ['area', 'M2', 'm2'], ['volume', 'M3', 'm3'], ['time', 'SEC', 's'],
36
49
  ['mass', 'KiloGM', 'kg'], ['speed', 'M-PER-SEC', 'm/s'], ['acceleration', 'M-PER-SEC2', 'm/s2'],
37
50
  ['temperature', 'K', 'K'], ['pressure', 'PA', 'Pa'], ['energy', 'J', 'J'], ['power', 'W', 'W'],
38
- ['dimensionless', 'UNITLESS', '1'], ['current', 'A', 'A'], ['amountOfSubstance', 'MOL', 'mol']];
51
+ ['dimensionless', 'UNITLESS', '1'], ['current', 'A', 'A'], ['amountOfSubstance', 'MOL', 'mol'],
52
+ // CDT has no datatype for mass density: its values are cdt:ucum literals.
53
+ ['massDensity', 'KiloGM-PER-M3', 'kg/m3', 'ucum']];
39
54
  const text = (s) => JSON.stringify(s);
40
55
  const iri = (s) => `iri(${text(s)})`;
41
56
  const number = (n) => `float(${n})`;
@@ -44,9 +59,9 @@ for (const [name, dim, mult, offset, tokens] of units) {
44
59
  definitions.push(`fact(qu_builtin(${iri(U + name)}, ${iri(D + dimensions[dim])}, ${number(mult)}, ${number(offset)}));`);
45
60
  for (const token of tokens) definitions.push(`fact(qu_builtin_token(${text(token)}, ${iri(U + name)}));`);
46
61
  }
47
- for (const [dt, unit, code] of targets) {
62
+ for (const [dt, unit, code, cdt = dt === 'current' ? 'electricCurrent' : dt] of targets) {
48
63
  const profile = C + dt[0].toUpperCase() + dt.slice(1) + 'Profile';
49
- definitions.push(`fact(qu_builtin_profile(${iri(profile)}, ${text('https://w3id.org/cdt/' + (dt === 'current' ? 'electricCurrent' : dt))}, ${iri(U + unit)}, ${text(code)}));`);
64
+ definitions.push(`fact(qu_builtin_profile(${iri(profile)}, ${text('https://w3id.org/cdt/' + cdt)}, ${iri(U + unit)}, ${text(code)}));`);
50
65
  }
51
66
  for (const [name, base, exponent, code] of [['B', 10, 1, 'B'], ['DeciB', 10, 0.1, 'dB'],
52
67
  ['NP', Math.E, 1, 'Np'], ['OCT', 2, 1, 'oct'], ['DECADE', 10, 1, 'dec'], ['PH', 10, -1, '[pH]']]) {
@@ -54,7 +69,7 @@ for (const [name, base, exponent, code] of [['B', 10, 1, 'B'], ['DeciB', 10, 0.1
54
69
  definitions.push(`fact(qu_builtin_token(${text(code)}, ${iri(U + name)}));`);
55
70
  }
56
71
 
57
- export const qudtRules = '\n' + definitions.join('\n') + String.raw`
72
+ const qudtCatalog = '\n' + definitions.join('\n') + String.raw`
58
73
  const qu = (n) => iri('http://qudt.org/schema/qudt/' + n);
59
74
  const qc = (n) => iri('https://eyereasoner.github.io/eyemind/qudt#' + n);
60
75
  const quDouble = 'http://www.w3.org/2001/XMLSchema#double';
@@ -92,7 +107,7 @@ implied_by(qu_generic('http://w3id.org/lindt/custom_datatypes#ucum'), 'true');
92
107
  // become new measurements. Inferred OWL/SKOS unit alignments are still consulted.
93
108
  implied_by(qu_contract(Property, Profile, G), not(ent_base(Property, qc('normalizationProfile'), _, G)));
94
109
  implied_by(qu_contract(Property, Profile, G), ent_base(Property, qc('normalizationProfile'), Profile, G));
95
- implies([ent_base(S, P, literal(L, datatype(DT)), G), qu_parsed(L, U, G, V), qu_datatype(Profile, DT, _, _, G), qu_contract(P, Profile, G), qu_profile(Profile, Specific, T, Code, G), qu_dimension(U, G, Dim), qu_dimension(T, G, Dim)], qu_input(S, P, literal(L, datatype(DT)), qc('sourceLiteral'), U, V, T, Code, Specific, G));
110
+ implies([ent_base(S, P, literal(L, datatype(DT)), G), not(qu_generic(DT)), qu_parsed(L, U, G, V), qu_datatype(Profile, DT, _, _, G), qu_contract(P, Profile, G), qu_profile(Profile, Specific, T, Code, G), qu_dimension(U, G, Dim), qu_dimension(T, G, Dim)], qu_input(S, P, literal(L, datatype(DT)), qc('sourceLiteral'), U, V, T, Code, Specific, G));
96
111
  implies([ent_base(S, P, literal(L, datatype(DT)), G), qu_generic(DT), qu_parsed(L, U, G, V), qu_dimension(U, G, Dim), qu_selected(P, Profile, Specific, T, Code, Dim, G)], qu_input(S, P, literal(L, datatype(DT)), qc('sourceLiteral'), U, V, T, Code, Specific, G));
97
112
  implies([ent_base(S, P, Q, G), rdf(Q, iri('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), qu('QuantityValue'), G), rdf(Q, qu('numericValue'), Value, G), rdf(Q, qu('unit'), Local, G), qu_float(Value, V), qu_align(Local, U, G), qu_dimension(U, G, Dim), qu_selected(P, Profile, DT, T, Code, Dim, G)], qu_input(S, P, Q, qc('sourceQuantity'), U, V, T, Code, DT, G));
98
113
  // QUDT's offset is applied before its multiplier; this matters for Fahrenheit.
@@ -106,4 +121,125 @@ implies([qu_input(S, P, Q, Kind, U, V, T, Code, DT, G), qu_ratio(V, U, G, R), qu
106
121
  rdf(B, iri('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), qu('QuantityValue'), G),
107
122
  rdf(B, qu('numericValue'), Number, G), rdf(B, qu('unit'), T, G), rdf(B, qc('sourceProperty'), P, G), rdf(B, Kind, Q, G), rdf(B, qc('sourceUnit'), U, G)
108
123
  ]);
124
+ // Units composed in the input from factor units or a prefix (qudtUnits).
125
+ implied_by(qu_unit(U, G, D, M, float(0)), [qu_derived(U, G, D, M), not(qu_custom(U, G))]);
126
+ // A quantity whose unit is not known, composed or aligned is reported.
127
+ implied_by(qu_resolved(L, G), qu_align(L, _, G));
128
+ implies([ent_base(S, P, Q, G), rdf(Q, iri('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), qu('QuantityValue'), G), rdf(Q, qu('unit'), L, G), not(qu_resolved(L, G))], ent_report(Q, qc('unresolvedUnit'), L, G));
109
129
  `;
130
+
131
+ // The dimension exponents of a QUDT dimension vector, in its order.
132
+ const BASES = ['A', 'E', 'L', 'I', 'M', 'H', 'T'];
133
+ const vector = (name) => {
134
+ const match = /^A(-?[0-9.]+)E(-?[0-9.]+)L(-?[0-9.]+)I(-?[0-9.]+)M(-?[0-9.]+)H(-?[0-9.]+)T(-?[0-9.]+)D[01]$/.exec(name);
135
+ return match ? match.slice(1).map(Number) : null;
136
+ };
137
+ const vectorName = (exponents) => BASES.map((base, i) => base + (exponents[i] + 0)).join('') + (exponents.every((e) => e === 0) ? 'D1' : 'D0');
138
+ // The coherent SI unit of a dimension, in UCUM: kg, m, s, A, K, mol and cd.
139
+ const UCUM = [['M', 'kg'], ['L', 'm'], ['T', 's'], ['E', 'A'], ['H', 'K'], ['A', 'mol'], ['I', 'cd']];
140
+ // Positive exponents come first, as in cd.m-2.
141
+ const ucumOf = (exponents) => {
142
+ const factors = UCUM.map(([base, code]) => [code, exponents[BASES.indexOf(base)]]).filter(([, e]) => e !== 0);
143
+ return [...factors.filter(([, e]) => e > 0), ...factors.filter(([, e]) => e < 0)]
144
+ .map(([code, e]) => code + (e === 1 ? '' : e)).join('.') || '1';
145
+ };
146
+ const PREFIXES = { Quecto: 1e-30, Ronto: 1e-27, Yocto: 1e-24, Zepto: 1e-21, Atto: 1e-18, Femto: 1e-15, Pico: 1e-12, Nano: 1e-9,
147
+ Micro: 1e-6, Milli: 1e-3, Centi: 1e-2, Deci: 1e-1, Deca: 1e1, Hecto: 1e2, Kilo: 1e3, Mega: 1e6, Giga: 1e9, Tera: 1e12,
148
+ Peta: 1e15, Exa: 1e18, Zetta: 1e21, Yotta: 1e24, Ronna: 1e27, Quetta: 1e30 };
149
+ // A product of multipliers without the rounding error of the
150
+ // multiplications when it is a short decimal, as 1e-12 for a nanogram.
151
+ const exact = (n) => {
152
+ const rounded = Number(n.toPrecision(15));
153
+ return rounded.toExponential().replace(/e.*$/, '').replace(/[-.]/g, '').length <= 12 ? rounded : n;
154
+ };
155
+ // A unit IRI named by an SI prefix and a catalog unit without an offset.
156
+ const prefixed = (id) => {
157
+ if (!id.startsWith(U)) return null;
158
+ const name = id.slice(U.length);
159
+ for (const [prefix, scale] of Object.entries(PREFIXES)) {
160
+ const base = builtin.get(U + name.slice(prefix.length));
161
+ if (name.startsWith(prefix) && base && base.offset === 0) return [scale, base];
162
+ }
163
+ return null;
164
+ };
165
+ const builtin = new Map(units.map(([name, dim, mult, offset]) => [U + name, { exponents: vector(dimensions[dim]), mult, offset }]));
166
+ const profiled = new Set(targets.map(([dim]) => dimensions[dim]));
167
+
168
+ // Facts for the units of these quads that QUDT composes from other units:
169
+ // qudt:hasFactorUnit with qudt:hasUnit and qudt:exponent, or qudt:prefix
170
+ // with qudt:scalingOf. Their multiplier is the product of their factors'
171
+ // multipliers, each to its exponent, and their dimension the sum of their
172
+ // factors' dimensions times it; a factor with an offset cannot compose. A
173
+ // unit of a dimension without a target gets the dimension's coherent SI unit.
174
+ export function qudtUnits(quads) {
175
+ const about = new Map();
176
+ for (const quad of quads) {
177
+ if (quad[0]?.name !== 'iri' && quad[0]?.name !== 'bnode') continue;
178
+ const id = write(quad[0]);
179
+ if (!about.has(id)) about.set(id, []);
180
+ about.get(id).push(quad);
181
+ }
182
+ const values = (node, property) => (about.get(write(node)) ?? []).filter((q) => q[1].args?.[0] === Q + property).map((q) => q[2]);
183
+ const numberOf = (term) => typeof term === 'bigint' ? Number(term)
184
+ : term?.name === 'literal' && /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(term.args[0]) ? Number(term.args[0]) : null;
185
+ const known = new Map(), derived = [], dims = new Set();
186
+ // The graph of a unit's metadata.
187
+ const graphOf = (unit) => write(about.get(write(unit))[0][3]);
188
+ const resolve = (unit, seen = new Set()) => {
189
+ if (unit?.name !== 'iri') return null;
190
+ const id = unit.args[0];
191
+ if (known.has(id)) return known.get(id);
192
+ if (seen.has(id)) return null;
193
+ seen.add(id);
194
+ let found = null;
195
+ const multiplier = numberOf(values(unit, 'conversionMultiplier')[0]);
196
+ const dimension = values(unit, 'hasDimensionVector')[0]?.args?.[0]?.slice(D.length);
197
+ if (multiplier !== null && dimension && vector(dimension)) {
198
+ found = { exponents: vector(dimension), mult: multiplier, offset: numberOf(values(unit, 'conversionOffset')[0]) ?? 0 };
199
+ dims.add(dimension);
200
+ } else if (builtin.has(id)) {
201
+ found = builtin.get(id);
202
+ } else if (prefixed(id)) {
203
+ // QUDT names a prefixed unit by its prefix and unit, as NanoGM.
204
+ const [scale, base] = prefixed(id);
205
+ found = { ...base, mult: exact(scale * base.mult) };
206
+ derived.push(`fact(qu_builtin(${iri(id)}, ${iri(D + vectorName(found.exponents))}, ${number(found.mult)}, ${number(0)}));`);
207
+ dims.add(vectorName(found.exponents));
208
+ } else {
209
+ const factors = values(unit, 'hasFactorUnit');
210
+ const prefix = values(unit, 'prefix')[0], base = values(unit, 'scalingOf')[0];
211
+ let parts = null;
212
+ if (factors.length) parts = factors.map((f) => [values(f, 'hasUnit')[0], numberOf(values(f, 'exponent')[0])]);
213
+ else if (prefix && base) {
214
+ const scale = numberOf(values(prefix, 'prefixMultiplier')[0]) ?? PREFIXES[prefix.args?.[0]?.slice('http://qudt.org/vocab/prefix/'.length)];
215
+ if (scale !== undefined && scale !== null) parts = [[base, 1, scale]];
216
+ }
217
+ if (parts && parts.every(([u, e]) => u && e !== null)) {
218
+ const resolved = parts.map(([u, e, scale = 1]) => [resolve(u, seen), e, scale]);
219
+ if (resolved.every(([r]) => r && r.offset === 0)) {
220
+ const exponents = BASES.map((_, i) => resolved.reduce((sum, [r, e]) => sum + r.exponents[i] * e, 0));
221
+ const mult = exact(resolved.reduce((product, [r, e, scale]) => product * scale * r.mult ** e, 1));
222
+ found = { exponents, mult, offset: 0 };
223
+ derived.push(`fact(qu_derived(${iri(id)}, ${graphOf(unit)}, ${iri(D + vectorName(exponents))}, ${number(mult)}));`);
224
+ dims.add(vectorName(exponents));
225
+ }
226
+ }
227
+ }
228
+ known.set(id, found);
229
+ return found;
230
+ };
231
+ for (const id of about.keys()) {
232
+ const subject = about.get(id)[0][0];
233
+ if (['hasFactorUnit', 'scalingOf', 'hasDimensionVector'].some((p) => values(subject, p).length)) resolve(subject);
234
+ }
235
+ for (const quad of quads) if (quad[1].args?.[0] === Q + 'unit') resolve(quad[2]);
236
+ const profiles = [...dims].filter((dim) => !profiled.has(dim)).map((dim) => {
237
+ const code = ucumOf(vector(dim)), unit = C + 'unit-' + code;
238
+ return `fact(qu_builtin(${iri(unit)}, ${iri(D + dim)}, ${number(1)}, ${number(0)}));\n` +
239
+ `fact(qu_builtin_token(${text(code)}, ${iri(unit)}));\n` +
240
+ `fact(qu_builtin_profile(${iri(C + 'Profile-' + code)}, ${text('https://w3id.org/cdt/ucum')}, ${iri(unit)}, ${text(code)}));`;
241
+ });
242
+ return [...derived, ...profiles].map((line) => line + '\n').join('');
243
+ }
244
+
245
+ export const qudtRules = (quads) => qudtCatalog + qudtUnits(quads);
package/src/rdf-logic.js CHANGED
@@ -35,7 +35,7 @@ export function compileRdfLogic({ quads, prefixes, shapes = quads, wanted = null
35
35
  (execution ? `implied_by(srl_execution(${JSON.stringify(execution.now)}, ${JSON.stringify(execution.seed)}), 'true');\n` : '') +
36
36
  (selected.has('owl2rl') ? owl2rlRules : '') +
37
37
  (selected.has('skos') ? skosRules : '') +
38
- (selected.has('qudt') ? qudtRules : '') +
38
+ (selected.has('qudt') ? qudtRules(quads) : '') +
39
39
  shacl + (evaluate ? "query(sh_evaluation(R));\n" : REPORTS + (stream ? '' : wanted === null ? RESULT : contracted(wanted)));
40
40
  return { kind: profiles[0], text, program: loadText(text, source),
41
41
  prefixes: { ...prefixes, ent: ENTAILMENT, ...(selected.has('skos') ? { skos: 'http://www.w3.org/2004/02/skos/core#' } : {}),
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.13';
2
+ export const VERSION = '0.8.15';