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:
- Get started with ArcGIS Knowledge Server for overview of ArcGIS Knowledge for ArcGIS Enterprise
- Hosted Knowledge Graph Service for information on managing knowledge graph services via ArcGIS Enterprise and the REST API
- Get started with ArcGIS Knowledge (ArcGIS Pro) for information on ArcGIS Knowledge in ArcGIS Pro
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.
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.