Arrows and Contexts
Arrow Directory
SemanticSpacetime.insert_arrow! — Function
insert_arrow!(stname, alias, name, pm) -> ArrowPtrRegister a new arrow type in the directory. Returns the allocated ArrowPtr.
stname: ST type name ("NEAR", "LEADSTO", "CONTAINS", "EXPRESS")alias: Short name/alias for the arrowname: Long descriptive namepm: Sign string ("+" or "-")
SemanticSpacetime.insert_inverse_arrow! — Function
insert_inverse_arrow!(fwd::ArrowPtr, bwd::ArrowPtr)Register a pair of arrows as inverses of each other.
SemanticSpacetime.get_arrow_by_name — Function
get_arrow_by_name(name::AbstractString) -> Union{ArrowEntry, Nothing}Look up an arrow by its short or long name.
SemanticSpacetime.get_arrow_by_ptr — Function
get_arrow_by_ptr(ptr::ArrowPtr) -> ArrowEntryLook up an arrow by its pointer. Throws if not found.
SemanticSpacetime.get_stindex_by_name — Function
get_stindex_by_name(stname::AbstractString, pm::AbstractString) -> IntConvert a Semantic Spacetime type name and sign into a 1-based array index. stname is one of "NEAR", "LEADSTO", "CONTAINS", "EXPRESS" (case-insensitive). pm is "+" or "-" (or "" for NEAR).
SemanticSpacetime.get_sttype_from_arrows — Function
get_sttype_from_arrows(arrows::Vector{ArrowPtr}) -> Vector{Int}Extract the set of unique ST type indices from a list of arrow pointers.
SemanticSpacetime.print_stindex — Function
print_stindex(stindex::Int) -> StringReturn a human-readable label for an ST array index.
SemanticSpacetime.add_mandatory_arrows! — Function
add_mandatory_arrows!()Register the mandatory built-in arrow types required by the SST system. This includes sequence arrows (then/from), extract arrows, fragment arrows, intent/ambient property arrows, and URL/image arrows. Called automatically by parse_n4l.
Arrow Closures
SemanticSpacetime.ClosureRule — Type
ClosureRuleA rule for composing two consecutive arrows into a result arrow.
SemanticSpacetime.load_arrow_closures — Function
load_arrow_closures(config_dir::AbstractString) -> Vector{ClosureRule}Read closure rules from closures.sst in the config directory. Format: arrow1 + arrow2 => result_arrow (one per line). Lines starting with # are comments.
SemanticSpacetime.apply_arrow_closures! — Function
apply_arrow_closures!(store::AbstractSSTStore, rules::Vector{ClosureRule})For each node, check pairs of consecutive outgoing links where a closure rule applies, and add the composed link.
SemanticSpacetime.complete_inferences! — Function
complete_inferences!(store::AbstractSSTStore)Apply inference completions to all nodes: closeness (NEAR symmetry), sequence completion, and ETC type validation.
SemanticSpacetime.complete_closeness! — Function
complete_closeness!(store::AbstractSSTStore, node::Node)Apply symmetric closure for NEAR links: if A is near B and A is near C by the same arrow type, then B and C should also be near each other.
SemanticSpacetime.complete_sequences! — Function
complete_sequences!(store::AbstractSSTStore, node::Node)Complete sequence chains: if A→B and B→C are in sequence, verify the chain is consistent. (Placeholder for full transitive closure.)
Context Management
SemanticSpacetime.register_context! — Function
register_context!(context::Vector{String}) -> ContextPtrRegister a context (given as a vector of labels) in the directory. Returns the pointer to the existing or newly created entry.
SemanticSpacetime.try_context — Function
try_context(context::Vector{String}) -> ContextPtrLook up or register a context. Returns 0 for empty contexts.
SemanticSpacetime.get_context — Function
get_context(ptr::ContextPtr) -> StringRetrieve the context string for a given pointer. Returns "" for pointer 0 or out-of-range pointers.
SemanticSpacetime.compile_context_string — Function
compile_context_string(context::Vector{String}) -> StringCombine a vector of context labels into a single canonical comma-separated string (sorted, deduplicated, stripped).
SemanticSpacetime.normalize_context_string — Function
normalize_context_string(ctx::Vector{String}) -> StringNormalize a context vector: sort, deduplicate, join with commas. Alias for compile_context_string matching the Go API.
Node Directory
SemanticSpacetime.new_node_directory — Function
new_node_directory() -> NodeDirectoryCreate an empty node directory.
SemanticSpacetime.append_text_to_directory! — Function
append_text_to_directory!(nd::NodeDirectory, event::Node) -> NodePtrAdd a node to the directory. Returns the NodePtr for the (possibly existing) node. Idempotent — returns existing pointer if text already registered.
append_text_to_directory!(event::Node) -> NodePtrAppend to the global node directory.
SemanticSpacetime.check_existing_or_alt_caps — Function
check_existing_or_alt_caps(nd::NodeDirectory, event::Node) -> (ClassedNodePtr, Bool)Check if a node with the same text (or different capitalization) already exists. Returns (pointer, found). Logs a warning if an alternative capitalization exists.
check_existing_or_alt_caps(event::Node) -> (ClassedNodePtr, Bool)Check using the global node directory.
SemanticSpacetime.get_node_txt_from_ptr — Function
get_node_txt_from_ptr(nd::NodeDirectory, ptr::NodePtr) -> StringGet the text of a node by its pointer. Returns "" if not found.
SemanticSpacetime.get_memory_node_from_ptr — Function
get_memory_node_from_ptr(nd::NodeDirectory, ptr::NodePtr) -> NodeRetrieve a node from memory by its pointer. Returns empty node if not found.
Appointed Nodes
SemanticSpacetime.get_appointed_nodes_by_arrow — Function
get_appointed_nodes_by_arrow(store::MemoryStore, arrow::Int;
context::Vector{String}=String[],
chapter::AbstractString="any",
size::Int=100) -> Dict{Int, Vector{Appointment}}Get appointed nodes grouped by arrow type (memory-backed). Finds nodes that have incoming links with the specified arrow, groups them by arrow pointer, and filters by chapter and context.
get_appointed_nodes_by_arrow(sst::SSTConnection, arrow::Int;
context::Vector{String}=String[],
chapter::AbstractString="any",
size::Int=100) -> Dict{Int, Vector{Appointment}}Get appointed nodes grouped by arrow type using the PostgreSQL stored procedure.
SemanticSpacetime.get_appointed_nodes_by_sttype — Function
get_appointed_nodes_by_sttype(store::MemoryStore, sttype::Int;
context::Vector{String}=String[],
chapter::AbstractString="any",
size::Int=100) -> Dict{Int, Vector{Appointment}}Get appointed nodes grouped by STType (memory-backed). Scans nodes for incoming links in the specified ST channel, groups results by arrow pointer.
get_appointed_nodes_by_sttype(sst::SSTConnection, sttype::Int;
context::Vector{String}=String[],
chapter::AbstractString="any",
size::Int=100) -> Dict{Int, Vector{Appointment}}Get appointed nodes grouped by STType using the PostgreSQL stored procedure.
SemanticSpacetime.parse_appointed_node_cluster — Function
parse_appointed_node_cluster(whole::AbstractString) -> AppointmentParse a PostgreSQL appointment cluster tuple string into an Appointment. Expected format: (arr,sttype,chapter,"{ctx1,ctx2}","(class,cptr)","{"(c,p)",...}")