UNPKG

@arcgis/core

Version:

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

599 lines (597 loc) • 31 kB
import type Collection from "../core/Collection.js"; import type Layer from "./Layer.js"; import type KnowledgeGraphSublayer from "./knowledgeGraph/KnowledgeGraphSublayer.js"; import type EntityType from "../rest/knowledgeGraph/EntityType.js"; import type KnowledgeGraph from "../rest/knowledgeGraph/KnowledgeGraph.js"; import type RelationshipType from "../rest/knowledgeGraph/RelationshipType.js"; import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js"; import type { IdTypePair, InclusionModeDefinition } from "./knowledgeGraph/types.js"; import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js"; import type { CustomParametersMixin, CustomParametersMixinProperties } from "./mixins/CustomParametersMixin.js"; import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js"; import type { PortalLayer, PortalLayerProperties } from "./mixins/PortalLayer.js"; import type { RefreshableLayer, RefreshableLayerProperties } from "./mixins/RefreshableLayer.js"; import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleRangeLayer.js"; import type { LayerProperties } from "./Layer.js"; export interface KnowledgeGraphLayerProperties extends LayerProperties, CustomParametersMixinProperties, PortalLayerProperties, OperationalLayerProperties, RefreshableLayerProperties, ScaleRangeLayerProperties, BlendLayerProperties, Partial<Pick<KnowledgeGraphLayer, "inclusionModeDefinition" | "url">> { /** An optional title for the KnowledgeGraphLayer. */ title?: string | null; } /** * A KnowledgeGraphLayer is a composite layer that can be created from a * [knowledge graph service](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/). * The layer contains [feature sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/#layers) for each spatial [entity type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/). * The layer contains [table sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/#tables) for each non-spatial [entity type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) * and [relationship type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) contained in the KnowledgeGraphLayer. * * Spatial entity and relationship types have [geometries](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/) * that allows them to be rendered in a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) as a * [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) with spatial context. Spatial types also contain data * [Graphic.attributes](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#attributes) that provide additional information about * the real-world feature it represents; attributes may be viewed in [popup](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#popupTemplate) windows * and used for [rendering](https://developers.arcgis.com/javascript/latest/references/core/renderers/Renderer/) the layer. * Spatial type sublayers may be [queried](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#queryFeatures), [analyzed](https://developers.arcgis.com/javascript/latest/spatial-analysis/intro-geometry-operators/), * and [rendered](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#renderer) to visualize data in a spatial context. * * Non-spatial sublayers are tables which do not have a spatial column representing geographic features. These sublayers also contain attributes and can be queried. * * * > [!WARNING] * > * > **Known Limitations** * > * > A knowledgeGraphLayer can be added to an instance of a [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/) and saved to an [WebMap](https://developers.arcgis.com/javascript/latest/references/core/WebMap/), but it may not be supported in ArcGIS MapViewer. * > * > KnowledgeGraphLayer can only be used with KnowledgeGraphServices on ArcGIS Enterprise 11.1 or later. * * ### Create Knowledge Graph Layer * * To create a KnowledgeGraphLayer from [knowledgeGraphService](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/), you must set the [url](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/#url) property * to the REST endpoint of the service. For a layer to be visible in a view, it must be added to the [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/) * referenced by the view. See [Map.add()](https://developers.arcgis.com/javascript/latest/references/core/Map/#add) for information about adding layers to a map. * * ```js * const KnowledgeGraphLayer = await $arcgis.import("@arcgis/core/layers/KnowledgeGraphLayer.js"); * const kgl = new KnowledgeGraphLayer({ * url: "https://sampleserver7.arcgisonline.com/arcgis/rest/services/Hosted/SupplyChain/KnowledgeGraphServer" * }); * kgl.load().then(()=>{ * map.add(kgl); // adds the layer to the map * }) * ``` * * ### Querying * * Both spatial and non-spatial sublayers can be queried using the [sublayer.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#queryFeatures) method. * A query cannot be applied to the entire KnowledgeGraphLayer. Instead, it must be applied to the individual sublayers. * * ```js * //iterate through spatial sublayers and query each * kgLayer.layers.items.forEach((sublayer)=>{ * sublayer.queryFeatures("WHERE name = 'Supplier 5'").then((results)=>{ * console.log(results) * }) * }) * ``` * * ### Data Visualization * * Features in the spatial sublayers of a KnowledgeGraphLayer are visualized by setting a [Renderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/Renderer/) to the * [KnowledgeGraphSublayer.renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#renderer) property of the sublayer. Features may be visualized with the same symbol using * [SimpleRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/SimpleRenderer/), by type with [UniqueValueRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/UniqueValueRenderer/), * with class breaks using [ClassBreaksRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/ClassBreaksRenderer/), or with continuous color, size, or * opacity schemes using [visual variables](https://developers.arcgis.com/javascript/latest/references/core/renderers/SimpleRenderer/#visualVariables) in * any of the renderers. Symbols can only be set through a renderer and not individually on each graphic in the layer. * See the documentation for [Renderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/Renderer/) and the * [Creating visualizations manually](https://developers.arcgis.com/javascript/latest/creating-visualizations-manually/) guide for more information * about the various visualization options. * * <details> * <summary>Read More</summary> * * ```js * //create new KnowledgeGraphLayer * const kgLayer = new KnowledgeGraphLayer({ * url: "https://sampleserver7.arcgisonline.com/arcgis/rest/services/Hosted/SupplyChain/KnowledgeGraphServer" * }); * * //define renderer for all observations * const observationRenderer = { * type: "simple", // autocasts as new SimpleRenderer() * symbol: { * type: "simple-marker", * size: 6, * color: "yellow", * outline: { // autocasts as new SimpleLineSymbol() * width: 0.5, * color: "white" * } * } * }; * * //define renderer for all users * const userRenderer = { * type: "simple", // autocasts as new SimpleRenderer() * symbol: { * type: "simple-marker", * size: 6, * color: "purple", * outline: { // autocasts as new SimpleLineSymbol() * width: 0.5, * color: "white" * } * } * }; * * //define unique value renderer for 'species' type based on the 'common_name' field * const speciesRenderer = { * type: "unique-value", // autocasts as new UniqueValueRenderer() * field: "common_name", * defaultSymbol: { type: "simple-fill" }, // autocasts as new SimpleFillSymbol() * uniqueValueInfos: [{ * // All features with value of "Yellow-banded Bumble Bee" will be blue * value: "Yellow-banded Bumble Bee", * symbol: { * type: "simple-fill", // autocasts as new SimpleFillSymbol() * color: "blue", * size: 8 * } * }, { * // All features with value of "Two-spotted Bumble Bee" will be green * value: "Two-spotted Bumble Bee", * symbol: { * type: "simple-fill", // autocasts as new SimpleFillSymbol() * color: "green", * size: 6 * } * }, { * // All features with value of "Buff-tailed Bumble Bee" will be red * value: "Buff-tailed Bumble Bee", * symbol: { * type: "simple-fill", // autocasts as new SimpleFillSymbol() * color: "orange", * size: 4 * } * }] * }; * * //when layer loads, apply renderers to sublayers * kgLayer.load().then(()=>{ * kgLayer.layers.items.forEach((sublayer)=> { * switch(sublayer.title) { * case 'Observation': * sublayer.renderer = observationRenderer; * break; * case 'User': * sublayer.renderer = userRenderer; * break; * case 'Species': * sublayer.renderer = speciesRenderer; * break; * default: * sublayer.renderer = { * type: "simple", // autocasts as new SimpleRenderer() * symbol: { * type: "simple-marker", * size: 6, * color: "white", * } * } * break; * } * }) * map.add(kgLayer); * }); * ``` * * </details> * * [Labels](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/) can also be set for each sublayer. * * <details> * <summary>Read More</summary> * * ```js * kgLayer.load().then(()=>{ * kgLayer.layers.items.forEach((sublayer)=> { * //label all points by their type. * sublayer.labelingInfo = [ * new LabelClass({ * labelExpression: `${sublayer.objectType.name}`, * symbol: { * type: "text", // autocasts as new TextSymbol() * color: [255, 255, 255, 0.7], * haloColor: [0, 0, 0, 0.85], * haloSize: 1, * font: { * size: 11 * } * } * }) * ]; * sublayer.labelsVisible = true; * }) * }) * ``` * * </details> * * [Popups](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#popupTemplate) can be set on each sublayer. * * <details> * <summary>Read More</summary> * * ```js * //create popup template for observations * const observationPopup = new PopupTemplate({ * title: "{species_guess}", * content: [{ * type: "text", * text: "Quality: {quality_grade}" * }, * { * type: "text", * text: "Place guess: {place_guess}" * }] * }); * * //create popup template for users * const userPopup = new PopupTemplate({ * title: "{name}", * content: [{ * type: "text", * text: "Observation count: {observation_count}" * }] * }); * * //create popup template for species * const speciesPopup = new PopupTemplate({ * title: "{common_name}", * content: [{ * type: "text", * text: "Scientific Name: {name}" * }] * }); * //when layer loads, apply popups to sublayers * kgLayer.load().then(()=>{ * kgLayer.layers.items.forEach((sublayer)=> { * switch(sublayer.title) { * case 'Observation': * sublayer.popupTemplate = observationPopup; * break; * case 'User': * sublayer.popupTemplate = userPopup; * break; * case 'Species': * sublayer.popupTemplate = speciesPopup; * break; * default: * sublayer.popupTemplate = new PopupTemplate({ * title: "{globalid}" * }) * break; * } * }) * map.add(kgLayer); * }); * ``` * * </details> * * @since 4.26 * @see [Sample - Working with KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-knowledgegraphlayer/) * @see [KnowledgeGraphSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/) * @see [knowledgeGraphService](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/) * @see [KnowledgeGraphSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/) * @see [knowledgeGraphService](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/) */ export default class KnowledgeGraphLayer extends KnowledgeGraphLayerSuperclass { constructor(properties?: KnowledgeGraphLayerProperties); /** * Defines a set of [named types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphNamedObject/) and/or * [entities](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Entity/) * and [relationships](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Relationship/) to be included in the layer. * If only a named type is specified, all instances of that type will be included * in the layer. [Sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/) can be created for all named types * in the graph even if they have no instances specified in the member definition. The inclusion definition is not permanently dynamic. * It captures the data at the time of creation. For example, if `generateAllSublayers` is `true` and a new entity type is added to the knowledge graph, * that new entity type will not be added to the inclusion list. Similarly, if `useAllData` is `true` for a type, and a new record is added to * that type, the newly added record will not be automatically added to the inclusionList. * * @example * // constructing an inclusion list: * // The exact record ids of each of the records of a specific named type (entity type or relationship type) * // to include in the layer. In this case the layer will contain one record * const layerInclusionMemberDefinition = new Map(); * layerInclusionMemberDefinition.set("{1A4W8G4-W52G-W89G-1W5G-J1R4S8H52H4S}",{id:"{1A4W8G4-W52G-W89G-1W5G-J1R4S8H52H4S}"}) * * //The layerInclusionDefinition specifies whether to use all of the data in a named type or only the records * // specified in the 'members' list. In this case we only want the records specified. * const layerInclusionDefinition = { * useAllData: false, //only include instances in the member list * members: layerInclusionMemberDefinition * }; * * // The namedTypeDefinition is a map of the typeName of each type to be included. * // In this case we are only including the "Observation" entity type. * // The layerInclusionDefinition specifies exactly which "Observation" entities to include in the layer. * const namedTypeDefinition = new Map(); * namedTypeDefinition.set("Observation", layerInclusionDefinition); * * // Specify if a sublayer should be generated for all named types. * // If true, a sublayer will be created for all named types regardless of * // whether they have a list of instances to include or not. * // If there are no instances the sublayer will be empty. In this case we have set 'generateAllSubLayers' to false so the * // layer will only contain sublayers for the named types (entity types or relationship types) that are specified * // in the namedTypeDefinitions. * // Also defines the collection of named types to include in the layer. * const inclusionListDefinition = { * generateAllSublayers: false, //only create sublayers for the named types in the namedTypeDefinition * namedTypeDefinitions: namedTypeDefinition * } * @example * //examples of the inclusionModeDefinition structure inside the KnowledgeGraphLayer * * //the layer will only contain one sublayer (for 'supplier') and that sublayer will consist of one entity. * { * generateAllSublayers: false, * namedTypeDefinition:[{ * key: "supplier", * value:{ * useAllData: false, * members: [{ * key: "{1A4W8G4-W52G-W89G-1W5G-J1R4S8H52H4S}", * value: { * id: "{1A4W8G4-W52G-W89G-1W5G-J1R4S8H52H4S}", * } * }] * } * }] * } * * // this layer will contain a sublayer for all named types in the graph * // ('Observation', 'User', 'Species', "Observed", "Reviewed", "ObservedIn") * // but only the 'Observation' sublayer will contain data. * // The Observation sublayer will contain exactly one entity. * { * generateAllSublayers: true, * namedTypeDefinition:[{ * key: "Observation", * value:{ * useAllData: false, * members: [{ * key: "{32CBD5CB-EE31-4714-B14F-57BFE36AE094}", * value: { * id: "{32CBD5CB-EE31-4714-B14F-57BFE36AE094}", * } * }] * } * }] * } * * // this layer will contain a sublayer for all named types in the graph * // ('Observation', 'User', 'Species', "Observed", "Reviewed", "ObservedIn") * // but only the 'Observation' sublayer will contain data. * // the 'Observation' sublayer will contain all instance of the Observation entity type * { * generateAllSublayers: true, * namedTypeDefinition:[{ * key: "Observation", * value:{ * useAllData: true * } * }] * } * * // A more complex example: * { * //sublayers will only be created for the types listed * generateAllSublayers: false, * namedTypeDefinitions: { * //include all `Species` entities that exist at the time the layer is created * Species: { * useAllData: true * }, * //include all `User` entities that exist at the time the layer is created * User: { * useAllData: true * }, * //include all only the specified `Observation` entities * Observation: { * useAllData:false, * members: { * "{941A7425-C45D-4940-A2E8-F3611973EC8A}": { * id: "{941A7425-C45D-4940-A2E8-F3611973EC8A}" * }, * "{94DC1D53-4043-4D0B-8CF7-18B690414118}": { * id: "{94DC1D53-4043-4D0B-8CF7-18B690414118}" * }, * //This entity has a fixed location so will remain in the same place regardless of the layout applied. * //the other entities will move around it * "{4E1D1ACE-6252-4BA4-B76E-CDEDFE9B0AB1}": { * id: "{4E1D1ACE-6252-4BA4-B76E-CDEDFE9B0AB1}", * }, * "{559312DF-893C-44E2-AD86-BAA73CD49719}": { * id: "{559312DF-893C-44E2-AD86-BAA73CD49719}" * }, * "{158A2D46-3EFF-4479-BC57-E6981FCB80B6}": { * id: "{158A2D46-3EFF-4479-BC57-E6981FCB80B6}" * }, * "{40AD70FC-CD7D-4928-B555-38EA49675944}": { * id: "{40AD70FC-CD7D-4928-B555-38EA49675944}" * }, * "{3A5B8F11-5971-4A46-99AC-F509CA59B517}": { * id: "{3A5B8F11-5971-4A46-99AC-F509CA59B517}" * } * } * }, * //include all `Observed` relationships that exist at the time the layer is created * Observed: { * useAllData: true * }, * //include all `ObservedIn` relationships that exist at the time the layer is created * ObservedIn: { * useAllData: true * } * } * } */ accessor inclusionModeDefinition: InclusionModeDefinition | null | undefined; /** * The [data model](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/DataModel/), [service definition](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/ServiceDefinition/) and [url](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/#url) of the * [knowledge graph service](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/) that contains the data for the KnowledgeGraphLayer. */ get knowledgeGraph(): KnowledgeGraph; /** * A collection of operational [KnowledgeGraphSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/). Each layer represents an [entity type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) or * [relationship type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) sublayer. Each feature contained in each sublayer has a [Geometry](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/) * that allows it to be rendered as a [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) with spatial context on the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). * Features within the layer may also contain data [Graphic.attributes](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#attributes) that provide additional information that may be viewed in [Popup](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/). * These layers can also be [queried](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#queryFeatures) and [analyzed](https://developers.arcgis.com/javascript/latest/spatial-analysis/intro-geometry-operators/). * * @example * //to access individual sublayers to add or modify properties such as the renderer, popups and labels * KnowledgeGraphLayer.layers.items.forEach((sublayer)=>{ * sublayer.popupTemplate = new PopupTemplate({ * title: "{common_name}", * content: [{ * type: "text", * text: "Scientific Name: {name}" * }] * }); * }) */ get layers(): Collection<KnowledgeGraphSublayer>; /** The [entity types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) included in the KnowledgeGraphLayer. */ get memberEntityTypes(): EntityType[]; /** The [relationship types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) included in the KnowledgeGraphLayer. */ get memberRelationshipTypes(): RelationshipType[]; /** Contains the sublayer ids that have been cached. */ get sublayerIdsCache(): Map<string, Set<string>>; /** * All non-spatial [entity type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) and [relationship type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) * sublayers. They have the same structure as the spatial [sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/#layers) but the `geometryType` is null. * These layers can also be [queried](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#queryFeatures) and [analyzed](https://developers.arcgis.com/javascript/latest/spatial-analysis/intro-geometry-operators/). */ get tables(): Collection<KnowledgeGraphSublayer>; /** An optional title for the KnowledgeGraphLayer. */ accessor title: string | null | undefined; /** The layer type. */ get type(): "knowledge-graph"; /** The url of the [knowledge graph service](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/). */ accessor url: string | null | undefined; /** * Adds new entities or relationships to the knowledge graph layer. This method modifies the [inclusionModeDefinition](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/#inclusionModeDefinition). * If the entity type or relationship type of the record already exists in the graph, the record will be added * to the appropriate sublayer. If the named type is not already in the knowledge graph layer a new sublayer * will be added to the knowledge graph layer. * * > [!WARNING] * > * > **Known Limitations** * > * > `addRecords` can only be used on a knowledge graph layer that is defined with an [inclusionModeDefinition](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/#inclusionModeDefinition). * * @param records - An array of the records to add to the knowledge graph layer. * @returns Resolves when the records are retrieved from the knowledge graph service and added to the knowledge graph layer. * @example * const initializeLayer = async() => { * //fetch the knowledge graph * knowledgeGraph = await KnowledgeGraphService.fetchKnowledgeGraph(url) * //query the knowledge graph to get only the research grade observations * observationList = await KnowledgeGraphService.executeQuery(knowledgeGraph, { * openCypherQuery: `MATCH (o:Observation{quality_grade: "research"}) RETURN o LIMIT 10` * }) * //Define an inclusion list * let members = new Map(); * for (observation of observationList.resultRows){ * members.set(observation[0].id,{id:observation[0].id}) * } * let namedTypes = new Map(); * namedTypes.set("Observation", { useAllData: false, members: members }); * const inclusionDef = { * generateAllSublayers: false, * namedTypeDefinitions: namedTypes * } * //create the layer * const compositeLayer = new KnowledgeGraphLayer({ * url: url, * inclusionModeDefinition: inclusionDef * }); * map.add(compositeLayer); * //add records to the layer * await compositeLayer.addRecords([{id:"{001899F8-6A59-462A-8507-DD65D690AD48}", typeName:"Observation"}]) * } * initializeLayer() */ addRecords(records: IdTypePair[]): Promise<void>; /** * @param typeName - The name of the named type to convert * @returns Resolves when the sublayer is converted to dynamic data */ convertSublayerToDynamicData(typeName: string): void; /** * @param typeName - The name of the named type to convert * @returns Resolves when the sublayer is converted to explicit membership */ convertSublayerToExplicitMembership(typeName: string): void; /** @returns Resolves when the entire composite layer is converted to empty explicit membership */ convertToExplicitMembership(): void; /** @returns Resolves when the entire composite layer is converted to dynamic data */ convertToFullyDynamicData(): void; /** * @param typeName - The name of the named type to create a sublayer for * @returns Resolves when the sublayer is created and added to the layer. */ createSublayerForNamedType(typeName: string): Promise<KnowledgeGraphSublayer>; /** Assumes that data for all of the members defined in the inclusionModeDefinition is already loaded into local storage. This will optimize layer load times. */ loadLayerAssumingLocalCache(): void; /** * Removes entities or relationships from the knowledge graph layer. This method only removes records from the knowledge graph layer, * all records will remain in the [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/#knowledgeGraph). * * > [!WARNING] * > * > **Known Limitations** * > * > `removeRecords` can only be used on records explicitly included as members in the [inclusionModeDefinition](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/#inclusionModeDefinition). * > You cannot remove records from named type [KnowledgeGraphSublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/) * > that have `useAllData:True` or knowledge graph layers with * > no inclusionModeDefinition. * * @param records - The id and entity type or relationship type of the record to be added to the knowledge graph layer. * @returns The [IdTypePairs](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/types/#IdTypePair) for the records removed from the knowledge graph layer. * @example * const initializeLayer = async() => { * //fetch the knowledge graph * knowledgeGraph = await KnowledgeGraphService.fetchKnowledgeGraph(url) * //query the knowledge graph to get only the research grade observations * observationList = await KnowledgeGraphService.executeQuery(knowledgeGraph, { * openCypherQuery: `MATCH (o:Observation{quality_grade: "research"}) RETURN o LIMIT 10` * }) * //Define an inclusion list. Records can only be removed from the knowledge graph layer * // if they are explicitly included as members of a named type in the inclusionModeDefinition * let members = new Map(); * for (observation of observationList.resultRows){ * members.set(observation[0].id,{id:observation[0].id}) * } * let namedTypes = new Map(); * namedTypes.set("Observation", { useAllData: false, members: members }); * const inclusionDef = { * generateAllSublayers: false, * namedTypeDefinitions: namedTypes * } * //create the layer * const compositeLayer = new KnowledgeGraphLayer({ * url: url, * inclusionModeDefinition: inclusionDef * }); * map.add(compositeLayer); * //remove records from the inclusionModeDefinition * await compositeLayer.removeRecords([{id:"{001899F8-6A59-462A-8507-DD65D690AD48}", typeName:"Observation"}]) * } * initializeLayer() */ removeRecords(records: IdTypePair[]): Promise<IdTypePair[]>; } declare const KnowledgeGraphLayerSuperclass: typeof Layer & typeof CustomParametersMixin & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof BlendLayer