You can pull data directly from a Neo4j graph database connected to a GraphXR project. The data will include its current schema, that is, its defined categories, relationships, and properties. You can pull data in the following ways:

  • Enter and run a Cypher query in the Cypher tab of the Query panel.

  • Enter a keyword search of node properties in the database and pull the resulting nodes.

  • Pull nodes or edges 25 at a time by selecting a category or relationship in the respective tab in the Project panel and clicking Pull.

  • Use Expand in the context toolbar to pull data connected by specified relationships to selected nodes in the graph.

GraphXR also includes the Visual Query Builder extension for no-code Cypher queries using visual building blocks. This lets you access Cypher’s most commonly used pattern matching capabilities without needing to learn Cypher code.

Import using a Cypher query

Cypher is a query language for graph data developed in tandem with Neo4j. It has become a standard for querying graph databases. Basically, a Cypher query returns graph data that match a specified graph pattern. Cypher also includes complex selection, transformation, and graph database maintenance functions.

For information about Neo4j and the Cypher query language, refer to Neo4j’s For Beginners - Cypher Query language and the Neo4j Cypher Manual.

In GraphXR, the Cypher tab of the Query panel lets you:

  • Enter a Cypher query and click the play icon on the right to run it.

  • Save a query by clicking the + (plus) icon. The saved query appears on a drop down menu.

  • Run a saved query by selecting it on the drop down and clicking the play icon.

All GraphXR projects include a basic query that pulls the first 100 connected nodes from the database:

MATCH (n)-[r]-(m) RETURN * LIMIT 100

This query will MATCH any pattern of nodes n and m connected by any relationship r, and RETURN the first 100 found. The LIMIT is set because this query will likely return a large amount of data.

You can also limit the number of returns in the Maximum return records allowed text box.

A more specific, but still very basic query for categories and relationships of interest is the following query for Game of Thrones data with the pattern (Characters)-[belongs_to]-(House):

MATCH (c:Characters)-[r:belongs_to]-(h:House) RETURN *

This query will MATCH any pattern of Characters and House nodes connected by a belongs_to relationship and RETURN all the matching graph patterns. The variables c, r, and h are used here to simplify further query specifications.

To import data using a Cypher query:

  1. Click the Query panel icon. It opens with the Cypher tab displayed.

  2. Either enter a Cypher query or select a saved query using the drop down arrow.

  3. Click the Load Inner Relationship checkbox to include the relationships between the nodes pulled by a query.

  4. Click the play icon to query the connected database.
    The data appear in the graph space as nodes and their connecting edges.

  5. Click the + (plus) icon to save a new query or to save one that you've edited.

Pull data by keyword search

You can use the search field at the top right corner of the graph space to pull data using a keyword search term. The icon at the right of the search field lets you toggle between Searching from Database or Searching from Graph, to search the data already in the graph space.

To search a Neo4j database, the search terms must first be indexed in the database. To review and edit search terms, click the Config Search Index icon to the right of the database icon, to display the APOC Search Index Configuration page.

To pull data using a keyword search:

  1. Enter a keyword in the search bar at the top left corner of the graph space, and press return.

    A list of data matching the search keyword appears below the search field in alphabetical order by category.

  2. Click the arrow to the left of a category to view the itemized results.

  3. Click an entity from the list to add its node to the graph space,
    Click the + icon to the right of the label to add all the items in that list.
    TIP: When you add data, the nodes remain selected in the graph space until you add more data. If you want to immediately remove the data you just pulled, you can press delete while these nodes are still selected.

  4. Click the x in the search bar to clear the search and return to the graph space.

Pull data by Category or Relationship

You can pull 25 nodes at a time from a category or relationship that appears in the Category or Relationship tab of the Project panel.

This may be useful for initial data exploration; however a query provides more control of sampling.

To pull data by Category:

  1. Click the Project panel icon and Category tab.

  2. Click one of the Category items to select it.

  3. Click Pull to pull 25 nodes associated with that category, and any edges that connect the nodes.

  4. For added samples, click again, as many times as you want.

To pull data by Relationship:

  1. Click the Project panel icon and Relationship tab.

  2. Click one of the Relationship items to select it.

  3. Click Pull to pull 25 edges associated with that relationship, the connected nodes, and all the other edges connected to those nodes.

  4. For added samples, click again, as many times as you want.

Pull data using Expand

The Expand icon in the context toolbar menu lets you pull additional data which is connected to a selected node or group of nodes in the project the graph space.

To pull data using Expand:

  1. Select one or more nodes in the graph space, then click the Expand icon to display the Expand with relationships dialog.

  2. Click the checkbox next to a relationship name to pull nodes and edges connected by that relationship.
    Click All to pull nodes and edges with all relationships to the selected nodes. To limit the number of nodes, enter a number in the Limit field.

  3. Set additional options for expanding the graph:

    - Click the Only among selected nodes checkbox to expand relationships only for the selected nodes.
    - Specify Directional relationships using the dropdown menu.
    - Increase Repeat relationship times, which automatically repeats the expand operation, enabling you to pull in the limit of 1000 edges repeatedly.

  4. Click the Expand button.

    An Expand Next Page dialog indicates the number of items successfully expanded. You can
    - Click Expand More to pull the next 1000 connected items. This lets you pull in all the data in the database that have the specified connections without needing to return to the Expand with relationships dialog.
    - Click Cancel (or simply click the X at the upper right) to close the dialog.

    If no additional nodes are connected to the selected nodes by the specified relationships, a message displays that all relationships are expanded.

    Additional nodes and their relationships are pulled into the graph. In the example below, All relationships were selected, and additional nodes with edges connected to the selected Character and House nodes were pulled from the Neo4j database.