The Waher.Script.Persistence extension adds SQL-like statements over Neuron’s object database. The syntax looks familiar, but sources are .NET types, object collections, vectors, or XML—not relational tables by default.
Inspect a type
If two loaded assemblies define the same local type name, use the fully qualified .NET type name.
Select objects
Features include projection, aliases, filtering, ordering, grouping, aggregates, implicit groups, wildcards, pagination, and selecting a single object.
Collection names can collide with namespaces. Quote the label to force collection interpretation:
Insert
The engine supports:
It also supports INSERT SELECT, INSERT OBJECT, and INSERT OBJECTS forms. Prefer inserting typed objects through a package API when invariants or events must be maintained.
Update and delete
Direct mutation can bypass domain workflows, signatures, notifications, and audit events. Use it for owned operational data, migrations, and recovery procedures—not to alter legal identities, signed contracts, ledger history, or token history.
Indexes and collections
CREATE and DROP statements can manage indexes and collections. Run schema operations from a versioned migration with a backup and an idempotent existence check.
External SQL databases
The Waher.Script.Data family can open external connections, execute provider SQL, call stored procedures, and close connections. MySQL and PostgreSQL extensions add provider-specific support. Always parameterize external input and close connections in finally.
Semantic data
With semantic and persistence extensions loaded, Script can execute SPARQL SELECT, ASK, and CONSTRUCT queries. Use the Neuron’s SPARQL and graph-store HTTP APIs for cross-process integrations; use Script for local transforms and reports.
Ledger records
Ledger extensions add RECORD OBJECT, RECORD OBJECTS, and REPLAY. Ledger recording is append-oriented and auditable; it is not a replacement for mutable operational persistence. Record domain events whose history must be provable, then build current projections separately.