KnowledgeGraph

AMD: require(["geoscene/rest/knowledgeGraph/KnowledgeGraph"], (KnowledgeGraph) => { /* code goes here */ });
ESM: import KnowledgeGraph from "@geoscene/core/rest/knowledgeGraph/KnowledgeGraph";
类: geoscene/rest/knowledgeGraph/KnowledgeGraph
继承于:KnowledgeGraph Accessor
起始版本:GeoScene Maps SDK for JavaScript 4.25
beta

knowledgeGraphService 相关联的知识图谱。这是一个存储实体和关系的图谱数据库。

另请参阅
示例
//fetch the knowledge graph
require([
  "geoscene/rest/knowledgeGraphService"
], (KnowledgeGraphModule)  => {
  const url = "https://<web server hostname>/server/rest/admin/services/<serviceName>/KnowledgeGraphServer";
  KnowledgeGraphModule.fetchKnowledgeGraph(url)
   .then((kg) => {
      //do something with result
     console.log(kg)
  });
});
//sample result returned from fetchKnowledgeGraph()
{
 "url":"https://myHostName.domain.com/geoscene/rest/services/Hosted/myServiceName/KnowledgeGraphServer"
 {
 "dataModel": {
   "declaredClass": "geoscene.rest.knowledgeGraph.DataModel",
   "timestamp": {},
   "spatialReference": {
     "latestWkid": 0,
     "wkid": 4326,
     "vcsWkid": 0,
     "latestVcsWkid": 0
   },
   "strict": false,
   "entityTypes": [
     {
       "declaredClass": "geoscene.rest.knowledgeGraph.EntityType",
       "name": "company",
       "alias": "Company",
       "role": "Regular",
       "strict": false,
       "properties": [
         {
           "declaredClass": "geoscene.rest.knowledgeGraph.GraphProperty",
           "name": "Name",
           "alias": "Name",
           "fieldType": "esriFieldTypeString",
           "geometryType": "esriGeometryNull",
           "hasM": false,
           "hasZ": false,
           "nullable": true,
           "editable": true,
           "required": false,
           "defaultVisibility": true,
           "systemMaintained": false,
           "searchable": false,
           "defaultValue": null
         },
         {
           "declaredClass": "geoscene.rest.knowledgeGraph.GraphProperty",
           "name": "id",
           "alias": "ID",
           "fieldType": "esriFieldTypeOID",
           "geometryType": "esriGeometryNull",
           "hasM": false,
           "hasZ": false,
           "nullable": false,
           "editable": false,
           "required": true,
           "defaultVisibility": true,
           "systemMaintained": true,
           "searchable": false,
           "defaultValue": null
         }
       ],
       "fieldIndexes": [
         {
           "declaredClass": "geoscene.rest.knowledgeGraph.FieldIndex",
           "name": "esri__id_idx",
           "unique": true,
           "ascending": true,
           "description": "",
           "fieldNames": [
             "id"
           ]
         },
         {
           "declaredClass": "geoscene.rest.knowledgeGraph.FieldIndex",
           "name": "geoscene__name_idx",
           "unique": true,
           "ascending": true,
           "description": "",
           "fieldNames": [
             "name"
           ]
         }
       ]
     }
   ],
   "relationshipTypes": [
     {
       "declaredClass": "geoscene.rest.knowledgeGraph.RelationshipType",
       "name": "employed_bu",
       "alias": "Employed By",
       "role": "Regular",
       "strict": false,
       "properties": [
         {
           "declaredClass": "geoscene.rest.knowledgeGraph.GraphProperty",
           "name": "id",
           "alias": "id",
           "fieldType": "esriFieldTypeGUID",
           "geometryType": "esriGeometryNull",
           "hasM": false,
           "hasZ": false,
           "nullable": false,
           "editable": false,
           "required": true,
           "defaultVisibility": true,
           "systemMaintained": true,
           "searchable": false,
           "defaultValue": null
         },
         {
           "declaredClass": "geoscene.rest.knowledgeGraph.GraphProperty",
           "name": "start_date",
           "alias": "Start Date",
           "fieldType": "esriFieldTypeGUID",
           "geometryType": "esriGeometryNull",
           "hasM": false,
           "hasZ": false,
           "nullable": false,
           "editable": false,
           "required": true,
           "defaultVisibility": true,
           "systemMaintained": false,
           "searchable": false,
           "defaultValue": null
         }
       ],
       "fieldIndexes": [
            {
            "ascending": true,
            "description": "index on id field",
            "fieldNames": ["id"],
            "name": "esri_id_idx",
            "unique": "true",
          }
       ],
       "originEntityTypes": [
         "Person"
       ],
       "destinationEntityTypes": [
         "Company"
       ]
     }
   ]
  }
 }
}

构造函数

new KnowledgeGraph(properties)
参数
properties Object
optional

有关可能传递给构造函数的所有属性的列表,请参见属性

属性概述

可以设置、检索或侦听任何属性。请参阅使用属性主题。
显示继承属性 隐藏继承属性
名称 类型 描述
DataModel

知识图谱服务的数据模型。

更多详情
KnowledgeGraph
String

类的名称。

更多详情
Accessor
String

托管知识图谱的 url。

更多详情
KnowledgeGraph

属性详细信息

dataModel DataModel

知识图谱服务的数据模型。数据模型定义了可存在于知识图谱中的实体和关系类型,以及可存在于每种实体类型和关系中的属性。

declaredClass Stringreadonly inherited

类的名称。声明的类名称格式化为 geoscene.folder.className

url String

托管知识图谱的 url。有关知识图谱服务的详细信息,请参阅 GeoScene 托管知识图谱

方法概述

显示继承的方法 隐藏继承的方法
名称 返回值类值 描述

添加一个或多个与对象的生命周期相关联的句柄。

更多详情
Accessor
Boolean

如果存在指定的句柄组,则返回 true。

更多详情
Accessor

移除对象拥有的句柄组。

更多详情
Accessor

方法详细说明

addHandles(handleOrHandles, groupKey)inherited

添加一个或多个与对象的生命周期相关联的句柄。当对象被销毁时,将移除句柄。

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

// Handle gets removed when the object is destroyed.
this.addHandles(handle);
参数
handleOrHandles WatchHandle|WatchHandle[]

对象销毁后,标记为要移除的句柄。

groupKey *
optional

标识句柄应添加到的组的键。组中的所有句柄稍后都可使用 Accessor.removeHandles() 进行删除。如果未提供键,则句柄将被添加到默认组。

hasHandles(groupKey){Boolean}inherited

如果存在指定的句柄组,则返回 true。

参数
groupKey *
optional

组键。

返回
类型 描述
Boolean 如果存在指定的句柄组,则返回 true
示例
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}
removeHandles(groupKey)inherited

移除对象拥有的句柄组。

参数
groupKey *
optional

要移除的组键或组键的数组或集合。

示例
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

您的浏览器不再受支持。请升级您的浏览器以获得最佳体验。请参阅浏览器弃用帖子以获取更多信息