UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

76 lines (74 loc) 3 kB
import type Accessor from "../../core/Accessor.js"; import type { GraphAnyValue } from "./GraphAnyValue.js"; export interface GraphQueryResultProperties extends Partial<Pick<GraphQueryResult, "resultRows">> {} /** * The results of a [executeQuery()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeQuery) or [executeSearch()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeSearch) on a knowledge graph service. * * @since 4.25 * @see [executeQuery()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeQuery) * @see [executeSearch()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeSearch) */ export default class GraphQueryResult extends Accessor { constructor(properties?: GraphQueryResultProperties); /** * An array of the result types that are returned from a search or query. Each item in the `resultRows` array matches the search or query constraints. * * @example * // Example of GraphQueryResult.resultRows returned from a * // `MATCH (n:Supplier)-[r]->(m) RETURN [n.id, n.geometry, n, r, m], {var1: n}` * // query on a knowledge graph that contains supply chain information * KnowledgeGraphModule.executeQuery( * knowledgeGraph, //graph * { //searchArguments * openCypherQuery: "MATCH (n:Supplier)-[r]->(m) RETURN [n.id, n.geometry, n, r, m], {var1: n}", * }).then((queryResult) => { * //do something with the result * console.log(queryResult) * }); * @example * //sample result of the above query * "resultRows": [ * [ //array of result types that meet query criteria * [ //single return type that matches query return format. * 1111, * "Point", * { //Supplier Entity * "properties": { * "Name": "Queen City Steel", * }, * "typeName": "Supplier", * "id": "1111" * }, * { // 'supplies' relationship between Supplier and Plant * "destinationId": "1111", * "originId": "1236", * "properties": { * "material_supplied": "steel" * }, * "typeName": "supplies", * "id": "A268", * }, * { //destination entity of 'supplies' for supplier 1111 * "properties": { * "Name": "Sky Manufacturing", * }, * "typeName": "Plant", * "id": "1236" * } * ], * { // anonymous object returned by the `{var1:n}` query parameter * "properties": { * "var1": { //the entity (n) returned in the var1 object * "properties": { * "Name": "Queen City Steel", * }, * "typeName": "Supplier", * "id": "1111" * } * } * } * ] * ] */ accessor resultRows: Array<GraphAnyValue[]>; }