@utaba/deep-memory 0.9.0 → 0.9.2
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/index.cjs +11 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2612,7 +2612,7 @@ var MemoryRepository = class {
|
|
|
2612
2612
|
### Step 1 \u2014 Discover before you traverse
|
|
2613
2613
|
|
|
2614
2614
|
Before following relationships from an entity, check that it actually has relationships.
|
|
2615
|
-
|
|
2615
|
+
Graph queries include \`relationshipSummary\` on every returned entity by default
|
|
2616
2616
|
(outbound and inbound counts by type). Inspect this before traversing \u2014 entities with
|
|
2617
2617
|
zero outbound counts for the relationship type you need have no connections to follow.
|
|
2618
2618
|
To skip summaries and reduce response size, set \`includeRelationshipSummary: false\`.
|
|
@@ -2620,7 +2620,7 @@ To skip summaries and reduce response size, set \`includeRelationshipSummary: fa
|
|
|
2620
2620
|
### Step 2 \u2014 Use projection for aggregation
|
|
2621
2621
|
|
|
2622
2622
|
To understand what data exists (e.g. all distinct values of a property, or counts by
|
|
2623
|
-
category), use
|
|
2623
|
+
category), use a graph query with \`projection\` instead of fetching full entities:
|
|
2624
2624
|
\`{ start: { entityType: "..." }, projection: { properties: ["propName"], distinct: true }, limit: 200 }\`
|
|
2625
2625
|
|
|
2626
2626
|
This returns only the aggregated values \u2014 no entity objects \u2014 keeping responses lightweight.
|
|
@@ -2629,23 +2629,23 @@ This returns only the aggregated values \u2014 no entity objects \u2014 keeping
|
|
|
2629
2629
|
|
|
2630
2630
|
- **Omit relationshipTypes** in a traversal step to follow all relationship types at once,
|
|
2631
2631
|
rather than making separate calls per type.
|
|
2632
|
-
- **Use multi-step traversals** for multi-hop patterns. A two-step
|
|
2632
|
+
- **Use multi-step traversals** for multi-hop patterns. A two-step traverse operation
|
|
2633
2633
|
(e.g. Equipment \u2192 Component \u2192 MaintenanceProcedure) is one call, not two sequential calls.
|
|
2634
2634
|
- **Use returnMode "all"** when you need intermediate entities along the path, not just
|
|
2635
2635
|
the terminal nodes.
|
|
2636
2636
|
|
|
2637
2637
|
### Step 4 \u2014 Use semantic search for known-unknowns
|
|
2638
2638
|
|
|
2639
|
-
|
|
2639
|
+
Semantic/concept search is best for finding specific entities when you know roughly
|
|
2640
2640
|
what you're looking for but not the exact label or type. It is not efficient for broad
|
|
2641
|
-
discovery \u2014 use projection or
|
|
2641
|
+
discovery \u2014 use projection or entity finding for that.
|
|
2642
2642
|
|
|
2643
2643
|
### Common anti-patterns to avoid
|
|
2644
2644
|
|
|
2645
2645
|
- **Don't traverse from entities with zero relationship counts.** The \`relationshipSummary\` on each entity tells you what is connected before you traverse.
|
|
2646
|
-
- **Don't split queries by relationship type.** One step with no type filter is better
|
|
2646
|
+
- **Don't split queries by relationship type.** One traverse step with no type filter is better
|
|
2647
2647
|
than three separate single-type calls.
|
|
2648
|
-
- **Don't use sequential single-hop traversals** when a multi-step
|
|
2648
|
+
- **Don't use sequential single-hop traversals** when a multi-step traverse operation achieves the
|
|
2649
2649
|
same result in one call.
|
|
2650
2650
|
- **Don't fetch full entities when you only need property values.** Use projection.`;
|
|
2651
2651
|
}
|
|
@@ -3490,7 +3490,7 @@ var EventBus = class {
|
|
|
3490
3490
|
};
|
|
3491
3491
|
|
|
3492
3492
|
// src/portability/RepositoryExporter.ts
|
|
3493
|
-
var LIBRARY_VERSION = true ? "0.9.
|
|
3493
|
+
var LIBRARY_VERSION = true ? "0.9.2" : "0.1.0";
|
|
3494
3494
|
var RepositoryExporter = class {
|
|
3495
3495
|
storage;
|
|
3496
3496
|
provenance;
|
|
@@ -5284,9 +5284,11 @@ var InMemoryStorageProvider = class {
|
|
|
5284
5284
|
group.relationships.push(rel);
|
|
5285
5285
|
}
|
|
5286
5286
|
nextFrontier.add(connectedEntityId);
|
|
5287
|
-
visited.add(connectedEntityId);
|
|
5288
5287
|
}
|
|
5289
5288
|
}
|
|
5289
|
+
for (const id of nextFrontier) {
|
|
5290
|
+
visited.add(id);
|
|
5291
|
+
}
|
|
5290
5292
|
layers.push(layer);
|
|
5291
5293
|
currentFrontier = nextFrontier;
|
|
5292
5294
|
if (nextFrontier.size === 0) break;
|