@@ -46,6 +46,18 @@ export class KnowledgeGraphService extends CommonServiceBase {
4646 this . processAsync ( { url, params, method : 'GET' , callback } ) ;
4747 }
4848
49+ // /**
50+ // * @function KnowledgeGraphService.prototype.queryById
51+ // * @description 根据实体id查询关联节点。
52+ // * @param {string } id - 实体id。
53+ // * @param {RequestCallback } callback 回调函数。
54+ // */
55+ // queryById(id, callback) {
56+ // const paramKey = 'cypherQuery';
57+ // const url = Util.urlAppend(this.url + '/query.json', `${paramKey}=match p=(n)-[]-(m) where id(n)=${id} return p;`);
58+ // this.processAsync({ url, method: 'GET', callback });
59+ // }
60+
4961 // /**
5062 // * @function KnowledgeGraphService.prototype.getMetaData
5163 // * @description 获取元信息(展示所有实体类型和关系类型。)
@@ -90,15 +102,32 @@ export class KnowledgeGraphService extends CommonServiceBase {
90102 return ;
91103 }
92104 const queries = graphMap . dataContent . queries . query ;
105+ const expandQueries = this . _getGraphMapExpandQuery ( graphMap ) ;
106+ queries . push ( ...expandQueries ) ;
93107 for ( let j = 0 ; j < queries . length ; j ++ ) {
94108 const cypherQuery = queries [ j ] ;
95109 const res = await this . _queryDataBySql ( cypherQuery ) ;
96110 data = data . concat ( [ ] , res ) ;
97111 }
98-
99112 return { data, graphMap } ;
100113 }
101114
115+ /**
116+ * @private
117+ * @function KnowledgeGraphService.prototype._getGraphMapExpandQuery
118+ * @description 获取graphMap图谱展开节点的query条件
119+ * @param {Object } graphMap -将iServer GraphMap图谱服务的数据
120+ * @param {Array.<string> } 查询条件
121+ */
122+ _getGraphMapExpandQuery ( graphMap ) {
123+ const queries = [ ] ;
124+ const expandIds = ( graphMap . dataContent . expand && JSON . parse ( graphMap . dataContent . expand ) ) || [ ] ;
125+ expandIds . forEach ( ( id ) => {
126+ queries . push ( `match p=(n)-[]-(m) where id(n)=${ id } return p;` ) ;
127+ } ) ;
128+ return queries ;
129+ }
130+
102131 // /**
103132 // * @private
104133 // * @function KnowledgeGraphService.prototype.getEntities
0 commit comments