graphlife Docs graphlife.app

Graph data

2. Data model primer

A graph is a set of nodes connected by edges. Each graph is stored on the server as its own database file. Two storage tiers exist:

Tier Meaning What the API can do
cloud_readable The server stores the graph in readable form. Everything in this document. This is the tier the live endpoint, search, questions and extraction work on. Graphs that belong to an organisation are always in this tier.
cloud_sealed The server stores one encrypted blob it cannot read. Store and fetch the blob (section 3.6). No search, no live operations.

2.1 Nodes#

Field Type Description
id string Unique identifier, assigned by the server on creation.
kind string One of six coarse kinds: individual, place, event, concept, document, other.
label string The display name.
props object Free-form properties (called attributes in write operations). See below.
validFrom, validTo string or null When the thing the node describes began and ended, as YYYY, YYYY-MM or YYYY-MM-DD.

Three property keys have a defined meaning:

Property Meaning
subtype The fine-grained type. The built-in subtypes are person, pet, object, asset, org, place, event, job, education, project, health, symbol, page, document, file, codebase. Other values are accepted and stored as given. Access rules that filter by type match on subtype, not on kind.
description A one-line summary of the node.
text Long-form prose written on the node: paragraphs, notes, an article. Paragraphs are separated by blank lines. text is what search_prose searches and what is quoted as a passage in a context or an answer. Do not put long prose in description.

When you create nodes with add_to_graph you may name the fine-grained type as the kind (for example person or org). The server stores the matching coarse kind and writes the word you sent into props.subtype:

You send kind Stored kind
person, pet, object, asset, org, individual individual
place place
event, job, education event
project, health, symbol, concept concept
document document
other other

page, file and codebase cannot be created through add_to_graph: an entity with one of these kinds is skipped and reported in rejectedEntities with the reason unknown_kind, while the rest of the request is applied. Any other word that is not in the table refuses the whole request with 403 kind_out_of_scope, and nothing is written.

An entity may also carry attributes.subtype. When it does, that word is stored as the subtype in place of the kind you sent, unless it is page, file or codebase, in which case it is ignored.

Inside prose, [[Name]] is a link to the node with that label or alias. The server maintains mentions edges from the linking node to the nodes it names.

2.2 Edges#

An edge has an id, a source node (src), a destination node (dst), a type, optional properties, and optional validFrom / validTo dates.

Edge types that can be created through the API
met_at, worked_at, located_in, introduced_by, owns, attended, authored, held, at_org, at_place, participant, same_as, related_to, parent_of, sibling_of, spouse_of, partner_of, studied_at, member_of, lived_in, traveled_to

related_to is the general-purpose type for any relationship the typed ones do not cover. It requires a predicate property holding the verb (for example "mentored", "supplies"). Read operations return that verb in a predicate field.

Five further types exist and are maintained by the server only: mentions (rebuilt from prose on every save) and contains, imports, defines, calls (written by code indexing). The add_edge operation accepts same_as; add_to_graph relations do not.

sibling_of, spouse_of, partner_of and same_as are symmetric: direction carries no meaning. parent_of runs from parent to child.

2.3 Groups and visibility#

A group is a named, coloured set of nodes inside one graph. Groups are the unit of sharing: a credential sees a node when its scope and the node's group membership intersect. A node may belong to up to 32 groups, one of which is its primary group.

What a credential may see of one node is one of three outcomes:

Visibility What is returned
Full The node with its label and properties, minus any property the key's scope redacts.
Listed An existence stub: id, kind, a label with identifiers masked, and "withheld": true. For a document, its doc_type is also kept. No other properties, dates or files.
Hidden Nothing. The node is absent from every result, every count and every path.

An edge is returned only when both of its ends are visible. A path is returned only when every node on it is visible.

On a graph that belongs to an organisation, nobody reads everything by default, not even an owner or administrator: each member reads the groups they hold. A node in no group is readable by nobody on such a graph.

2.4 Deletion and history#

Deleting a node or an edge through the API is a soft delete: the row is retracted, not removed, and can be restored with restore_node or restore_edge. The API offers no hard delete of a single node or edge. Soft-deleted rows are not returned by any read operation and are not included in a graph export (section 3.5).

Every change to a readable graph increases its revision, an integer that starts at 1. Write responses return the new revision, and the change feed (section 6) reports what changed since a revision.

2.5 Documents and captures#

A document is a file (PDF, image, and so on) attached to a node. The node lives in the graph; the bytes are stored beside the graph, unencrypted, and are transferred as base64 inside JSON.

A capture is a piece of raw text kept verbatim as a source, without extracting anything from it. It is not a node.