How to GraphXR
14. Data Mapping
In this Session...Before you begin...
* Using GraphXR's Mapping Editor to model tabular data (CSV) as graph data.To follow along, download the files: https://kineviz.com/s/GXR_QSG.zip (opens in a new tab)
Slide
1How To GraphXR 14. Data Mapping
2Before 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:

* Log in to GraphXR and open a project., Download https://kineviz.com/s/GXR_QSG.zip (opens in a new tab), which contains the Game of Thrones data we're using in this tutorial series.
3If 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.
4Click Load CSV, navigate to the Lines.csv file in your Game of Thrones dataset (GXR_QSG.zip) and select it.
5The number of rows and columns in Lines.csv is displayed and a preview of the file is displayed below.
6Click New to open the Mapping Editor and create a new mapping for this data. We'll use it to define the graph pattern:
(Words)-[SPOKEN_ON]-(Episode)
and map wordCount, speaker, and seasonEpisode columns as properties.
7As 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.
8The 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.
9Now 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.
10Click 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.
11Click 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.
12Now click the relationship icon. It has been assigned a default name based on the initial source and target categories.
13In Relationship Name, rename the relationship SPOKEN_ON. We could also add and rename properties, but for this model we don't need to.
14Once you are satisfied 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.)
15Click 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.
16When 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.
17You 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.
18The 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.
19Congratulations! By completing this learning series, you're well on your way to mastering GraphXR! We cordially invite you to join the Kineviz Community (opens in a new tab) to share questions, insights and enthusiasm!

Next Steps...