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, it’s useful to be able to apply the same graph schema every time. This is accomplished by 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. For this example, we’ll define the graph pattern:
(Words) - [spoken_on] - (Episode) and map wordCount, speaker, and seasonEpisode columns as properties.
In the Mapping Editor, click Add Category to deﬁne a category named Words based on data in the csv. In the Category name, enter Words. Now add its properties by selecting from the menu or clicking the + icon. We’ll add wordCount and speaker.
Click Add Category again to add an Episode category and seasonEpisode property. We can rename properties, so we’ll just call it episode. Click As Key to have a single node created for each unique value of the property. Now let’s add a relationship.
Click the Add Relationship icon. Now click the source category (Words), then the target category (Episode). The relationship is created and given a default name based on the source and target you chose (Words_Episode). .
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, use Save As to enter a name for new mapping and save it. Use Save for an existing mapping you’ve edited.
You can also Export the mapping as a JSON file for use in other GraphXR projects.
When the mapping is saved, the editor window closes and the mapping appears in the Mapping dropdown menu. Click Apply to apply it to the CSV that you’ve loaded.
We’ve now applied our data mapping to the Lines.csv data.
Data can also be mapped and loaded from a relational database using SQL, from ﬂat JSON ﬁles, or by using Gremlin.
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.