@lde/search 0.25.0 → 0.26.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/dist/engine.d.ts CHANGED
@@ -123,10 +123,13 @@ export type SearchValue = string | number | boolean | readonly string[] | Locali
123
123
  * values grouped together, so a multi-valued reference never degrades into
124
124
  * parallel arrays a consumer has to pair by index.
125
125
  *
126
- * `id` is present only when the referent is a named node: nesting carries the
127
- * referent’s fields, not a document key, so a blank-node referent nests exactly
128
- * like a named one, minus the `id`. Distinct from {@link Reference}, which is
129
- * what an `idOnly`/`labelOnly` reference carries – there the IRI *is* the value.
126
+ * **No `id`**: nesting carries the referent’s fields, not a document key, and a
127
+ * Reference Type is kept in no collection for a key to address it in. A named
128
+ * node and a blank one therefore nest alike. The exception is a
129
+ * {@link ReferenceStrategy.local local} lookup, which nests a Root Type – there
130
+ * the `id` is the key its own collection files the referent under, and the
131
+ * lookup resolves against it. Distinct from {@link Reference}, which is what an
132
+ * `idOnly`/`labelOnly` reference carries – there the IRI *is* the value.
130
133
  */
131
134
  export interface NestedDocument {
132
135
  readonly [field: string]: SearchValue | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACX,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,YAAY,CAC3B,KAAK,SAAS,SAAS,UAAU,EAAE,GAAG,SAAS,UAAU,EAAE;IAE3D;uDACmD;IACnD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,CAAC,CAAC,SAAS,UAAU,CAAC,KAAK,CAAC,EAChC,UAAU,EAAE,CAAC,EACb,KA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,11 +2,11 @@ import type { Quad } from '@rdfjs/types';
2
2
  import { type FramedNode } from './frame-by-type.js';
3
3
  import { type ProjectionValue, type RootType, type SearchSchema, type SearchType } from './schema.js';
4
4
  /**
5
- * A projected node: the fields of one {@link SearchType}, flat. A root always
6
- * carries the `id` that keys it – it is a {@link SearchDocument} – but an inline
7
- * referent carries one only when the referent is a named node: a nested document
8
- * is not a document key, so nesting needs the referent’s fields, not its
9
- * identity.
5
+ * A projected node: the fields of one {@link SearchType}, flat. A **Root Type**
6
+ * carries the `id` that keys it – as a root it is a {@link SearchDocument}, and
7
+ * nested by a {@link ReferenceStrategy.local local} lookup it is what the lookup
8
+ * resolves against. A **Reference Type** never does: it is kept in no collection,
9
+ * so nesting needs the referent’s fields and not its identity.
10
10
  */
11
11
  export type ProjectedNode = Record<string, unknown>;
12
12
  /** A flat search document. `id` is the engine document key. */
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAkBL,KAAK,eAAe,EAEpB,KAAK,QAAQ,EAEb,KAAK,YAAY,EACjB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAChD,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAC1C;IACC,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;C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,OAAO,GAAE,iBAAyC,GACjD,cAAc,CAgBhB;AAmID;;;;;;;;;;;;GAYG;AACH,wBAAuB,YAAY,CACjC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,QAAQ,EACpB,OAAO,GAAE,iBAAyC,GACjD,aAAa,CAAC,cAAc,CAAC,CAc/B"}
package/dist/project.js CHANGED
@@ -103,6 +103,18 @@ function documentKey(node) {
103
103
  * `idOnly` reference over the same path.
104
104
  */
105
105
  function documentIdOf(node, searchType) {
106
+ // A Reference Type is nested inside its referrer and keyed in no collection
107
+ // of its own, so its entries carry no `id` – whether or not the graph happened
108
+ // to name the node. Nesting carries a referent's FIELDS, not a document key
109
+ // (ADR 24), and nothing reads one here: the collection declares an `id` for a
110
+ // locally-nested Root Type alone, a weld names the flat identity companion
111
+ // beside the entry, and an entry's own key answers no query. Emitting it made
112
+ // an entry's shape depend on whether a publisher minted an IRI for a
113
+ // relationship – arbitrary to a consumer, and a field the collection never
114
+ // declared.
115
+ if (searchType.class === undefined) {
116
+ return undefined;
117
+ }
106
118
  const nodeIri = documentKey(node);
107
119
  if (nodeIri === undefined || searchType.key === undefined) {
108
120
  return nodeIri;
@@ -464,7 +476,10 @@ function applyProjectionValue(document, field, from, context, schema) {
464
476
  * {@link ProjectedNode} for a single reference, an array for an `array` one.
465
477
  * A referent needs **no identity**: nesting carries its fields, not a document
466
478
  * key, so a blank-node referent – whose `@id` JSON-LD 1.1 framing prunes when its
467
- * label occurs once – nests exactly like a named one, minus the `id`.
479
+ * label occurs once – nests exactly like a named one. Neither carries an `id`:
480
+ * a Reference Type is kept in no collection, so nothing resolves an entry by
481
+ * key, and an entry's shape no longer depends on whether a publisher minted an
482
+ * IRI for the relationship ({@link documentIdOf}).
468
483
  * The referent is projected in full – internal fields included – so the
469
484
  * declaring type’s (or the reference type’s own) derives can read them;
470
485
  * {@link pruneInternalFields} then removes the internal fields from a *surfaced*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/search",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "Engine- and domain-agnostic core for RDF-backed search: a unified declarative field model (SearchField/SearchType/SearchSchema), a neutral query IR, the SearchEngine port with logical result types, and a streaming CONSTRUCT-to-document projection. Bakes in no engine, protocol, or domain.",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",