arcgis-knowledge-graphs
Skill1 starsChanged 6 months agoMITView on GitHub
Query ArcGIS Knowledge graphs with the ArcGIS Maps SDK for JavaScript 5.1: fetchKnowledgeGraph for the data model, executeQueryStreaming with GraphQuery instances and bindParameters (openCypher), reading rows from the stream, geometry inside entity properties, and showing results with KnowledgeGraphLayer, LinkChartLayer and arcgis-link-chart. Use this skill whenever the user connects to a knowledge graph, runs a graph query, or explores entities and their relationships.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- GeoDaoyu/arcgis-maps-sdk-js-ai-contexttheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- GeoDaoyu/arcgis-maps-sdk-js-ai-context★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- skills/arcgis-3d-layers/AGENTS.mdAGENTS.md
- skills/arcgis-advanced-layers/AGENTS.mdAGENTS.md
- skills/arcgis-ai-components/AGENTS.mdAGENTS.md
- skills/arcgis-arcade/AGENTS.mdAGENTS.md
- skills/arcgis-authentication/AGENTS.mdAGENTS.md
- skills/arcgis-charts/AGENTS.mdAGENTS.md
- skills/arcgis-cim-symbols/AGENTS.mdAGENTS.md
- skills/arcgis-coding-components/AGENTS.mdAGENTS.md
- skills/arcgis-coordinates-projection/AGENTS.mdAGENTS.md
- skills/arcgis-core-maps/AGENTS.mdAGENTS.md
- skills/arcgis-core-utilities/AGENTS.mdAGENTS.md
- skills/arcgis-custom-rendering/AGENTS.mdAGENTS.md
- skills/arcgis-editing/AGENTS.mdAGENTS.md
- skills/arcgis-embeddable-maps/AGENTS.mdAGENTS.md
- skills/arcgis-feature-effects/AGENTS.mdAGENTS.md
- skills/arcgis-geometry-operations/AGENTS.mdAGENTS.md
- skills/arcgis-imagery/AGENTS.mdAGENTS.md
- skills/arcgis-interaction/AGENTS.mdAGENTS.md
- skills/arcgis-knowledge-graphs/AGENTS.mdAGENTS.md
- skills/arcgis-layers/AGENTS.mdAGENTS.md
- skills/arcgis-map-tools/AGENTS.mdAGENTS.md
- skills/arcgis-parquet/AGENTS.mdAGENTS.md
- skills/arcgis-performance/AGENTS.mdAGENTS.md
- skills/arcgis-popup-templates/AGENTS.mdAGENTS.md
- skills/arcgis-portal-content/AGENTS.mdAGENTS.md
- skills/arcgis-rest-services/AGENTS.mdAGENTS.md
- skills/arcgis-scene-environment/AGENTS.mdAGENTS.md
- skills/arcgis-smart-mapping/AGENTS.mdAGENTS.md
- skills/arcgis-spatial-analysis/AGENTS.mdAGENTS.md
- skills/arcgis-starter-app/AGENTS.mdAGENTS.md
- skills/arcgis-tables-forms/AGENTS.mdAGENTS.md
- skills/arcgis-time-animation/AGENTS.mdAGENTS.md
- skills/arcgis-utility-networks/AGENTS.mdAGENTS.md
- skills/arcgis-visualization/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-advanced/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-ui/AGENTS.mdAGENTS.md
- skills/hello-world/AGENTS.mdAGENTS.md
- arcgis-3d-layersSkill
- arcgis-advanced-layersSkill
- arcgis-ai-componentsSkill
- arcgis-arcadeSkill
- arcgis-authenticationSkill
- arcgis-chartsSkill
- arcgis-cim-symbolsSkill
- arcgis-coding-componentsSkill
- arcgis-coordinates-projectionSkill
- arcgis-core-mapsSkill
- arcgis-core-utilitiesSkill
- arcgis-custom-renderingSkill
- arcgis-editingSkill
- arcgis-embeddable-mapsSkill
- arcgis-feature-effectsSkill
- arcgis-geometry-operationsSkill
- arcgis-imagerySkill
- arcgis-interactionSkill
- arcgis-layersSkill
- arcgis-map-toolsSkill
- arcgis-parquetSkill
- arcgis-performanceSkill
- arcgis-popup-templatesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 73
Default → executeQueryStreaming with new GraphQueryStreaming({ openCypherQuery, bindParameters }).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Knowledge Graphs
When to use: Activate this skill whenever the user connects to a knowledge graph, runs a graph query, or explores entities and relationships.
Overview
A knowledge graph stores entities and relationships; you query it with Esri's openCypher.
- Problem it solves: querying connected, non-tabular data and putting it on a map or a link chart.
- Who it serves: developers building investigative and link-analysis apps on ArcGIS Enterprise or Online.
- Pattern it teaches: sign in, fetch the graph, stream a bound query, read rows, render.
- What it does NOT cover: feature layers (see
arcgis-layers) or auth setup (seearcgis-authentication).
Validation note: every public sample graph asks for a token, and the validation never signs in, so queries were not run against a live graph. What is measured is marked as measured; the rest comes from the 5.1 typings and docs.
Quick Start
import * as knowledgeGraphService from "@arcgis/core/rest/knowledgeGraphService.js";
import GraphQueryStreaming from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
const graph = await knowledgeGraphService.fetchKnowledgeGraph(url); // sign in first if it is secured
const result = await knowledgeGraphService.executeQueryStreaming(graph, new GraphQueryStreaming({
openCypherQuery: "MATCH (s:Supplier) WHERE s.Name = $name RETURN s LIMIT 100",
bindParameters: { name: "Supplier 5" },
}));
const reader = result.resultRowsStream.getReader();
for (let chunk = await reader.read(); !chunk.done; chunk = await reader.read()) {
for (const row of chunk.value) console.log(row[0]); // a row is an array, one item per RETURN value
}Decision Tree
- Connecting?
- Secured graph (almost always) → set up auth first (
arcgis-authentication), thenfetchKnowledgeGraph(url).
- Secured graph (almost always) → set up auth first (
- Querying?
- Default →
executeQueryStreamingwithnew GraphQueryStreaming({ openCypherQuery, bindParameters }). - Full-text search →
executeSearchStreaming. - Small fixed query and you accept the
maxRecordCountcap →executeQuerywithnew GraphQuery(...).
- Default →
- Showing results?
- Entities with geometry on a map →
KnowledgeGraphLayer(scope it withinclusionModeDefinition). - Relationships →
LinkChartLayerin aWebLinkChart, rendered byarcgis-link-chart.
- Entities with geometry on a map →
Default: fetch, then streaming query with bind parameters.
Import Patterns
Direct ESM (recommended for npm/Vite/Webpack)
import * as knowledgeGraphService from "@arcgis/core/rest/knowledgeGraphService.js";
import GraphQueryStreaming from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
import KnowledgeGraphLayer from "@arcgis/core/layers/KnowledgeGraphLayer.js";Dynamic Imports (CDN)
const kg = await $arcgis.import("@arcgis/core/rest/knowledgeGraphService.js");Map Components (recommended for new projects)
import "@arcgis/map-components/components/arcgis-map";
import "@arcgis/map-components/components/arcgis-link-chart"; // registered in 5.1 (measured)Key Concepts
Concept 1: Fetch the graph (and its data model)
fetchKnowledgeGraph(url) returns a KnowledgeGraph with url, dataModel (entity and relationship types, their
properties, the spatial reference) and serviceDefinition (including maxRecordCount). Type and property names in
your openCypher must match the data model exactly. It has no id; the old example that logged graph.id does not
compile in 5.1.
Concept 2: Streaming queries with bind parameters
executeQueryStreaming returns resultRowsStream, a ReadableStream whose chunks are arrays of rows. Per the 5.1
docs it returns all matches, past maxRecordCount, while executeQuery stops at that cap. Values go in
bindParameters ($name in the query): strings, lists of ids, and geometries (measured: a Polygon is kept as a
geometry for esri.graph.ST_Intersects($zona, s.shape)), never concatenated into the query string. Pass a class
instance: the 5.1 typings reject a plain { openCypherQuery } object for executeQuery.
Concept 3: Entities, relationships, geometry
Each row item is an Entity, Relationship, Path or a plain value. An entity has typeName, id and
properties; the geometry is one of the properties (measured: "geometry" in entity === false; the point was in
entity.properties.shape). The property name comes from the data model: the one whose fieldType is
"esriFieldTypeGeometry".
Common Pitfalls (Top 3)
Pitfall 1: Reading entity.geometry
// ❌ Anti-pattern
entities.forEach((e) => graphicsLayer.add(new Graphic({ geometry: e.geometry }))); // Entity has no geometry field// ✅ Correct
const type = graph.dataModel.entityTypes.find((t) => t.name === "Supplier");
const shape = type?.properties.find((p) => p.fieldType === "esriFieldTypeGeometry")?.name;
entities.forEach((e) => { if (shape && e.properties[shape]) graphicsLayer.add(new Graphic({ geometry: e.properties[shape] })); });Impact: measured on an Entity built like the service returns it: geometry is not a member and every
graphic comes out empty, without an error.
Pitfall 2: Fetching a secured graph without signing in
// ❌ Anti-pattern
const graph = await knowledgeGraphService.fetchKnowledgeGraph(securedUrl); // no auth configured// ✅ Correct
// Register OAuthInfo or a token with IdentityManager first (see arcgis-authentication),
// or load through a KnowledgeGraphLayer and pass an AbortSignal so the UI can give up.Impact: measured on Esri's public sample graph (499 "Token Required"): the promise did not reject. After
15 s it was still pending with the SDK's sign-in dialog in the DOM. fetchKnowledgeGraph(url) takes no
signal; KnowledgeGraphLayer.load({ signal }) did abort cleanly (AbortError).
Pitfall 3: Building queries by string concatenation, or using executeQuery for big sets
// ❌ Anti-pattern
await knowledgeGraphService.executeQuery(graph, new GraphQuery({
openCypherQuery: `MATCH (s:Supplier) WHERE s.Name = '${userInput}' RETURN s`,
})); // injectable, and capped at maxRecordCount// ✅ Correct
await knowledgeGraphService.executeQueryStreaming(graph, new GraphQueryStreaming({
openCypherQuery: "MATCH (s:Supplier) WHERE s.Name = $name RETURN s",
bindParameters: { name: userInput },
}));Impact: user text can rewrite the query; per the docs, executeQuery silently returns at most
serviceDefinition.maxRecordCount rows (not measured: no reachable graph).
When to Read references/
| If you need... | Read |
| knowledgeGraphService signatures | references/api-detail.md |
| Query + visualization examples | references/examples.md |
| More pitfalls (5+ extended) | references/pitfalls.md |
Related Skills
arcgis-authentication— graphs are usually securedarcgis-layers— plot entities with geometryarcgis-interaction— select nodes/edges
Reference Samples
Changelog
- 0.2.0 (2026-10-27): SDK 5.1, partial validation: public graphs need a token and the validation never signs
in. Measured in
tests/runtime/casos/arcgis-knowledge-graphs.ts: entity geometry lives inproperties, notentity.geometry(the old pitfall 2 code returned nothing); a secured graph leavesfetchKnowledgeGraphpending behind the sign-in dialog instead of a 403. Fixed the examples that did not compile (graph.id, plain{ openCypherQuery }), made streaming withbindParametersthe default, and replaced three empty pitfalls (comment-only "do streaming", "keep ids scoped") with KnowledgeGraphLayer, LinkChartLayer andarcgis-link-chart. - 0.1.0 (2026-05-31): Initial release.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

