FrankenGraphDB

Graph Intent Log (the semantic vocabulary)

1,075 words2 listingsA design document: it describes the 1.0 target, not what runs today.

Intents are deterministic commands captured at statement execution; they are not committed effects or Ripple deltas. IntentElementRef is the closed union Existing{database_security_namespace_id,graph,vid_or_eid}|EscapedAllocation{binding_ref:StrongRef<EscapingAllocationReservationRecord>,slot_key,permanent_value}|StatementLocal{tmp_ref_ordinal}. StatementLocal can appear only within one GraphIntentBatch and cannot enter result bytes, a later statement, procedure/UDF output, provenance/audit, a durable witness, or a committed effect. First escape uses §4.5's ordered reservation and all subsequent intents use the EscapedAllocation arm. IntentCoordinateRef is exactly {binding_role_id,coordinate:CoordinateSchemaBinding,write_basis:WeakMarkerIdentity}; no raw graph/branch name, run locator, or untyped reference is legal.

CapturedIntentObservation is the generated closed union of exact value/CAS, element-version, key absence/range gap, adjacency/degree, valid-time range, constraint, escrow, and procedure-output observations. Every arm names its coordinate role, schema/contract epoch, witness ref, disclosure class, and deterministic recomputation rule. GraphIntent<Role> is {authority_bound_header:AuthorityBoundHeader<Role>,intent_ordinal,intent_semantics_oid,read_coordinate_roles[],write_coordinate_refs[],captured_observation_refs[CapturedIntentObservationRef],structural_effect_class,operation:GraphIntentOperation}. GraphIntentBatch<Role> is the independently addressable per-statement object {authority_bound_header:AuthorityBoundHeader<Role>,registration_identity,statement_seq,canonical_statement_classification_ref:StrongRef<CanonicalStatementClassification>,intent_semantics_ref:StrongRef<IntentSemantics>,prior_workspace_generation_identity,sorted_intents,escaped_allocation_binding_root_ref:StrongRef<TxnAllocationBindingRoot>,statement_observation_commitment,resource_bounds,body_digest:BodyDigest<GraphIntentBatch<Role>>}. Ordinals are contiguous, arrays and maps have registered size/depth/string/value limits, and the batch's binding/semantics/coordinate values must match every child. A child intent cannot carry another root, service epoch, purpose, principal, or ceiling even when policy/revocation scalars happen to match. Registration owns no future batch. LocalStatementPublicationSpec/GlobalStatementPublicationSpec must name the already-built exact batch, prior/successor workspace and cumulative roots, and the Published successor plus successor workspace/cumulative root strongly own it. A statement abort proves no batch exists or retains one exact failed diagnostic batch under its registered retention policy. Every shard workspace delta/certificate binds its routed batch projection, exact Shard security projection, and complete batch digest. Prepare proves a gap-free bijection between published statements, batches, workspace effects, observations, and cumulative roots; DAG and substitution tests reject a registration-to-future-batch edge, missing/extra batch, authority substitution, or reused certificate from another batch.

CreateVertex   { new_ref, label_set, props, valid_time_assignment }
DeleteVertex   { target, expected_version, cascade_policy }
AddLabel/RemoveLabel { vid, label }
AddEdge        { new_ref, src, etype, dst, requested_key?, props, valid_time_assignment }
RemoveEdge     { target, expected_version }
SetProp        { elem, name, value, merge_policy_id }
RemoveProp     { elem, name }
EnsureEdge     { src, etype, dst, constraint_id, props }
CompareAndSet  { elem, name, expected, value, mismatch: NoOp|StatementError|TxnAbort }
SetInsert      { elem, name, element, set_epoch }
SetRemove      { elem, name, element, observed_tags_or_remove_policy }
SetValidTime   { elem, contract_id, expected:Any|Exact(ValidTimeAssignment),
                 replacement:ValidTimeAssignment,
                 mismatch:NoOp|StatementError|TxnAbort }
AdjustCounter  { elem, property, delta,
                 algebra:ExactAdd|Escrow{constraint_id,domain_epoch},
                 operation_key, overflow:Reject }
SketchUpdate   { elem_or_relation, sketch_profile_oid, operation_key,
                 canonical_input, exact_delete_token? }
AssertSameAs   { a, b, confidence, source } // canonical sugar for AddEdge(SAME_AS)
BulkLoad       { logical_batch_ref:StrongRef<CanonicalBulkLogicalBatch>,
                 source_digest, row_count,
                 optional_staged_run_refs[ConditionalCoordinateRef] }
SchemaOp       { canonical_schema_operation } // ordinary transactional intent/effect

CanonicalBulkLogicalBatch contains bounded canonical logical rows with explicit operation tag, coordinate role, element/key/value/valid-time/provenance fields, row ordinal, source-row digest, and batch digest. Staged runs are optional accelerators checked against that batch; no effect is inferred from physical run bytes. AssertSameAs creates an ordinary protected SAME_AS edge with stable EId, endpoints, properties, valid time, and provenance; there is no second entity-resolution mutation mechanism. Catalog graph/branch aliases and all branchable schema/constraint/index definitions use ordinary SchemaOp transaction effects and the same marker/head/authorization/SSI path. Database-global topology, security policy, key, configuration, physical index-build progress, and derived-generation activation remain typed control commands, not SchemaOp.

