In this Session…
Before you begin…
To follow along, download the ﬁles: https://kineviz.com/s/GXR_QSG.zip
How To GraphXR 14. Data Mapping
Before You Begin…
Ideally, you’ll have worked through Module 13. Querying. If you’re starting here, and you want to follow along, you’ll need to:
If you regularly work with CSVs sharing a common data structure, you’ll likely want to apply the same graph schema repeatedly. You can do this with a CSV mapping. Clear the graph space, then open the Query panel and CSV tab.
Click Load CSV, navigate to the Lines.csv ﬁle in your Game of Thrones dataset (GXR_QSG.zip) and select it.
The number of rows and columns in Lines.csv is displayed and a preview of the file is displayed below.
Click New to open the Mapping Editor and create a new mapping for this data. We’ll use it to define the graph pattern:
As a brief aside: we’re mapping a CSV here, but the Mapping Editor can also be used to model data from a table in a connected SQL database.
The Mapping Editor opens with a single category icon in place. For our model we need two categories connected by a relationship. Select Add Edge, click the category icon and drag. This adds the edge and a second category icon in one step.
Now that we have our two categories connected by a single relationship, we’ll rename them and select columns from the CSV that will become properties.
Click the Category1 icon, and in Category Name, enter “Words”. Add its properties by selecting from the menu or clicking the + icon. We’ll add wordCount and speaker.
Click the Category2 icon and in Category Name enter “Episodes”. Click to add the seasonEpisode property. We can rename properties–we’ll just call it episode. Click As Key to create a single node for each unique value of the property.
Now click the relationship icon. It has been assigned a default name based on the initial source and target categories.
In Relationship Name, rename the relationship SPOKEN_ON. We could also add and rename properties, but for this model we don’t need to.
Once you are satisﬁed with your mapping, click the Save As icon to enter a name for new mapping and save it. (Use Save and Exit for an existing mapping you’ve edited.)
Click the Export Schema icon to export the mapping as a JSON file. This saves it on your local system, and from there you can import it to any GraphXR project.
When you save, the Mapping Editor window closes and the mapping appears in the Mapping dropdown menu. Click Apply to apply it to our Lines.csv data.
You can edit any mapping to add, remove, or rename categories, relationships, or properties. Select it in the Mapping menu and click Edit to open the Mapping Editor.
The mapping remains in the project’s Mapping menu unless you delete it. To import a mapping, click Import, navigate to the local JSON file and select it.
Congratulations! By completing this learning series, you’re well on your way to mastering GraphXR! We cordially invite you to join the Kineviz Community to share questions, insights and enthusiasm!
Congratulations! You’ve now completed basic hands-on training for GraphXR!
Join the GraphXR community, to watch for new developments in GraphXR and its use.
Check out the Gallery.