@factoidal/core 0.14.0 → 0.16.0
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/CHANGELOG.md +24 -0
- package/README.md +4 -0
- package/browser.d.ts +6 -1
- package/browser.js +15 -2
- package/index.d.ts +140 -6
- package/index.mjs +24 -2
- package/l4-assets/l4factoidal.js +1 -1
- package/l4-assets/l4factoidal.mjs +1 -1
- package/l4-assets/l4factoidal.wasm +0 -0
- package/l4-assets/version.json +6 -6
- package/lib/api.mjs +12 -2
- package/lib/evidence.mjs +29 -5
- package/lib/nodes.mjs +141 -16
- package/lib/sbm11-lws.mjs +200 -0
- package/lib/sbm11.mjs +73 -1
- package/lib/sync-http-node.mjs +71 -0
- package/lib/version.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.16.0 (2026-10-26)
|
|
6
|
+
|
|
7
|
+
- Node settings in the evidence (https://github.com/danbri/factoidal/issues/975). The params of `node()` are the node's settings. With a wasm module that has the new op `pipelineCheckNodes` (Lean `Wasm/Ops/PipelineNodes.lean`, `Dataflow/NodeSettings.lean`), each evidence record carries `settings` (canonical: keys sorted, defaults of absent settings that narrow the contract such as `lenient: false` and `entail: 'none'`, a Dataset value as `{nquadsSha256}`) and `settingsDigest` (`sha256:` and the hex SHA-256 of the canonical text). A setting outside the proved domain of a proved stage (a lenient reader, an evaluator with `entail` other than `none` or with `output`, a key the stage's settings table does not name) makes the node's status `unproved`, with `registryStatus` and `outside` (each setting and the reason) in the record, so `run()` reports `proved: false`. A reader's `format` must name the stage's syntax (`ttl12` selects RDF 1.2 mode, reported as `derived.mode`); an evaluator's query must parse, else `node()` rejects. Design record: `docs/designissues/2026-10-25-pipeline-settings-and-provenance.md`.
|
|
8
|
+
- The output wire of a `shippedEvaluator` node follows its query form: SELECT gives `Table`, ASK `Answer`, CONSTRUCT and DESCRIBE `Dataset` (owner, 2026-10-25: "select give table? Sure"). So reader, CONSTRUCT, CONSTRUCT is well typed, and reader, SELECT, CONSTRUCT is not. Proved: every answer that meets the evaluator contract has the wire of its query form (`Dataflow.evalContract_wire`) (https://github.com/danbri/factoidal/issues/1026). The Lean wire enumeration has a new wire `table`.
|
|
9
|
+
- CSVW is a registered, bound stage: `node('CSVW (tabular data to RDF)', { metadata, mode, base, url })` runs `csvwToRdf` on CSV text and gives a Dataset and an evidence record with status `tested` (the W3C csv2rdf suite; no Lean contract, so `checked: false`) (https://github.com/danbri/factoidal/issues/975). `stages()` marks a stage `bound` only when the engine also reports it runnable.
|
|
10
|
+
- With the wasm of 0.15.0 or older (for example a mismatched local install), records have no settings, the evaluator's wire is the registry's `Answer`, and the CSVW stage stays `missing` and unbound.
|
|
11
|
+
|
|
12
|
+
- `packSbm11(text, { syntax, base })` packs an RDF document into the files of one SBM11 generation in memory and resolves to a `Map` from file name to bytes (data files, `.merkle` sidecars, `manifest.sbm11`; no `CURRENT`); `mapReader(files)` is a reader over such files for `openSbm11(source, { reader })`. The wasm op is `sbm11PackFiles` (Lean `Storage/Sbm11/PackBytes.lean`), one call per file. The files are byte for byte those of the native `l4sbm11-pack` for the same quads: 23 of 23 files for `test/fixtures/sbm11-tiny`, and all files of 605 of 605 W3C SPARQL 1.0 and 1.1 inputs (`SBM11_PACKFILES=1 tests/sbm11/census.sh`) (https://github.com/danbri/factoidal/issues/1009 stage 2). On the wasm of 0.15.0 or older, `packSbm11` rejects with `code: 'SBM11_NO_PACK_OP'`. The whole document and every file are in memory at once. Not yet: `factoidal pack` on SBM11, and a pack that streams its input.
|
|
13
|
+
- SPARQL: the inverse path `^p` keeps a pair whose object is a literal. SPARQL 1.1 §9.3 and §18.4 make `?x ^p ?y` the same as `?y p ?x`, so `?x` can bind a literal; up to 0.15.0 both evaluators (the in-memory one and the SBM11 id path) dropped those pairs, and `SELECT ?x ?y WHERE { ?x ^<http://e/p> ?y }` over `<http://e/s> <http://e/p> "v" .` gave no row. Apache Jena ARQ 5.6.0 gives the same rows as the fix (https://github.com/danbri/factoidal/issues/1023). Tests: `test/inverse-path-literal-1023.test.mjs` and the `#guard`s in `SPARQL/QueryTests.lean`. The F* tree has the same fix.
|
|
14
|
+
- SPARQL: a `FROM` or `FROM NAMED` IRI that names no graph of the dataset gives a warning of class `dataset-iri-not-found` in the `warnings` member of the query envelope (`class`, `clause` (`FROM` or `FROM NAMED`), `iri`, `message`), and on standard error in the native `l4factoidal query` command. The rows do not change: the clause adds no graph, as before (https://github.com/danbri/factoidal/issues/1032). Lean: `SPARQL.datasetWarnings` beside `applyDataset`, whose merge theorem is unchanged; `#guard`s in `SPARQL/QueryTests.lean` and `Wasm/Ops/Query.lean`. Tests: `test/from-iri-not-found.test.mjs` (plain assertions; https://github.com/danbri/factoidal/issues/1038 records why an expected failure that waits for a rebuild blocked the build of this release).
|
|
15
|
+
- Tests, no engine change: GeoSPARQL `geo:wktLiteral` values made with `STRDT(CONCAT("POINT(", STR(?lon), " ", STR(?lat), ")"), geo:wktLiteral)` in SELECT, in a sub-SELECT that feeds `geof:sfWithin`, and by an INSERT whose stored literal `geof:sfWithin` then tests; from a CSVW column whose datatype object is `{"@id": "http://www.opengis.net/ont/geosparql#wktLiteral", "base": "string"}`; and from an RML object map with `rml:datatype` or a `rml:datatypeMap` with `rml:constant`. `test/wkt-generation.test.mjs` (6 pass on the 0.15.0 wasm) and `#guard`s in `Wasm/Ops/Query.lean` and `Wasm/Ops/Formats.lean`.
|
|
16
|
+
|
|
17
|
+
- Tests, no engine change: `test/sparql-string-arg-types.test.mjs` holds 6 expected failures for SPARQL 1.1 string functions that accept arguments the specification makes type errors, and for SUBSTR rounding (https://github.com/danbri/factoidal/issues/1036), found by porting Apache Jena ARQ expression tests (`docs/designissues/2026-10-25-jena-style-facade-feasibility.md`).
|
|
18
|
+
|
|
19
|
+
## 0.15.0
|
|
20
|
+
|
|
21
|
+
- `openSbm11(source)` and `registerSbm11Source(source, reader)` are back, with the wasm ops `sbm11Open`, `sbm11Query`, `sbm11Close`: SPARQL over an SBM11 generation (the Shardborough store) in Node and in the browser, reading each file at an offset through a host reader (https://github.com/danbri/factoidal/issues/1009, https://github.com/danbri/factoidal-core/pull/93). Fix: in 0.14.0 `sbm11Open` trapped (wasm `unreachable`) because the C host-read functions had a signature that differs from the generated one; the wasm build now fails on any such mismatch. Not yet: the Merkle check of each read, a generation with a delta log (refused at open), packing SBM11 from npm.
|
|
22
|
+
- `lwsSbm11Reader(url, { auth, headers, transport })`: a reader for `openSbm11` of an SBM11 generation held as Linked Web Storage resources, by HTTP `Range` GETs when the server answers `206` with a matching `Content-Range`, else by whole GETs kept in memory; a changed `ETag` refuses the read, and `store.evidence` lists each resource read with its `ETag` (https://github.com/danbri/factoidal/issues/1010, https://github.com/danbri/factoidal-core/pull/90). In Lean every reader is now a storage `Medium`. `browser.d.ts` now types `openSbm11` and `registerSbm11Source`.
|
|
23
|
+
- The native `l4factoidal query` command keeps a named graph with no triple (RDF 1.1 Concepts §4); before, the dataset went through an N-Quads round trip, which cannot state an empty graph (https://github.com/danbri/factoidal/issues/876 part 1, https://github.com/danbri/factoidal-core/pull/94).
|
|
24
|
+
- SPARQL: a property-path alternative of IRIs (`?s p|q ?o`) is planned as the UNION of its triple patterns, so the store planners use their indexes for it; a theorem proves the two forms give the same solutions in the same order and multiplicity, and a test checks that both give the same plan and rows (https://github.com/danbri/factoidal/issues/1008, https://github.com/danbri/factoidal-core/pull/96).
|
|
25
|
+
- `pipe()` and `run()` take the type check and the union of the named assumptions from the engine's op `pipelineCheck`, computed from the Lean stage registry; one theorem (`Pipeline.guarantee_sound`) gives the guarantee of every well-typed pipeline (https://github.com/danbri/factoidal/issues/1002 step 1, https://github.com/danbri/factoidal-core/pull/82). `pipe()` adds `wellTyped` and `check`; `run()` adds `wellTyped` and refuses a pipeline that is not well typed unless `{unchecked: true}`, then reports `proved: false`. `stages()` adds `params`. With a wasm build that has no op `pipelineCheck`, `wellTyped` is null and the union is computed from the nodes as before.
|
|
26
|
+
|
|
3
27
|
## 0.14.0
|
|
4
28
|
|
|
5
29
|
**Checked pipelines.** Each component (reader, store, query evaluator, writer, reasoner, validator, proof checker) has one interface type whose contract against the W3C specifications is part of the type. A component cannot be added without a contract; a contract that is not proved yet is a named assumption, listed and counted in CI. A theorem states that the SPARQL answer agrees with the SPARQL 1.1 semantics for data from any source (a parsed document, a Dataset after edits, an update, a reasoner's output, a union of stores), given the listed assumptions. Status and gaps: https://github.com/danbri/factoidal/issues/975.
|
package/README.md
CHANGED
|
@@ -68,6 +68,10 @@ The same components are nodes you can compose. A value on a wire is
|
|
|
68
68
|
`{graph, evidence}`; each node adds one evidence record; the result lists the
|
|
69
69
|
union of the named assumptions of the nodes, so a pipeline says exactly what
|
|
70
70
|
its answer depends on.
|
|
71
|
+
`pipe()` and `run()` get the type check and that union from the engine
|
|
72
|
+
(op `pipelineCheck`); the theorem `Pipeline.guarantee_sound` gives the
|
|
73
|
+
guarantee of every well-typed pipeline, and `run()` refuses one that is not
|
|
74
|
+
well typed unless `{ unchecked: true }`.
|
|
71
75
|
|
|
72
76
|
```js
|
|
73
77
|
import { stages, node, pipe, run } from "@factoidal/core";
|
package/browser.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type {
|
|
|
11
11
|
DataFormat, EntailRegime, Bindings, DataInput, QueryInput, ParseOptions,
|
|
12
12
|
QueryOptions, SerializeOptions, StoreReader, OpenStoreOptions,
|
|
13
13
|
DeltaLogHandle, DeltaLogInspection,
|
|
14
|
-
Sbm11Reader, Sbm11Answer, Sbm11Store,
|
|
14
|
+
Sbm11Reader, Sbm11Answer, Sbm11Store, Sbm11ReadEvidence, Sbm11Transport,
|
|
15
15
|
ExplainResult, StageInfo, EvidenceRecord, Wire, FactoidalNode, Pipeline, RunResult, RunOptions,
|
|
16
16
|
} from './index';
|
|
17
17
|
|
|
@@ -40,6 +40,11 @@ export {
|
|
|
40
40
|
openStore,
|
|
41
41
|
queryStore,
|
|
42
42
|
listStores,
|
|
43
|
+
openSbm11,
|
|
44
|
+
packSbm11,
|
|
45
|
+
mapReader,
|
|
46
|
+
registerSbm11Source,
|
|
47
|
+
lwsSbm11Reader,
|
|
43
48
|
deltaLogOpen,
|
|
44
49
|
deltaLogAppend,
|
|
45
50
|
deltaLogReadAllHex,
|
package/browser.js
CHANGED
|
@@ -26,6 +26,8 @@ import { buildApi } from './lib/api.mjs';
|
|
|
26
26
|
import { entryFromEngine } from './lib/lean-entry.mjs';
|
|
27
27
|
import { browserEngine } from './lib/browser-engine.mjs';
|
|
28
28
|
import { indexedDbDeltaLogStore } from './lib/delta-log-hosts.mjs';
|
|
29
|
+
import { sbm11Api, registerSbm11Source, mapReader } from './lib/sbm11.mjs';
|
|
30
|
+
import { lwsSbm11Reader } from './lib/sbm11-lws.mjs';
|
|
29
31
|
|
|
30
32
|
const l4Engine = browserEngine('l4factoidal', new URL('./l4-assets/', import.meta.url).href);
|
|
31
33
|
|
|
@@ -59,8 +61,19 @@ const api = buildApi({
|
|
|
59
61
|
deltaLogStore: indexedDbDeltaLogStore(),
|
|
60
62
|
});
|
|
61
63
|
|
|
62
|
-
// SBM11
|
|
63
|
-
//
|
|
64
|
+
// SBM11, the Shardborough store, through host positioned reads
|
|
65
|
+
// (lib/sbm11.mjs; https://github.com/danbri/factoidal/issues/1009). In a
|
|
66
|
+
// browser every source needs a registered synchronous reader, for example
|
|
67
|
+
// over OPFS FileSystemSyncAccessHandle in a dedicated worker.
|
|
68
|
+
const sbm11 = sbm11Api(loadEngine);
|
|
69
|
+
export const openSbm11 = sbm11.openSbm11;
|
|
70
|
+
// Pack a document into the files of an SBM11 generation in memory, and a
|
|
71
|
+
// reader over such files (issue 1009 stage 2).
|
|
72
|
+
export const packSbm11 = sbm11.packSbm11;
|
|
73
|
+
export { registerSbm11Source, mapReader };
|
|
74
|
+
// A reader of an SBM11 generation held as LWS resources (issue 1010 KR3). In
|
|
75
|
+
// a browser worker its default transport is a synchronous XMLHttpRequest.
|
|
76
|
+
export { lwsSbm11Reader };
|
|
64
77
|
|
|
65
78
|
// RDF and SPARQL
|
|
66
79
|
export const parse = api.parse;
|
package/index.d.ts
CHANGED
|
@@ -701,14 +701,31 @@ export interface StageInfo {
|
|
|
701
701
|
note: string;
|
|
702
702
|
/** false exactly when status is 'missing': such a stage does not run. */
|
|
703
703
|
runnable: boolean;
|
|
704
|
-
/**
|
|
704
|
+
/**
|
|
705
|
+
* true when this package has a function that runs the stage as a node AND
|
|
706
|
+
* the engine reports the stage runnable (an older engine that reports a
|
|
707
|
+
* stage 'missing' leaves it unbound).
|
|
708
|
+
*/
|
|
705
709
|
bound: boolean;
|
|
706
710
|
}
|
|
707
711
|
|
|
712
|
+
/**
|
|
713
|
+
* The status of a node: the registry status, or 'unproved' when the stage is
|
|
714
|
+
* 'proved' and one of the node's settings is outside its proved domain (op
|
|
715
|
+
* pipelineCheckNodes, Lean Dataflow/NodeSettings.lean).
|
|
716
|
+
*/
|
|
717
|
+
export type NodeStatus = StageInfo['status'] | 'unproved';
|
|
718
|
+
|
|
719
|
+
/** A setting outside the proved domain of its stage, with the reason. */
|
|
720
|
+
export interface OutsideSetting {
|
|
721
|
+
readonly setting: string;
|
|
722
|
+
readonly reason: string;
|
|
723
|
+
}
|
|
724
|
+
|
|
708
725
|
/** One evidence record: the node that ran and what it produced. */
|
|
709
726
|
export interface EvidenceRecord {
|
|
710
727
|
stage: string;
|
|
711
|
-
status:
|
|
728
|
+
status: NodeStatus;
|
|
712
729
|
contract: string | null;
|
|
713
730
|
assumptions: string[];
|
|
714
731
|
/** true iff `status` is 'proved'. */
|
|
@@ -719,6 +736,19 @@ export interface EvidenceRecord {
|
|
|
719
736
|
reason?: string;
|
|
720
737
|
/** The node's own output beside the graph: the explain result, the SHACL report, the written text, ... */
|
|
721
738
|
artefact: unknown;
|
|
739
|
+
/**
|
|
740
|
+
* The node's settings in canonical form (keys sorted at every depth; the
|
|
741
|
+
* defaults of absent settings that narrow the contract, e.g. `lenient:
|
|
742
|
+
* false`, `entail: 'none'`; a Dataset value as `{nquadsSha256}`). Present
|
|
743
|
+
* when the engine has the op pipelineCheckNodes.
|
|
744
|
+
*/
|
|
745
|
+
settings?: Record<string, unknown>;
|
|
746
|
+
/** `sha256:` and the hex SHA-256 of the canonical settings text. */
|
|
747
|
+
settingsDigest?: string;
|
|
748
|
+
/** With status 'unproved': the registry status ('proved'). */
|
|
749
|
+
registryStatus?: StageInfo['status'];
|
|
750
|
+
/** With status 'unproved': the settings outside the proved domain. */
|
|
751
|
+
outside?: OutsideSetting[];
|
|
722
752
|
}
|
|
723
753
|
|
|
724
754
|
/** The value on a wire. */
|
|
@@ -731,27 +761,82 @@ export interface Wire<G = unknown> {
|
|
|
731
761
|
export interface FactoidalNode {
|
|
732
762
|
readonly stage: string;
|
|
733
763
|
readonly kind: string | null;
|
|
734
|
-
|
|
764
|
+
/** The engine's status of this node with its settings (see NodeStatus). */
|
|
765
|
+
readonly status: NodeStatus;
|
|
766
|
+
/** The registry status of the stage. */
|
|
767
|
+
readonly registryStatus: StageInfo['status'];
|
|
735
768
|
readonly contract: string | null;
|
|
736
769
|
readonly assumptions: readonly string[];
|
|
737
770
|
readonly wireIn: string;
|
|
771
|
+
/**
|
|
772
|
+
* The output wire with these settings: for shippedEvaluator, 'Table' for
|
|
773
|
+
* SELECT, 'Answer' for ASK, 'Dataset' for CONSTRUCT and DESCRIBE (Lean
|
|
774
|
+
* formWire, evalContract_wire). With an older engine, the registry wire.
|
|
775
|
+
*/
|
|
738
776
|
readonly wireOut: string;
|
|
739
777
|
readonly runnable: boolean;
|
|
740
778
|
readonly bound: boolean;
|
|
779
|
+
/** The settings as given (passed to the package function that runs the stage). */
|
|
741
780
|
readonly params: Readonly<Record<string, unknown>>;
|
|
781
|
+
/** The settings as sent to the engine: JSON values, a Dataset as {$nquads}. */
|
|
782
|
+
readonly settingsWire: Readonly<Record<string, unknown>>;
|
|
783
|
+
/** The engine's canonical settings, or null with an older engine. */
|
|
784
|
+
readonly settings: Readonly<Record<string, unknown>> | null;
|
|
785
|
+
readonly settingsDigest: string | null;
|
|
786
|
+
readonly outside: readonly OutsideSetting[];
|
|
787
|
+
/** Values the engine read from the settings: `form` of a query, `mode` ('1.1' | '1.2') of a reader. */
|
|
788
|
+
readonly derived: Readonly<Record<string, string>> | null;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/** The engine's check of a list of stages (op pipelineCheck, Lean pipelineReport). */
|
|
792
|
+
export interface PipelineCheck {
|
|
793
|
+
/** Each stage's output wire is the next stage's input wire or converts to it (Lean wellTyped_iff). */
|
|
794
|
+
readonly wellTyped: boolean;
|
|
795
|
+
readonly wireIn: string | null;
|
|
796
|
+
readonly wireOut: string | null;
|
|
797
|
+
/** The first stage `at` whose output does not feed stage `at + 1`. */
|
|
798
|
+
readonly mismatch: { readonly at: number; readonly out: string; readonly in: string } | null;
|
|
799
|
+
/** Where an output reaches the next input by a named conversion (Dataflow/Wire.lean). */
|
|
800
|
+
readonly conversions: readonly { readonly at: number; readonly from: string; readonly to: string }[];
|
|
801
|
+
/** The union of the stages' named assumptions: the premises of Pipeline.guarantee_sound. */
|
|
802
|
+
readonly assumptions: readonly string[];
|
|
803
|
+
readonly contract: { readonly theorem: string; readonly stages: readonly (string | null)[] };
|
|
804
|
+
readonly stages: readonly {
|
|
805
|
+
readonly name: string; readonly status: NodeStatus; readonly checked: boolean;
|
|
806
|
+
readonly contract: string | null; readonly assumptions: readonly string[];
|
|
807
|
+
readonly wireIn: string; readonly wireOut: string;
|
|
808
|
+
/** The fields below come from the op pipelineCheckNodes only. */
|
|
809
|
+
readonly registryStatus?: StageInfo['status'];
|
|
810
|
+
readonly settings?: Record<string, unknown>;
|
|
811
|
+
readonly settingsDigest?: string;
|
|
812
|
+
/** The role of each setting: 'parameter' | 'selects-wire' | 'inert' | 'narrows' | 'unlisted'. */
|
|
813
|
+
readonly roles?: Readonly<Record<string, string>>;
|
|
814
|
+
readonly outside?: readonly OutsideSetting[];
|
|
815
|
+
readonly derived?: Readonly<Record<string, string>>;
|
|
816
|
+
}[];
|
|
742
817
|
}
|
|
743
818
|
|
|
744
|
-
/**
|
|
819
|
+
/**
|
|
820
|
+
* A pipeline: nodes in order. `check` is the engine's op pipelineCheck;
|
|
821
|
+
* `assumptions` and `wellTyped` are its fields. With an engine that has no
|
|
822
|
+
* such op, `check` and `wellTyped` are null and `assumptions` is the union
|
|
823
|
+
* of the nodes' assumptions.
|
|
824
|
+
*/
|
|
745
825
|
export interface Pipeline {
|
|
746
826
|
readonly nodes: readonly FactoidalNode[];
|
|
747
827
|
readonly assumptions: readonly string[];
|
|
828
|
+
readonly wellTyped: boolean | null;
|
|
829
|
+
readonly check: PipelineCheck | null;
|
|
748
830
|
}
|
|
749
831
|
|
|
750
832
|
/** The result of run(): the last graph, one record per node, the assumption union. */
|
|
751
833
|
export interface RunResult<G = unknown> extends Wire<G> {
|
|
834
|
+
/** The assumptions of the records on the input wire, then the engine's union for the pipeline (op pipelineCheck). */
|
|
752
835
|
assumptions: string[];
|
|
753
|
-
/** true iff every evidence record is checked (status 'proved'). */
|
|
836
|
+
/** true iff every evidence record is checked (status 'proved') and the pipeline is well typed. */
|
|
754
837
|
proved: boolean;
|
|
838
|
+
/** The engine's type check of the pipeline; null when the engine has no op pipelineCheck. */
|
|
839
|
+
wellTyped: boolean | null;
|
|
755
840
|
/** The stage names of the records that are not checked. */
|
|
756
841
|
uncheckedSteps: string[];
|
|
757
842
|
}
|
|
@@ -784,7 +869,8 @@ export function pipe(...nodes: Array<FactoidalNode | Pipeline>): Pipeline;
|
|
|
784
869
|
* Run a node or pipeline on `input` (a Wire, or the graph: text for a
|
|
785
870
|
* reader, else a Dataset or data input). Rejects before any node runs when
|
|
786
871
|
* a node's stage has status 'missing' (unless `options.unchecked`) or has
|
|
787
|
-
* no package function
|
|
872
|
+
* no package function, or when the engine's check finds the pipeline not
|
|
873
|
+
* well typed (unless `options.unchecked`; then `proved` is false).
|
|
788
874
|
*/
|
|
789
875
|
export function run(pipeline: FactoidalNode | Pipeline, input: unknown, options?: RunOptions): Promise<RunResult>;
|
|
790
876
|
|
|
@@ -1093,10 +1179,54 @@ export interface Sbm11Store {
|
|
|
1093
1179
|
generation: string;
|
|
1094
1180
|
terms: number;
|
|
1095
1181
|
query(sparql: string, options?: { base?: string; sparql12?: boolean; reference?: boolean }): Sbm11Answer;
|
|
1182
|
+
/** the resources the reader read, when its reader records them (lwsSbm11Reader) */
|
|
1183
|
+
readonly evidence: Sbm11ReadEvidence[] | undefined;
|
|
1096
1184
|
close(): void;
|
|
1097
1185
|
}
|
|
1098
1186
|
|
|
1187
|
+
/** Open an SBM11 generation (https://github.com/danbri/factoidal/issues/1009).
|
|
1188
|
+
* Node: `source` is a directory unless a reader is given or registered. */
|
|
1189
|
+
export function openSbm11(source: string, options?: { reader?: Sbm11Reader }): Promise<Sbm11Store>;
|
|
1190
|
+
|
|
1191
|
+
/** Serve `source` with `reader`; `null` removes it. */
|
|
1192
|
+
export function registerSbm11Source(source: string, reader: Sbm11Reader | null): void;
|
|
1193
|
+
|
|
1194
|
+
/** Pack an RDF document into the files of one SBM11 generation, in memory
|
|
1195
|
+
* (wasm op `sbm11PackFiles`, https://github.com/danbri/factoidal/issues/1009
|
|
1196
|
+
* stage 2): file name to bytes, the files `l4sbm11-pack` writes for the same
|
|
1197
|
+
* quads, without `CURRENT`. Rejects with `code: 'SBM11_NO_PACK_OP'` on a wasm
|
|
1198
|
+
* module that has no such op. */
|
|
1199
|
+
export function packSbm11(text: string | Uint8Array,
|
|
1200
|
+
options: { syntax: 'turtle' | 'trig' | 'nquads' | 'ntriples' | 'rdfxml' | 'jsonld' | string; base?: string }
|
|
1201
|
+
): Promise<Map<string, Uint8Array>>;
|
|
1202
|
+
|
|
1203
|
+
/** A reader over files held in memory (for example the result of `packSbm11`). */
|
|
1204
|
+
export function mapReader(files: Map<string, Uint8Array> | Record<string, Uint8Array>): Sbm11Reader;
|
|
1205
|
+
|
|
1206
|
+
/** One LWS resource an SBM11 reader read (https://github.com/danbri/factoidal/issues/1010). */
|
|
1207
|
+
export interface Sbm11ReadEvidence {
|
|
1208
|
+
resource: string;
|
|
1209
|
+
etag: string;
|
|
1210
|
+
lastModified: string | null;
|
|
1211
|
+
/** HTTP requests made for this resource */
|
|
1212
|
+
requests: number;
|
|
1213
|
+
/** answers that were 206 Partial Content */
|
|
1214
|
+
partial: number;
|
|
1215
|
+
/** content bytes received */
|
|
1216
|
+
bytes: number;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/** A synchronous HTTP GET: `(url, headers) -> answer`. */
|
|
1220
|
+
export type Sbm11Transport = (url: string, headers: Record<string, string>) =>
|
|
1221
|
+
{ status: number; header(name: string): string | null; bytes: Uint8Array };
|
|
1099
1222
|
|
|
1223
|
+
/** A reader of the SBM11 files held as LWS resources under the container
|
|
1224
|
+
* `url` (one resource per file, CURRENT a resource too), by HTTP Range GETs
|
|
1225
|
+
* when the server answers 206, else by whole GETs kept in memory. Node: the
|
|
1226
|
+
* default transport is a fetch in a worker thread; close() stops it. */
|
|
1227
|
+
export function lwsSbm11Reader(url: string, opts?: {
|
|
1228
|
+
auth?: string; headers?: Record<string, string>; transport?: Sbm11Transport; timeoutMs?: number
|
|
1229
|
+
}): Sbm11Reader & { evidence(): Sbm11ReadEvidence[]; errors(): string[]; close(): void };
|
|
1100
1230
|
|
|
1101
1231
|
/** One query against a store: open with the query's plan, query, close. */
|
|
1102
1232
|
export function queryStore(
|
|
@@ -1505,6 +1635,10 @@ export function capabilities(): Promise<{
|
|
|
1505
1635
|
owlClosure: boolean;
|
|
1506
1636
|
explain: boolean;
|
|
1507
1637
|
stages: boolean;
|
|
1638
|
+
/** The op pipelineCheck: pipe() and run() use the engine's type check and assumption union. */
|
|
1639
|
+
pipelineCheck: boolean;
|
|
1640
|
+
/** The op pipelineCheckNodes: node settings in evidence, and the evaluator's output wire from the query form. */
|
|
1641
|
+
pipelineCheckNodes: boolean;
|
|
1508
1642
|
tableau: boolean;
|
|
1509
1643
|
rml: boolean;
|
|
1510
1644
|
csvw: boolean;
|
package/index.mjs
CHANGED
|
@@ -21,6 +21,10 @@ import { readFileSync } from 'node:fs';
|
|
|
21
21
|
import { join } from 'node:path';
|
|
22
22
|
import { buildApi } from './lib/api.mjs';
|
|
23
23
|
import { entryFromEngine } from './lib/lean-entry.mjs';
|
|
24
|
+
import { sbm11Api, registerSbm11Source, setDefaultSbm11Reader, mapReader } from './lib/sbm11.mjs';
|
|
25
|
+
import { nodeDefaultReaderFactory } from './lib/sbm11-node.mjs';
|
|
26
|
+
import { lwsSbm11Reader as lwsSbm11ReaderWith } from './lib/sbm11-lws.mjs';
|
|
27
|
+
import { nodeSyncTransport } from './lib/sync-http-node.mjs';
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* The loaded Lean engine handle: `call(op, args)`, `callBlob`,
|
|
@@ -66,8 +70,26 @@ export const clearExtensionFunctions = api.clearExtensionFunctions;
|
|
|
66
70
|
export const registerServiceEndpoint = api.registerServiceEndpoint;
|
|
67
71
|
export const clearServiceEndpoints = api.clearServiceEndpoints;
|
|
68
72
|
|
|
69
|
-
// SBM11
|
|
70
|
-
//
|
|
73
|
+
// SBM11, the Shardborough store, through host positioned reads
|
|
74
|
+
// (lib/sbm11.mjs; https://github.com/danbri/factoidal/issues/1009). In Node a
|
|
75
|
+
// source with no registered reader is a directory.
|
|
76
|
+
setDefaultSbm11Reader(nodeDefaultReaderFactory());
|
|
77
|
+
const sbm11 = sbm11Api(loadEngine);
|
|
78
|
+
export const openSbm11 = sbm11.openSbm11;
|
|
79
|
+
// Pack a document into the files of an SBM11 generation in memory, and a
|
|
80
|
+
// reader over such files (issue 1009 stage 2).
|
|
81
|
+
export const packSbm11 = sbm11.packSbm11;
|
|
82
|
+
export { registerSbm11Source, mapReader };
|
|
83
|
+
|
|
84
|
+
// A reader of an SBM11 generation held as LWS resources (lib/sbm11-lws.mjs;
|
|
85
|
+
// https://github.com/danbri/factoidal/issues/1010 KR3). In Node the default
|
|
86
|
+
// synchronous transport is a fetch in a worker thread (lib/sync-http-node.mjs),
|
|
87
|
+
// stopped by the reader's close().
|
|
88
|
+
export function lwsSbm11Reader(url, opts = {}) {
|
|
89
|
+
if (typeof opts.transport === 'function') return lwsSbm11ReaderWith(url, opts);
|
|
90
|
+
const transport = nodeSyncTransport({ timeoutMs: opts.timeoutMs });
|
|
91
|
+
return lwsSbm11ReaderWith(url, { ...opts, transport, onClose: () => transport.close() });
|
|
92
|
+
}
|
|
71
93
|
|
|
72
94
|
// The persisted store
|
|
73
95
|
export const openStore = api.openStore;
|
package/l4-assets/l4factoidal.js
CHANGED