Skip to content

CGEF import and merge

Import external graph data in the Codeweb Graph Exchange Format and merge it with locally analyzed stores.

Why CGEF

CGEF (Codeweb Graph Exchange Format) is the JSON format for graph data produced outside of codeweb — for example, call relationships of a private ERP system whose source cannot be scanned. Import it as a standalone store, merge it with local analysis, and trace chains across the boundary.

Document structure

A CGEF document is a JSON file with these top-level fields:

{
  "format_version": 1,
  "metadata": {
    "source": "erp-system",
    "generated_at": "2026-04-28T10:00:00Z"
  },
  "node_schemas": {},
  "edge_schemas": {},
  "nodes": [],
  "edges": []
}
FieldRequiredMeaning
format_versionyesFormat version; currently 1
metadatayessource identifier and ISO 8601 generated_at
node_schemasnoDeclarations for custom node types
edge_schemasnoDeclarations for custom edge types
nodesyesNode array (may be empty)
edgesyesEdge array (may be empty)

Standard node types cover all built-in codeweb objects (procedure, function, table, view, mapped_statement, java_method, java_class, java_sql, package, trigger, type, sequence, index, materialized_view, …). The full per-type key fields are specified in the CGEF user guide and the JSON Schema.

Custom types

Node or edge types that have no built-in equivalent are declared in node_schemas / edge_schemas (display name, key fields, property definitions). Their edges import as CustomEdge and their nodes with tag custom, so they behave like first-class nodes in trace, impact, and export.

Import

codeweb import --file enterprise-graph.json --output erp-store.bincode
codeweb import --file enterprise-graph.json --output erp.json --prefix "/opt/erp/src" --name "erp"
codeweb import --file broken.json --output erp.bincode --force
FlagMeaning
--fileCGEF JSON input
--outputOutput store: .bincode or .json
--prefixPath prefix prepended to all relative file paths
--nameProject name for the imported store
--forceImport even when validation or parse errors are found

Merge

codeweb merge -o full-graph.bincode my-project.bincode erp-store.bincode
codeweb merge -o full-graph.bincode --name "combined" my-project.bincode erp-store.bincode

Merging deduplicates nodes and edges across stores, so the same table analyzed locally and imported via CGEF collapses into one node. The merged store behaves like any local store for trace, serve, and export.

View the full guide

The Chinese guide docs/cgef-user-guide.md walks through a complete worked example, including the OP Excel lineage converter (lib/op-lineage.py).