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.
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:
Click the Query panel icon. It opens with the Cypher tab displayed.
Either enter a Cypher query or select a saved query using the drop down arrow.
Click the Load Inner Relationship checkbox to include the relationships between the nodes pulled by a query.
Click the play icon to query the connected database.
The data appear in the graph space as nodes and their connecting edges.
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:
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.
Click the arrow to the left of a category to view the itemized results.
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.
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:
Click the Project panel icon and Category tab.
Click one of the Category items to select it.
Click Pull to pull 25 nodes associated with that category, and any edges that connect the nodes.
For added samples, click again, as many times as you want.
To pull data by Relationship:
Click the Project panel icon and Relationship tab.
Click one of the Relationship items to select it.
Click Pull to pull 25 edges associated with that relationship, the connected nodes, and all the other edges connected to those nodes.
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 that is connected to a selected node or group of nodes in the project the graph space.
To pull data using Expand:
Select one or more nodes in the graph space, then click the Expand icon.
In the Expand with Relationships dialog that displays,
Click the checkbox next to a relationship name to pull nodes and edges connected by that relationship, OR
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.
Additional nodes and their relationships are pulled into the graph. In the example below, All relationships was selected, and additional nodes (of the categories Scene, Death, etc.) with edges connected to the selected Character nodes were pulled from the Neo4j database.
If no additional nodes are connected to the selected nodes by the specified relationships, a message displays that all relationships are expanded.