Skip to content

User guide

These pages are executed notebooks: each one is a runnable tutorial, and the outputs you see are real. Most of them run offline against the models in tests/test_models/. The database pages need that database running (Docker setup is on each page). To run a notebook yourself, open it from docs/ in a checkout; the "edit" button at the top of a page links to its source.

Start here

  1. Overview and quick start: the whole library in one notebook.
  2. Installation: pip install cim-graph and the database extras.
  3. CIM profiles: which CIM classes you get, and how to pick a profile with CIMG_CIM_PROFILE.

Find what you need

You want to Read
create objects and follow associations Objects, identity and associations
set and read physical quantities Units
change a model and record the difference Editing a model
load a distribution feeder Feeder model
load a substation or an EMS model Node-breaker model
load a planning (bus-branch) model Bus-branch model
split a model into areas Distributed areas
read a CIM XML or JSON-LD file CIM XML files, JSON-LD files
query a triple store or graph database Choosing a connection
configure namespaces, identifiers or credentials Environment variables
save a model Writing files
fetch everything in one call Loading all data
draw a class or object diagram Mermaid diagrams

The three ideas

A profile. CIMG_CIM_PROFILE picks a module of CIM dataclasses from cim-profiles. That profile decides which classes, attributes and enumerations exist; nothing else does.

A connection. XMLFile, JSONLDFile, BlazegraphConnection and the rest are interchangeable: each one fetches CIM objects from its source and creates them as dataclass instances.

A graph model. FeederModel, NodeBreakerModel or BusBranchModel holds the objects, starting from a container. network.graph[cim.ClassName] is a dict from UUID to object, and get_all_edges(cim.ClassName) expands it by one association.