Introduction to knowledge graph service

With the ArcGIS Maps SDK for JavaScript, you can connect to a knowledge graph service. A knowledge graph service is composed of two primary resources. The knowledge graph contains entities and relationships and their associated properties. The data model defines the schema of the knowledge graph by defining the entity types and relationship types in the graph. Through the knowledgeGraphService you can search and query the knowledge graph as well as add, update and delete entities and relationships. A knowledge graph can contain spatial and non-spatial data. Any entities with geometry can be added to a map along with their connected relationships.

For addition information on working with knowledge graph services see:

Fetch knowledge graph

The knowledgeGraphService is its own module that connects to an existing knowledge graph service on ArcGIS Enterprise. The first step is to load the knowledge graph module and fetch the knowledge graph.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require([
  "esri/rest/knowledgeGraphService"
], (knowledgeGraphModule) => {

  //define url to knowledge graph service
  const url = "https://myHostName.domain.com/arcgis/rest/services/Hosted/myServiceName/KnowledgeGraphServer";

  //fetch knowledge graph
  KnowledgeGraphModule.fetchKnowledgeGraph(url)
  .then((kg) => {

    //view the knowledge graph data model in the console
    console.log(knowledgeGraph);
  });
});

Once you have loaded a knowledge graph, use executeSearchStreaming() and executeQueryStreaming() to retrieve specific records, or executeApplyEdits() to add, update, or delete records from the graph.

Additional topics

Search and query a knowledge graph

Learn how to search and query a knowledge graph.

Edit knowledge graph data

Learn how to add, edit and remove records from a knowledge graph.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.