- Remove NegationHelper.createNegation in favor of using DeltaBuilder's fluent API - Update all test cases to use createDelta().negate().buildV1() pattern - Update documentation to reflect the preferred way to create negation deltas - Remove unused isNegationDeltaById helper method
2.1 KiB
2.1 KiB
Delta Patterns in Rhizome-Node
This document outlines the distinct delta patterns identified in the Rhizome-Node test suite.
1. Basic Entity Creation
createDelta('creator', 'host')
.setProperty('entity1', 'name', 'Alice', 'user')
.buildV1();
2. Relationship Creation
createDelta('creator', 'host')
.addPointer('users', 'alice', 'friends')
.addPointer('friend', 'bob')
.addPointer('type', 'friendship')
.buildV1();
3. Transaction-Enabled Deltas
createDelta('user1', 'host1')
.inTransaction('tx123')
.setProperty('doc1', 'status', 'draft')
.buildV1();
4. Negation Deltas
// Creating a negation delta
const delta = createDelta('user1', 'host1').buildV1();
const negation = createDelta('moderator', 'host1').negate(delta.id).buildV1();
5. Temporal Deltas
createDelta('user1', 'host1')
.withTimestamp(1624233600000)
.setProperty('entity1', 'score', 100, 'game')
.buildV1();
6. Multi-Property Deltas
createDelta('user1', 'host1')
.setProperty('entity1', 'title', 'Hello World', 'post')
.setProperty('entity1', 'content', 'This is a test', 'post')
.setProperty('entity1', 'published', true, 'post')
.buildV1();
7. Reference-Only Deltas
createDelta('system', 'host1')
.addPointer('posts', 'post1', 'recent')
.buildV1();
8. Bulk Operation Deltas
// Multiple entities in a single delta
createDelta('batch', 'host1')
.setProperty('user1', 'status', 'active', 'user')
.setProperty('user2', 'status', 'inactive', 'user')
.buildV1();
9. Versioned Deltas
// V1 format
createDelta('a', 'h').buildV1();
// V2 format
createDelta('a', 'h').buildV2();
Key Observations
- Most deltas follow a fluent builder pattern
- Deltas can be composed of multiple operations (setProperty, addPointer, etc.)
- Support for both V1 and V2 delta formats
- Strong typing and schema validation is commonly used
- Transaction support is built into the delta creation process
- Temporal aspects can be explicitly controlled