LWW policies use canonical EffectOrder { commit_seq, intent_ordinal, merge_ordinal, effect_ordinal }, never element birth or an ambient wall clock. ExactAdd is checked integer/fixed-decimal addition identified by a registered algebra profile; raw addition is not idempotent, so ACI merge operates on the set-union of unique operation keys followed by deterministic checked summation. Escrow uses §4.7's custody ledger. Every sketch profile fixes its merge/delete algebra, precision/error contract, canonical state, duplicate-operation behavior, and fallback; a sketch without exact deletion either rejects delete/update workloads or rebuilds, and never becomes authoritative constraint state. Generic SetProp/RemoveProp against counter/escrow/sketch-governed state is invalid unless the binder rewrites it into the registered typed operation with captured-before/CAS semantics. ConsistencyClass is derived only after composing intent semantics, captured observations, active constraints, rights/authority, and branch policy. Commutativity tables are caches of proved contextual results.

StatementObservationCommitment covers the exact canonical published result bytes or NoResult proof, escaped identities/generated values, error class, workspace successor, and every read/constraint/rights observation visible to later statements. Rebase may freely regenerate an unpublished autocommit terminal result, but it may not alter any prior published statement commitment. If re-evaluation would change one byte, identity, row order, error/no-op choice, valid period, or workspace-visible effect, the explicit transaction fails with a serialization/retry outcome rather than silently committing a history the client did not observe.

Finalization evaluates all commands and emits only canonical effects:

CreateVertexEffect { permanent_vid, allocation_binding_or_finalization_proof,
                     birth_ordinal, labels, canonical_props, valid_time_assignment }
DeleteVertexEffect { vid, complete_before_version, retirement_basis,
                     sorted_retired_incident_edge_before_images[],
                     sorted_constraint/temporal/escrow_contribution_retractions[] }
LabelMembershipEffect { vid, label, before, after }
CreateEdgeEffect { permanent_eid, allocation_binding_or_finalization_proof,
                   birth_ordinal, src, type, dst, canonical_key?, props,
                   valid_time_assignment }
DeleteEdgeEffect { eid, complete_before_version, retirement_basis,
                   sorted_constraint/temporal/escrow_contribution_retractions[] }
PropertyEffect { elem, property, before, after }
ValidTimeEffect { elem, contract_id, before, after, before_version_identity,
                  temporal_constraint_transition_refs[], witness_basis }
CounterEffect { operation_key, elem, property, algebra_profile,
                delta, before, after, overflow:Reject }
EscrowAdjustmentEffect { domain_id, epoch, operation_key, contribution_key?,
                         elem_property_or_cardinality_subject, delta,
                         before_value, after_value, consumed_reservation_refs[],
                         produced_right_kind_and_amount, target_owner,
                         conservation_basis_digest }
SketchEffect { operation_key, sketch_profile_oid, before_state_digest,
               after_state_ref, realized_answer_contract }
SchemaEffect { transition:CoordinateSchemaTransition,
               canonical_catalog_schema_constraint_index_operations[] }
ConstraintStateEffect { apply_basis, before_schema_root, before_schema_epoch,
                        after_schema_root, after_schema_epoch,
                        before_constraint_root, after_constraint_root,
                        exact_removed_and_added_contributions[] }
ResourceChargeEffect { reservation_id, scope, before_charge, after_charge, reason }

Every effect carries EffectProvenance {source_batch_ref:StrongRef<GraphIntentBatch>,source_intent_ordinal,source_statement_seq,source_coordinate_role,source_observation_commitment,merge_or_import_origin?,authorization_decision_digest,canonicalization_profile_oid}. CoordinateEffectEnvelope {coordinate:WriteCoordinateBinding,effect_ordinal,effect,provenance} is the sole coordinate source, so nested effects cannot disagree. GlobalEffectEnvelope is the closed union Resource{transition_ref,effect}|Audit{ticket_and_event_commitment}|AuthorityGlobalEscrow{domain_id,operation_summary_ref,effect}; a coordinate effect cannot smuggle a global charge and a global effect cannot mutate graph state. Resource reservation/charge/release ownership and audit ticket/event ownership are typed strong refs, never bare IDs or an English “handled elsewhere” promise.

NetEffectNormalForm groups by coordinate and logical identity/key, cancels only inverse effects proved unobserved and algebraically cancellable, preserves create/delete before-images and all unique operation keys, sorts cascades/contributions canonically, and rejects two incompatible terminal values. It includes a proof mapping every source intent to its surviving effects or an explicit NoOp{captured_basis,policy}; no intent disappears implicitly. CommittedEffectSet<Role:AuthorityOwningRole> is {authority_bound_header:AuthorityBoundHeader<Role>,intent_semantics_ref,ordered_source_batch_refs[],statement_observation_commitments[],net_effect_normal_form_ref,coordinate_effect_envelopes[],global_effect_envelopes[],complete_allocation_binding_commitment,constraint_temporal_escrow_evidence,authorization_decision_ref:StrongRef<AuthorizationDecisionRecord<Role>>,resource_transition_refs[StrongRef<ResourceLedgerTransition<Role>>],audit_ownership_commitment,body_digest}. It has explicit before/after semantics, permanent IDs/BirthOrdinals, branch-aware retirement bases, full cascade before-images, and no conditional operation. Every child effect/provenance/resource reference must agree with the same complete authority binding; equal policy/revocation scalars under a different principal, purpose, ceiling, or service epoch are noninterchangeable.

The sequence-neutral graph/branch/relation/schema/intent-semantics-keyed LogicalDeltaTemplate is derived from that normal form and differential-tested against applying the gap-free ordered batches once under the pinned IntentSemanticsOid to the recorded basis. Create/delete/property/valid-time/counter/escrow/sketch/schema/constraint deltas are exact typed rows; only the committed MarkerRef turns the template into an ordered LogicalDeltaBatch. Fuzz/model tests delete or duplicate intents/effects/provenance/observations, reorder bulk rows/cascades, force no-op/CAS drift, replay operation keys, expose IDs then rebase/abort, and compare batch application, workspace state, reference finalization, normal form, committed effects, and integrated deltas byte-for-byte.