Utilities API
Tools
SemanticSpacetime.remove_chapter! — Function
remove_chapter!(sst::SSTConnection, chapter::String)Delete all nodes and links belonging to a chapter from the database. This is a destructive operation that cannot be undone.
SemanticSpacetime.browse_notes — Function
browse_notes(sst::SSTConnection, chapter::String;
page::Int=1, width::Int=SCREENWIDTH) -> StringFormat notes from a chapter for terminal display. Retrieves the page map for the given chapter and renders each note with its context, chapter heading, and linked content.
Returns a formatted string suitable for terminal output.
SemanticSpacetime.import_json! — Function
import_json!(sst::SSTConnection, json_str::String;
chapter::String="json_import") -> Vector{Node}Import a JSON structure as SST nodes and links. Each key-value pair in the JSON becomes a node (key) with a CONTAINS link to its value node(s). Nested objects create nested containment structures. Arrays create multiple CONTAINS links from the parent key.
Returns a vector of all created nodes.
Session Tracking
SemanticSpacetime.reset_session_tracking! — Function
reset_session_tracking!()Reset all in-memory session tracking state.
SemanticSpacetime.update_last_saw_section! — Function
update_last_saw_section!(store::AbstractSSTStore, name::AbstractString)Record that the given section was accessed at the current time.
SemanticSpacetime.update_last_saw_nptr! — Function
update_last_saw_nptr!(store::AbstractSSTStore, nptr::NodePtr, name::AbstractString)Record that the given node pointer was accessed at the current time.
SemanticSpacetime.get_last_saw_section — Function
get_last_saw_section(store::AbstractSSTStore) -> Vector{LastSeen}Return all tracked sections, sorted by section name, with updated ndelta.
SemanticSpacetime.get_last_saw_nptr — Function
get_last_saw_nptr(store::AbstractSSTStore, nptr::NodePtr) -> LastSeenReturn the LastSeen record for a specific node pointer. Returns a default LastSeen if not tracked.
SemanticSpacetime.get_newly_seen_nptrs — Function
get_newly_seen_nptrs(store::AbstractSSTStore, horizon::Int) -> Set{NodePtr}Return the set of node pointers that were last seen within horizon hours. If horizon <= 0, returns all tracked node pointers.
Display
SemanticSpacetime.show_text — Function
Format text for terminal display with word-wrapping.
SemanticSpacetime.indent — Function
Create indentation string of given width.
SemanticSpacetime.print_node_orbit — Function
Print a node orbit to terminal.
SemanticSpacetime.print_link_orbit — Function
Print links of a specific STtype from orbit satellites.
SemanticSpacetime.print_link_path — Function
Print a link path from a cone.
SemanticSpacetime.show_context — Function
Show context summary.
SemanticSpacetime.print_sta_index — Function
Print STtype index as human-readable string.
SemanticSpacetime.show_time — Function
Format human-readable time duration.
Built-in Functions
SemanticSpacetime.expand_dynamic_functions — Function
Expand dynamic function expressions in text (e.g., Dynamic:{TimeUntil Day5}).
SemanticSpacetime.evaluate_in_built — Function
Evaluate a built-in function starting at pos (the '{' character).
SemanticSpacetime.do_in_built_function — Function
Dispatch built-in function by name.
SemanticSpacetime.in_built_time_until — Function
Calculate time until a semantic time specification.
SemanticSpacetime.in_built_time_since — Function
Calculate time since a semantic time specification.
Extended Queries
SemanticSpacetime.get_arrows_matching_name — Function
Get all arrows matching a name (exact or fuzzy via lowercase comparison).
SemanticSpacetime.get_arrows_by_sttype — Function
Get all arrows of a specific STtype.
SemanticSpacetime.get_arrow_with_name — Function
Get arrow with its name and STtype.
SemanticSpacetime.next_link_arrow — Function
Find next link arrow in a path matching given arrow constraints.
SemanticSpacetime.inc_constraint_cone_links — Function
Incrementally expand constrained cone links.
SemanticSpacetime.get_singleton_by_sttype — Function
Get singleton nodes by STtype (sources have outgoing but no incoming, sinks vice versa).
SemanticSpacetime.get_sequence_containers — Function
Get sequence containers (stories) from node pointers.
SemanticSpacetime.already_seen — Function
Check if a string was already seen in a cone structure.
Convenience Functions
SemanticSpacetime.connect! — Function
connect!(store, from, arrow, to; context=String[], weight=1.0f0)Convenience alias for mem_edge! with keyword arguments.
Example
connect!(store, apple, "contains", fruit)
connect!(store, apple, "note", description; context=["botany"])SemanticSpacetime.links — Function
links(node::Node) -> Vector{Link}Get all links from a node, flattened across all ST types.
links(node::Node, sttype::STType) -> Vector{Link}Get links from a node for a specific ST type.
Example
fwd_links = links(node, LEADSTO) # Forward causal links
contains = links(node, CONTAINS) # Containment links
similar = links(node, NEAR) # Similarity linksSemanticSpacetime.neighbors — Function
neighbors(store::MemoryStore, node::Node) -> Vector{Node}Get all nodes directly connected to this node.
neighbors(store::MemoryStore, node::Node, sttype::STType) -> Vector{Node}Get nodes connected via a specific ST type.
SemanticSpacetime.nodes — Function
nodes(store::MemoryStore) -> Vector{Node}Get all nodes in the store as a vector.
SemanticSpacetime.eachnode — Function
eachnode(store::MemoryStore)Iterate over all nodes in the store.
Example
for node in eachnode(store)
println(node.s)
endSemanticSpacetime.eachlink — Function
eachlink(node::Node)Iterate over all links from a node (across all ST types).
Example
for link in eachlink(node)
println("Arrow: $(link.arr), Dst: $(link.dst)")
endeachlink(node::Node, sttype::STType)Iterate over links of a specific ST type.
SemanticSpacetime.find_nodes — Function
find_nodes(store::MemoryStore, predicate::Function) -> Vector{Node}Find all nodes matching a predicate.
Examples
# Find long text nodes
long_nodes = find_nodes(store, n -> n.l > 100)
# Find nodes in a chapter
ch_nodes = find_nodes(store, n -> n.chap == "vocabulary")find_nodes(store::MemoryStore, pattern::Regex) -> Vector{Node}Find all nodes whose text matches a regex pattern.
Example
fruit_nodes = find_nodes(store, r"fruit|apple|banana"i)SemanticSpacetime.map_nodes — Function
map_nodes(f::Function, store::MemoryStore) -> VectorApply a function to each node and collect results.
Example
names = map_nodes(n -> n.s, store)SemanticSpacetime.with_store — Function
with_store(f::Function) -> MemoryStore
with_store(f::Function, store::MemoryStore) -> MemoryStoreExecute a function with a MemoryStore, using do-block syntax.
Example
store = with_store() do s
a = mem_vertex!(s, "apple", "fruits")
b = mem_vertex!(s, "banana", "fruits")
mem_edge!(s, a, "contains", b)
endSemanticSpacetime.with_config — Function
with_config(f::Function, config_dir::String)Execute a function after loading SST arrow configuration.
Example
with_config("/path/to/SSTconfig") do
result = parse_n4l("-section\n apple (contains) fruit\n")
@show result
endSQL Index
SemanticSpacetime.SQLIndexConfig — Type
SQLIndexConfigConfiguration for indexing a SQL database into SST.
SemanticSpacetime.index_sql_database! — Function
index_sql_database!(store::MemoryStore, db;
config::SQLIndexConfig=SQLIndexConfig()) -> Dict{String,Int}Index a SQL database into the SST graph.
- Each table becomes a chapter (prefixed with
config.chapter_prefix) - Each row becomes a node (labeled by primary key or configured column)
- Foreign key columns create LEADSTO edges between nodes
- Other columns become EXPRESS (note) annotations
Returns a Dict mapping table names to number of nodes created.
ETC Validation Integration
SemanticSpacetime.validate_compiled_graph! — Function
validate_compiled_graph!(store::MemoryStore; verbose::Bool=false) -> Vector{String}Run ETC validation on all nodes in the store. First infers ETC types, then validates them. Returns a flat list of warnings about type mismatches (e.g., a Thing with only LEADSTO links, an Event with no temporal arrows).