Release 0.2.0
The second minor release of Graphersal. It brings date and time values, property indexes, schema defaults that are applied when an element is created, and vectors with exact similarity search and embedders that turn text into vectors inside the engine (a built-in one, Model2Vec models and your own, for GraphRAG). It changes the storage format and a few APIs: read Breaking changes and the upgrade guide before you move a store or a storage implementation to it. What 0.2.0 does not do yet is on Current Limitations.
Highlights
- Dates and times (#3;
Dates and Times): five value types modelled on PostgreSQL and the SQL
standard,
datetime(an instant with its UTC offset),localdatetime,date,timeandduration(months, days and microseconds kept apart, likeinterval), with microsecond resolution over the years -9999 to 9999. Time zones come from the bundled IANA database (Time Zones):date_addanddate_truncin a zone,at_zone,as_local, daylight-saving gaps and overlaps resolved as PostgreSQL does. Calendar-correct arithmetic (date_add,date_diff,age), truncation and parts, conversions,now()andtoday()(one time per script or unit), comparison and sorting, and the schema formatsdate-time,date,local-date-time,timeanddurationwithformatMinimum/formatMaximum(Dates in a Schema). TinkerPop'sdatetime(),asDate(),dateAdd(),dateDiff()andDTbehave as TinkerPop 3.8 specifies them (TinkerPop Compatibility). Dates are values in Rust, Rhai, Python (datetimeobjects andgraphersal.Interval), GraphSON (thejava.timetypes), the persistence format and the playground's editors (Storage and Exchange). A string that looks like a date stays a string: a date comes from a constructor, a conversion, a schema declaration or a typed value, never from guessing. - Property indexes (#4;
Property Indexes):
g.create_index(..)declares an ordered index on a label's top-level property; the new optimizer ruleproperty_indexanswershas()equality,P.withinand range filters from it (.profile()shows[index: ..]), with the same results as a scan. The declaration is stored in the catalog and travels with the graph; the entries are rebuilt at every load. Every index has a type:memory-orderedis the one type of 0.2 (an index type a later version adds is kept and listed as not served, never misread), and an index on a key the schema declares as a vector, list or map is refused with a clear message (Index types). An index may carry the transformto_lowerfor case-insensitive search: it keys the lowered text of string values and serveshas("name", __.to_lower().is("alice"))(equality,P.within, ranges; default name<label>_<key>_to_lower; a plain index on the same key coexists) (Case-insensitive search). PythonGraph.create_index(transform=), the playground's Catalog ▸ Property indexes, the dev server's/api/indexesand MCP tools. has(key, traversal)follows TinkerPop:has("name", __.to_lower().is("alice"))isfilter(values("name").to_lower().is("alice"))(the child runs on the property's value; an element without the property is filtered out), also with a jpath key and in the three-argument formhas(label, key, traversal). Before, the anonymous traversal was silently compared as a string and matched nothing. Rusthas_traversal(key, traversal).- Schema defaults on create (#5;
Defaults on create): a schema's
defaultnow has SQLDEFAULTsemantics on a label's top-level properties, and the new keyworddefaultFunctionfillsuuidv4,uuidv7(time-ordered, RFC 9562),nowortoday.add_v/add_e,mergeV/mergeEon create and the playground's create dialog fill every missing default before the element is checked, in modeopenandclosed; explicit values (nulltoo) win, and existing data is never changed. - Vectors (Vectors): a value type for embeddings with
f32,f16,i8(scalar quantization) andbitcomponents, up to 65 536 of them;vector([..]),as_vector(),quantize(kind),GType.VECTOR, and the schema form{"type": "array", "format": "vector", "element": .., "dimension": .., "metric": ..}, which coerces a list of numbers on write and can store a property quantized from the start. Exact search withsimilarity(),nearest()andvector_mean()over cosine, dot product, L2 and Hamming, combined freely with graph steps (filtered search, GraphRAG, recommendations). Vectors are values in Python (graphersal.Vector, also from anumpyarray), the playground, GraphSON, GraphML (through the schema) and the persistence format. Embeddings and Vector Search walks through it, in the playground without a model and from Python with one, and the playground's Examples have an Embeddings (vectors) group. - Embedders (Vectors): the step
embed()/embed(key)and the functionembed(text)turn text into vectors through the embedders the host registered (g.embedders()lists them); the built-inhash-ngram/1(hashed words and character n-grams: fuzzy, lexical similarity, no model file, the same bits on every target) is always there, also in the browser playground. Hosts plug in their ownEmbedder(a Rust trait with batching and cancellation) throughEmbedders::builder()andGraphTraversalSource::with_embedders, the script entry points or the session; each embedder carries a stable model identity besides its registry name. Running an embedder isExecuteon the new permission resourceEmbedder. A computed vector is stored as a plain value: replay, recovery and loads never call an embedder. - Embedding a property and text queries (Vectors):
the job
g.embed_property(#{label, from, to, ..})embeds a property of many elements page by page, without holding the graph's lock while the embedder runs (a concurrent writer goes on; a text changed meanwhile is skipped), restartable withonly_missing; RustGraph::embed_property/EmbedJob::run_in. The vector schema keywordembedderrecords per label and property which model produced the vectors; the job needs an attached schema (modeopenorclosed), declares the property or itsembedderin the unit of its first page, and refuses another model or dimension (another element kind is quantized on write).nearest(key, "text", k)andsimilarity(key, "text")then take the query as text and embed it with the registered embedder of the declared model, once per execution.diff_schemareports anembedderchange asembedder_changed. - Real embedding models: Model2Vec
(Embeddings):
graphersal embed-model download <repo>fetches a Model2Vec static embedding model from Hugging Face (SHA-256 checked, a manifest beside it; the only network access of the tool) andembed-model listshows the downloaded ones;--embedder NAME=PATH|REPOand--default-embedder NAMEregister a model for every mode (one-shot, REPL, dev server, MCP, AI Chat tools), run locally on the CPU. Its model identity ismodel2vec/<repo>@<hash of the files>, never a path. In Rust it isgraphersal::vector::Model2Vecbehind the new featuremodel2vec(off by default, native only, loads from a local directory only); the CLI has it on by default. - Embedders in Python (Python Quick Start: Embedders):
graphersal.Embedder(name, fn, dimension=..)makes any Python model an embedder (fn(texts)returns the rows or one 2-D numpy array, read without a numpy dependency), andgraphersal.Model2Vec(name, path, model="minishlab/potion-base-8M")loads a Model2Vec model from a directory the developer downloaded (the library never downloads; the identity equals the command line's download of the same files). Every graph constructor, loader andStoreopener takesembedders=[..]anddefault_embedder=;graph.register_embedder,graph.embedders()andgraph.embed_property(label=.., source=.., target=..)(GIL released, Ctrl+C cancels between pages,EmbedPropertyError.reporton failure) complete it, and scripts and text queries use the registry. Rust:Embedders::scopegives the script entry points that build their own engine a host's registry,Model2VecOptions::with_reponames the repository of a host-downloaded model. - Playground: the schema editor's tables edit
defaultFunctionand a vector's element, dimension, metric and embedder; the Graph and Mermaid drawings always show the schema the tables show (also a draft); the Mermaid diagram parses whatever labels and property names hold; the Detailed drawing zooms by mouse wheel as fast as the Fast one; a click on a panel's title collapses it; the header shows the engine version and the build. - Properties named
idorlabel(#1; Properties Named id or label) are read as properties, never as the element's id or label, and vertices and edges returned by a terminal are values with their id, label and properties apart (#2; Vertices and Edges as Values). - Store upgrade:
graphersal store upgrade(RustStore::upgrade, PythonStore.upgrade) converts a store, backup or single-file store of 0.1.x to the 0.2 format with this binary alone, keeping the whole history (Format Versions and Upgrade). - Files of a newer Graphersal are refused, never taken for damage (#6), as in 0.1.1; which older versions are upgraded, and how, is one table in the code, shown on Format Versions and Upgrade.
- Prebuilt binaries (Installation): every release has
archives of the
graphersalcommand-line tool for Linux (x86_64, aarch64), macOS (Apple silicon, Intel) and Windows (x86_64), withSHA256SUMSand GitHub build-provenance attestations;cargo binstall graphersal-cliinstalls them. The Linux binaries are statically linked with musl and run on any distribution, but are slower on allocation-heavy queries than a source build (Performance of the prebuilt Linux binaries).
TinkerPop conformance
The vendored Apache TinkerPop 3.8.2 suite: 1631 of 1675 in-scope scenarios pass (97.4 %,
0.1.x: 1599, 95.5 %), 39 are unsupported (0.1.x: 71) and 0 supported steps behave differently
from the specification. The date and time features (DateTime, AsDate, DateAdd, DateDiff)
pass completely; the remaining gaps are mainly call() and the set type
(TinkerPop Compliance).
Breaking changes
0.2.0 is a minor release before 1.0 and may break the 0.1 API (Releases and Versioning). Every break, and what to do:
Stored data and files
- Store format version 3, file format version 2. 0.2.0 writes new snapshot, WAL and packed
snapshot files of file format version 2 (the value tags of the date and time types and of
vectors) and marks its stores with store format version 3. It reads every 0.1.x file as it is:
a
.gsnapof 0.1.x loads unchanged. A store of 0.1.x (store format version 2) is refused withOlderFormatuntil it is upgraded once withgraphersal store upgrade(below); nothing is changed until you do. - There is no way back. An upgraded store, and every store or file 0.2.0 writes, is refused
by 0.1.x. 0.1.1 refuses it cleanly as "written by a newer Graphersal" in every operation.
0.1.0 does not: it refuses to open such a store, but
store infocalls it corrupt,store verifylists damage, and a newer snapshot or WAL file can make it open a store in maintenance mode and offer a repair that loses data. Replace 0.1.0 with 0.1.1 wherever a 0.2 store or backup may be seen by an older binary.
Behaviour
- A schema's
defaultis applied. In 0.1.xdefaultwas an annotation only. Now a top-leveldefaultof a label is stored when an element is created without that property, in modeopenandclosed. Check the schemas you keep before you upgrade: remove adefaultthat was only meant as documentation, or move it intodescription.set_schema,patch_schemaandvalidate_schemanow refuse adefaultthat is not a valid value of its property (a stored schema with one still loads, but creating an element would then fail its check: rung.validate_schema(g.get_schema())).diff_schemareportsdefault_changed. - Vertices and edges returned as values (#2).
to_list()/next()returnVertexValue/EdgeValuein Rust,Vertex/Edgein Rhai andgraphersal.Vertex/graphersal.Edgein Python, instead of a flat map of id, label and properties. Readv.id,v.labelandv["name"](Python:v.id,v.label,v["name"]),v.propertiesfor the map. The JSON form (playground, MCP,to_json()) is untyped GraphSON 3: a vertex{id, label, properties}, an edge{id, label, inVLabel, outVLabel, inV, outV, properties};_from/_toare gone (useoutV/inV).g.inject(v)of an element value emits the stored element and asks the authorizer for Read on Data. idandlabelas property names (#1).by("label")/by("id")read a property, as in TinkerPop: useby(T.label)/by(T.id)for the element's own.select("id")/select("label")on anelementMap()/valueMap(true)result read a property only: useselect(T.id)/select(T.label). An edge'selementMap()hasDirection.OUT/Direction.INentries.- GraphSON converts dates instead of skipping them.
g:Date,g:Timestamp,gx:Instant,gx:OffsetDateTime,gx:ZonedDateTime(zone id dropped, reported),gx:LocalDate,gx:LocalDateTime,gx:LocalTime,gx:Durationandgx:Periodbecome date and time values; 0.1.x skipped them, so the same file now yields properties that were absent before. A date-time text without an offset is refused, never read as UTC. The export writes thejava.timetags (GraphSON).
API for storage implementers (EXPERIMENTAL)
insert_*is the storage primitive,add_*applies defaults (#5). The requiredGraphStoragemethods are renamed: implementinsert_vertex/insert_edge(formerlyadd_vertex/add_edge, same arguments), which store exactly what they are given.add_vertex/add_edgeare now provided methods that fill the schema's create-time defaults and then callinsert_*; do not override them.add_vertex_with/add_edge_withtake aCreateContext(graphersal::storage: the timenow/todaystore, fromCreateContext::for_storage) and are the one override point per kind. Code that copies or replays data (imports,apply_change_set, recovery) callsinsert_*.TraversalGraph::add_vertex/add_edgeapply defaults too;insert_vertex/insert_edgeare added.graphersal-storage-testshas the new itemadd_applies_schema_defaults_insert_does_not.- New provided trait methods (defaults keep a storage compiling):
property_indexes()and the index lookups,unit_started_at();StorageCapabilities::property_indexes;MemoryStats::property_index_bytes. ElementPropertyandValueTypehave new variants (dates, vectors), andElementProperty::Vertex/EdgecarryVertexValue/EdgeValue. Downstreammatches need a_arm, as the enums are#[non_exhaustive].
Upgrading from 0.1.x
- Replace any 0.1.0 binary with 0.1.1 on machines that may meet an upgraded store or backup (see There is no way back).
- Back up the store with 0.1.x while it is closed:
graphersal store backup my_store/ backup_0_1/(or a copy of the closed directory or.gstorefile). - Upgrade it with 0.2.0, into a new store (the old one is only read):
graphersal store upgrade my_store/ my_store_0_2/, or in place:graphersal store upgrade my_store/ --in-place. The store is verified first; everything is carried, history, marks, attic and creation parameters included, and onlyGRAPHis rewritten. A backup directory stays a backup (store upgrade old_backup/ new_backup/), a ZIP backup is upgraded as it is restored (store restore old_backup.zip new_store/). In Python:graphersal.Store.upgrade("my_store", "my_store_0_2")orin_place=True. Details: Format Versions and Upgrade andstore upgrade. - Review the stored schema's
defaults (above):graphersal --graph my_store_0_2/ -e 'g.validate_schema(g.get_schema())'. - Update code that reads returned elements: maps become
Vertex/Edgevalues;by("label")becomesby(T.label)where the element's label is meant. In Python,result["name"]keeps working on agraphersal.Vertex, whileresult["id"]/result["label"]now read properties (aKeyErrorwhen there is none): useresult.id/result.label. - GraphSON files with
java.timevalues now import them as dates; a query that relied on their absence, or a schema that declared them asstring, needs a look. Packed snapshots (.gsnap) of 0.1.x need no step. - Storage implementers: rename
add_vertex/add_edgetoinsert_vertex/insert_edge, pingraphersal = "=0.2.0"andgraphersal-storage-tests = "=0.2.0", and run the conformance suite (Custom Storages).
Dependencies
jiff(time zone rules and the bundled IANA database; the only new dependency of the default build).- Feature
model2veconly:model2vec-rs(MIT),tokenizers(Apache-2.0, with the pure-Rustfancy-regexbackend: no C or C++ code) andsafetensors(Apache-2.0), with their own dependencies (ndarray,half,rayon,fancy-regex, ...). The CLI'sembed-model downloaduses theureqclient it already has andring(already in its tree through rustls) for SHA-256. rustls0.23.46 andruzstdat least 0.9.1 (RustSec advisories), as in 0.1.1.
Compatibility
- Minimum supported Rust version: 1.88.
- Python 3.10+ (abi3 wheels).
- Versioning and what is stable in 0.2.x: Releases and Versioning.