Class: KnowledgeGraphService

KnowledgeGraphService

知识图谱服务类。知识图谱是知识表示的一种形式,是由具有属性的实体通过关系链接而成的网状知识库。 图谱数据和常规结构化表格数据相比,具有强大的数据描述能力,可以实现更快更高效的查询,更快更精准的数据关联性推理运算和隐藏关系的挖掘。 提供方法:获取图谱图序列化数据、获取图谱列表、查询知识图谱数据、将 SuperMap iServer GraphMap 服务的数据格式转换为 KnowledgeGraph 的数据格式。

new KnowledgeGraphService(url, options)

Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/leaflet/iclient-leaflet.js"></script>
<script>
  new L.supermap.KnowledgeGraphService(url, options);
  
</script>

// ES6 Import
import { KnowledgeGraphService } from '@supermapgis/iclient-leaflet';

new KnowledgeGraphService(url, options);

leaflet/services/KnowledgeGraphService.js, line 7
Name Type Description
url string

服务地址。

options Object

参数。

Name Type Description
proxy string 可选

服务代理地址。

withCredentials boolean 可选

请求是否携带凭据。默认情况下,仅同源请求包含凭据。

crossOrigin boolean 可选

是否允许跨域请求。

headers Object 可选

请求头。

Version:
  • 11.1.0
Example
new KnowledgeGraphService(url)
 .query(param,function(result){
    //doSomething
})

Extends

Events

inherited destroy

leaflet/services/ServiceBase.js, line 58

资源释放成功后触发。

Properties:
Name Type Description
this ServiceBase

this 对象。

inherited initialized

leaflet/services/ServiceBase.js, line 45

构造函数构造成功后触发。

Properties:
Name Type Description
this ServiceBase

this 对象。

Methods

inherited destroy()

leaflet/services/ServiceBase.js, line 53

释放资源,将引用的资源属性置空。

findShortestPath(params, callback){Promise}

leaflet/services/KnowledgeGraphService.js, line 34

获取开始节点和结束节点之间的最短路径。

Name Type Description
params KnowledgeGraphService.findShortestPathParams

参数。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Version:
  • 11.2.0
Returns:
Type Description
Promise Promise 对象。

getGraphMap(params, callback){Promise}

leaflet/services/KnowledgeGraphService.js, line 75

获取图谱图序列化数据。

Name Type Description
params string

图谱名称。

callback RequestCallback

回调函数。

Returns:
Type Description
Promise Promise 对象。

getGraphMapData(graphMapName){Promise}

leaflet/services/KnowledgeGraphService.js, line 86

将 SuperMap iServer GraphMap 服务的数据格式转换为 KnowledgeGraph 的数据格式。

Name Type Description
graphMapName string

图谱名称。

Returns:
Type Description
Promise Promise 对象。

getGraphMaps(callback){Promise}

leaflet/services/KnowledgeGraphService.js, line 65

获取图谱列表。

Name Type Description
callback RequestCallback

回调函数。

Returns:
Type Description
Promise Promise 对象。

query(cypherQuery, callback){Promise}

leaflet/services/KnowledgeGraphService.js, line 45

通过查询语句查询知识图谱数据。

Name Type Description
cypherQuery string

查询条件。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

Type Definitions

findShortestPathParamsObject

Properties:
Name Type Description
startID string

开始节点的id

endID string

结束节点id