Artefact (Artefact v0.1.1)

Copy Markdown View Source

A knowledge graph fragment — a small, self-contained piece of knowledge expressed as a property graph.

The canonical form is the %Artefact{} struct. Arrows JSON and Cypher are derived representations: JSON for interchange and visual editing, Cypher for persistence.

Summary

Functions

Compose two artefacts into one. Graphs are concatenated without merging. Nodes remain disjoint; label-based relationships are implicit.

Harmonise two artefacts using declared bindings.

Create a new Artefact. Defaults base_label and title to the short name of the calling module. Override with title: or base_label: in attrs.

Types

t()

@type t() :: %Artefact{
  base_label: String.t() | nil,
  graph: Artefact.Graph.t(),
  id: String.t(),
  metadata: map(),
  style: atom() | nil,
  title: String.t() | nil,
  uuid: String.t()
}

Functions

compose(a1, a2, opts \\ [])

(macro)

Compose two artefacts into one. Graphs are concatenated without merging. Nodes remain disjoint; label-based relationships are implicit.

base_label defaults to the portmanteau of both artefacts' base_labels. Override with base_label: or title: in opts.

Records :composed provenance with the calling module and the metadata of both source artefacts.

harmonise(a1, a2, bindings, opts \\ [])

(macro)

Harmonise two artefacts using declared bindings.

Bound nodes are merged: lower uuid wins for identity and properties, labels are unioned. All relationships are preserved and remapped. Returns a new artefact with a portmanteau base_label unless overridden.

Records :harmonised provenance with the calling module and the metadata of both source artefacts.

new(attrs \\ [])

(macro)

Create a new Artefact. Defaults base_label and title to the short name of the calling module. Override with title: or base_label: in attrs.

Records :struct provenance with the calling module.