Creating and Adding Data to Esri Knowledge Graph

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2023.0


In FME 2021.2, we have added a new reader and writer to allow you to work with Esri Knowledge Graph in FME. In this tutorial, we’ll walk through creating an Esri Knowledge Graph database within ArcGIS Pro; then, we will move to FME Workbench to add data. In the next tutorial, we will create relationships between the entities. 


  • FME Form 2023.0 +
  • ArcGIS Pro 3.1+
  • ArcGIS Enterprise 11.1+ (Hosted Esri Knowledge)


Step-by-step Instructions

Part 1: Create Esri Knowledge Graph In Esri ArcGIS Pro

1. Launch Esri ArcGIS Pro
In ArcGIS Pro, sign in to your portal, then create a new Catalog project. On the Ribbon, click on the Catalog tab, then under New, create a New Investigation. 
Step 1.jpg

2. Create a Knowledge Graph
In the Create Investigation wizard, on the Define Investigation page, enter MovieDatabaseDemo as the title, then enter a Summary. Select Create a new Knowledge Graph Item in the portal, then click Next. 
Step 2 CreateInvestigation_1.jpg

Now on the Define Knowledge Graph page, enter MovieDatabase_<yourname> as the Title, then enter a summary. If you are working with spatial data, please click Next, and select the coordinate system for your graph data. For this tutorial, we use non-spatial data; we will click Finish and complete the step.
Step 2 CreateInvestigation_2.jpg


Part 2: Add Data to Esri Knowledge Graph in FME Desktop

3. Create Knowledge Graph Database Connection in FME Desktop
In a web browser, log in to Esri ArcGIS Portal. Navigate to My Content and click on the Knowledge Graph title (MovieDatabase_<yourname>). At the bottom of the page, copy the Rest URL. 

Open FME Workbench and start a blank workspace. On the top menu bar, click on Tools > FME Options. In the FME Options dialog, navigate to Database Connection, then click on the plus sign “+” to add a new database connection. 
Step 3.jpg

In the Add Database Connection dialog, enter the following:

  • Database Connection: Esri Knowledge Graph
  • Name: MovieDatabase_<yourname>
  • Server: Paste in the copied Rest URL from ArcGIS Portal
  • Username: admin
  • Password: <enter your password>

Then click Test. After you have confirmed your configuration was successful, click Save. 

4. Read in Movie Data
Now we will read the data from another format we want to use in our database. Add a Comma Separated Value (CSV) reader to the canvas and browse to the movies.csv dataset, which is available to download from the Files section of this article. In the parameters, change Feature Type Name(s) to From File Name(s), then click OK twice to finish adding the reader. 
Step 4 ReadCSV.jpg
Step 3 ReadCSV_2.jpg

5. Verify Data in Visual Preview
Click on the movies reader feature type to open the popup menu, then click the "View Source Data" button to view the data in Visual Preview. Also, note that there are duplicate countries, but we will handle this later. 

In Visual Preview, we can confirm that the data was read correctly. We will use the column "country" to create a separate entity. 
Step 5.jpg

6. Write to Esri Knowledge Graph
Add an Esri Knowledge writer to the canvas and select the MovieDatabase_<yourname> Database Connection. Then ensure that Copy from Reader is selected for the Feature Class or Table Definition, and click OK. 

Connect the "movies" reader feature type to the "Movies" writer feature type. Double-click to open the writer parameters. In the parameters, change the capitalization of Movies, then confirm that Geometry is set to kg_nonspatial_entity. Since "id" is unique in this case, there should not be any duplicates. 
Step 6 Movies.jpg

Next, switch to the User Attributes tab, and set the id type to integer. The data types are determined after scanning features, but we would like to handle larger data types for advanced workflows. Click OK to save the parameters. 
Step 6 UserAttr.jpg

7. Create Country Entity
Now we want to create a country entity. Right-click on the movies reader feature type, then select Duplicate on “MovieDatabase_<yourname> [ESRI_KNOWLEDGE_GRAPH]. 

For this entity, we only require the country attribute. Add an AttributeManager to the canvas and connect it between the movies reader feature type and the movies writer feature type (Note, it will be movies00 if you forgot to change the case of Movies in the previous step). 

Open the AttributeManager properties and perform the following operations. 
Remove attributes id, title, and year
Rename "country" to "name." 
Step 7 AttManager.jpg

8. Remove Duplicate Countries
In Step 5, the table shows entries with the same country name for multiple movies. In this step, we will filter those and create an entity with unique country names.  Add a DuplicateFilter to the canvas and connect it between the AttributeManager and the movies writer feature type. In the parameters, set the Key Attribute to the "name" and click OK. 
Step 8 DupFil.jpg

9. Rename movies to Country
Open the movies writer feature type and change the Feature Class or Table Name to Country, then confirm that the Geometry is kg_nonspatial_entity. 
Step 9 Country.jpg

Next, switch to the User Attributes tab, set the Attribute Definition to Automatic, then click OK. 
Step 9 UserAtt.jpg

10. Load Persons Data
Next, let’s add one more table to our database. Add a CSV reader to the canvas and select the persons.csv dataset(attached to this tutorial). In the parameters, set Feature Type Name(s) to From File Name(s), then click OK twice to add the reader. 

11. Write Persons Data
On the top menu bar, go to Writers > Add Feature Type, this will add another table to our Knowledge Graph database. 

In the Feature Type dialog, type Persons as the Feature Class or Table Name, then set the Geometry to kg_nonspatial_entity. 
Step 11 FeatType_geom.jpg

Connect the "persons" reader feature type to the "Persons" writer feature type. Double-click on the writer (Persons) feature type parameters. 
In this dialog, switch to the "User Attributes" tab, change the "Attribute Definition" to "Manual."
Set the attribute "id" to type "integer."  
Step 11 UserAttr.jpg

10. Save and Run Workspace
Save your workspace, and run the workspace using the "Run" button. 
Step 10.jpg

In the log file, confirm that 4 countries, 7 movies, and 9 persons were written to Esri Knowledge Graph. 

11. Continue to the Next Article
Continue to the next article to learn how to create relationships between entities. 

Was this article helpful?



Please sign in to leave a comment.