The Extract transform lets you generate nodes and edges belonging to new or existing categories and relationships, based on one or more source properties.
Examples use the open-source dataset for the HBO series Game of Thrones. For a hands-on exercise, see our How to GraphXR tutorials.
The Characters.csv file tabulates information about each character in the series, the name and the house they belong to. Importing CSV file assigns all the data to a single default Characters category, but we’d like to extract a separate House category for the family each character belongs to.
We can extract a houseName property from Character nodes, and use it to create both a House category and a new belongs_to relationship linking House nodes to the original Characters nodes.
To extract a new category and connecting relationships:
In the graph space, de-select the data to extract from the entire data set.
NOTE: If you select nodes, Extract operates on only those elements. With nothing selected, transformations affect the whole graph.
Open the Transform panel and Extract tab, and enter the following details:
• In the Extract From Category menu, select Characters.
• In the Create Relationship textbox, enter BELONGS_TO.
• In the Create Category textbox, enter House.
• In the Create Label From Properties area, select the houseName property from the menu (or click the + (plus) icon next to its name in the table below) to add it to the Selected Property list.
NOTE: Properties in the source data are listed alphabetically in the scrollable list of properties. A sample of data displays below the property names, showing property values and data formats.
The selected property name appears in the New Property Name text box. Leave it unchanged for this example.
Click the Key checkbox to set houseName as a key, so that a single node will be created for each unique value of houseName, rather than a separate one for every source node.
NOTE: If the property value is a list and not a single value, you can click the Split checkbox to create a separate node for each value in the list. Otherwise, a single node will be created with only the first value in the list.
Optionally, you can specify additional details for the extracted nodes:
• Click SkipEmpty to extract the specified pattern only when the source property is present and its value is non-null. For example, the (Character)-[BELONGS_TO]-(House) pattern will be created only for Character nodes that include a houseName property and value. With Skip Empty unchecked, all the “empty” Character nodes are connected through BELONGS_TO edges to a new House node, and GraphXR assigns its houseName property a value of “ _other”.
• Click Inherit Links to copy any edges connected to the original category to the new extracted category. For this example we’ll leave it unchecked.
The legend displays the new House category, and its nodes appear in the graph space.
The new BELONGS_TO relationship links each of the Character nodes to their respective House node.