UNPKG

@arcgis/core

Version:

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

58 lines (56 loc) 2.58 kB
import type GraphNamedObject from "./GraphNamedObject.js"; import type { GraphNamedObjectProperties } from "./GraphNamedObject.js"; export interface RelationshipProperties extends GraphNamedObjectProperties, Partial<Pick<Relationship, "destinationId" | "originId">> {} /** * A relationship is an instance of a [relationship type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) that defines an association between two [entities](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Entity/). * Examples include `"owns"`, `"called"`, or `"employed by"`. A relationship is described in a single direction. Every relationship describes an association from one entity to another entity. * If two people in a family are siblings, each person entity requires a separate sibling-of relationship to the other entity to fully describe the relationship. * * @since 4.25 * @see [Entity](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Entity/) * @example * // sample creation of new Relationship object * const [knowledgeGraphModule, Relationship] = await $arcgis.import([ * "@arcgis/core/rest/knowledgeGraphService.js", * "@arcgis/core/rest/knowledgeGraph/Relationship.js", * ]); * const newRelationship = new Relationship({ * typeName: "buys_part", * properties: { * quantity: 5000 * }, * destinationId: "{HNEIS053-AW6F-G9W4-8412-MROEJHM25694}", * originId: "{D1HRH4D3-1RE5-JTRH-1D5F-21TH8HRDHTRS}" * }) * @example * // sample relationship returned as a result of a search or query on a knowledge graph * [{ * "declaredClass": "esri.rest.Relationship.Relationship", * "originId": "1234", * "destinationId": "5678", * "properties": { * "order_day": "Sunday", * "quantity": 15000 * }, * "typeName": "buys_part", * "id": "{ANWIFHSAS-AW6F-G9W4-8412-A1A8W4F1A5S6F}", * }] */ export default class Relationship extends GraphNamedObject { /** * @example * const newRelationship = new Relationship({ * typeName: "buys_part", * properties: { * quantity: 5000 * }, * destinationId: "{HNEIS053-AW6F-G9W4-8412-MROEJHM25694}", * originId: "{D1HRH4D3-1RE5-JTRH-1D5F-21TH8HRDHTRS}" * }); */ constructor(properties?: RelationshipProperties); /** The ID of the destination entity of the relationship (i.e. the 'to' entity). */ accessor destinationId: string; /** The ID of the origin entity of the relationship (i.e. the 'from' entity). */ accessor originId: string; }