Import and merge Neo4j graph models
File → Import… takes a model as JSON, a file, or a dropped file, and a list of names, and either opens it as a new model or adds it to the one that's open. When two models have nodes with the same labels, you decide whether they become one.
Ways in
- Paste a model's JSON into the Import dialog, or Choose file….
- Drop a JSON file anywhere in the window. If the open model is blank, the file opens directly, in a layer named after the file; otherwise the Import dialog opens with the file's contents filled in so you can choose what to do.
- Paste a list of names, one per line or cells copied from a spreadsheet, into the dialog or straight onto the canvas with ⌘V. Each name becomes a node with that label, laid out like the cells, in a layer called "Pasted names".
- Neo4j database: the results of two queries; see Draw an existing Neo4j database.
JSON that isn't a model is refused with a message. Every import follows the Neo4j casing rule for labels, types, and keys.
New model or add to the open one
Open as a new model opens the import on its own; the model that was open is saved first and stays in My models. Add to the open model puts the imported nodes to the right of what's there, selects them, and glides the view to the whole model. Either way the import gets a layer of its own, named in Layer for this import (blank means the imported model's name), and the imported model's own layers don't come along.
The merge question
If nodes have the same labels, within the file, in the open model, or between them, toro4n asks "Merge nodes with the same labels?" and lists them (both spellings, if they differ only in case). Merge combines each group into one node with all of its properties and relationships. Keep separate leaves every node as it is and marks the duplicates with a red ring. If nothing shares labels, there's no question. Nothing is ever merged without asking.
What merging does
- Nodes with the same label combination become one; nodes without labels never merge.
- The open model's properties keep their order (the topmost is the caption), new properties are added last, and an empty type or example is filled in silently.
- Relationships of the same type between the same merged nodes become one; the others are added and repointed.
- A unique or required rule that exists in either model applies.
- Attached notes follow what they're attached to.
- A node that received an imported node is also added to the import's layer, so hiding the layer hides everything the import changed.
Reviewing differences
If the same property has a different type or example in the two models, nothing is changed silently: the dialog shows a review step with one row per difference, and you choose Keep (the default) or Use imported for each, or Keep all / Use all imported. The whole import is one undo step.