In Neo4j Bloom, a Perspective defines a certain business view or domain that can be found in the target Neo4j graph. A single Neo4j graph can be viewed through different Perspectives, each tailored for a different business purpose.
Within a graph there are often multiple smaller graphs which are connected to each other. Sometimes you need to see everything. Other times it’s helpful to have a more focused view. Defining a Perspective allows you to select what parts of the graph to show and how to show them.
Let’s use the Northwind example data set. Northwind is a fictional company with a database that tracks their product catalog, sales orders, and sales staff.
When importing Northwind directly into a Neo4j graph there is a 1:1 correspondence of tables to labels, which means that for each record a node has been created with a label that matches the original name of the table. Each foreign key reference gets converted into a graph relationship.
After starting this Neo4j database and launching Bloom, you’ll be prompted to select a Perspective. If you have any previously defined Perspectives, they will be available for selection. Otherwise, you can ask Bloom to auto-generate a Perspective. That’s a good place to start. Bloom will categorize the nodes into entities, select useful captions and assign color-coding.
You’ll be able to search and explore the entire Northwind graph.
While everyone in the organization could benefit from a graph view, not everyone needs to see everything. For instance, the shipping department of Northwind may only need to see orders, products, and customers. You can create another Perspective that highlights only those categories.
Similarly, you can create Perspectives that are specific to the sales department, purchasing department, or customer service department.
Perspectives can be selected or created from the Perspective gallery. There are two options when you opt to create a new Perspective:
Generate Perspective - With this option, Bloom will analyze the labels within the graph, identifying the smallest number of labels that uniquely categorize all nodes. Bloom will then create the perspective and auto-fill in the requisite category definitions, choose properties for captioning categories, populate list of available relationship types, and set default styles. Once created, the Perspective definition can be edited and reconfigured differently at any time.
When Bloom connects to a database for the first time, auto generating the Perspective might be the best option in most cases.
Blank Perspective - With this option, you can build a Perspective from scratch by defining each category and configuring properties and styling for it. Bloom will still add the list of available relationship types.
Choose this option when you have a large number of labels in the data, but your Perspective only needs to contain a small subset of them. It will be more efficient to create the Perspective manually rather than auto-generating it and reconfiguring to remove many categories.
The Perspective designer is shown above. In this designer, you can specify Categories, Relationships and Search phrases for a Perspective.
Within a Perspective, a category defines each business entity – Person, Place or Thing – which will be visible through the Perspective. Typically, a single graph label will map to a particular category, but multiple labels may also be mapped to a single category.
When you create a category, Bloom analyzes the graph to find the related properties and other labels that occur on nodes that have the category-defining label. You can then choose which properties should be excluded from the visualization, and which to use for captions inside of nodes. Bloom will assign a default color for the category, but you can change the default color and node sizes from the Legend panel. You can also give the category an icon from an extensive library of searchable icons. Rule-based styling can also be applied at any stage.
If a node has multiple labels, and the labels are mapped to different categories, the category which is defined first in the
Perspective definition will be used by Bloom for that node.
Hence the styling of the node will be driven by the first category to which any of its labels are mapped.
For example, if Tom Hanks has the
Based on the Perspective’s purpose, it may be useful to limit the relationship types that are available for user exploration. The Perspective designer lets you choose one or more relationship types from the list of available types in the graph, and hide them. By default, all relationship types are visible.
Similar to category styling, relationship type styling options for color, thickness, and rule-based styles are available in the Legend panel.
Search phrases are defined and scoped for a particular Perspective, as they usually apply to a specific business view of the graph. These are defined in the Perspective designer as well, and stored with the rest of the Perspective definition. See Search phrases for advanced queries for how to define Search phrases.
When the Bloom Client is used without the Bloom Server, Perspectives are stored locally on the user’s machine. The location depends on where Neo4j Desktop is installed on the user’s machine. In this setup, Perspectives cannot be shared between different users.
When the Bloom Server is used, Perspectives are stored in a persistent storage provided by the server plugin. Therefore, they can be easily shared between different users who are accessing the same server. Sharing and security of Perspectives is controlled using database roles and follows the following rules:
Perspective sharing can also be explicitly controlled using a Sharing tab in the Perspective definition drawer. The Perspective gallery can be found from the Settings drawer.
Only users who have the ability to list database roles have access to this tab and thus control over explicit sharing of Perspectives. The best practice for assigning Perspectives is to create a custom role for each Perspective, and add that role to each user who should have access to the Perspective in question.
An admin user has explicit control over the sharing of Perspectives, even if a particular Perspective was created by a publisher or architect. The best practice for assigning Perspectives is to create a custom role for each Perspective, and add that role to each user who should have access to the Perspective in question.
Perspective Export and Import
You can also export the Perspective definition in a serialized json file format. This is useful to either save the definition as of a certain time, or to migrate Perspectives between different environments. The json file can then be imported using Bloom connected to the same or a different database.
Both exporting and importing a Perspective can be done from the Perspective gallery.
Users that have write access to the database, i.e. users that can create Perspectives, also have the ability to export and import Perspectives.
In Bloom 1.3.2, there is an experimental feature to export all Perspectives. It can be accessed from the Experimental drawer.
As discussed in Section 3.3, “Bloom deployment modes”, you can either connect to a Neo4j DBMS that uses the Bloom server plugin or one that does not. The deployment option you choose affects the Perspective gallery in different ways.