@@ -208,19 +208,31 @@ circle.node-base {
208208 case "neo4j" :
209209 this . neo4jController = new Neo4jController ( { debug : true , connection : graph . connection } ) ;
210210 graph . config = new Neo4jGraphConfig ( graph . config ) ;
211- this . createGraphModelWithCypherQuery ( graph . connection . initialCypher , graph ) ;
211+ this . createGraphModelWithCypherQuery ( graph . connection . initialCypher , { graph : graph } ) ;
212212 break ;
213213 }
214214 }
215215
216- createGraphModelWithCypherQuery ( cypher : string , graph ?: Graph ) : void {
217- console . log ( `createGraphModelWithCypherQuery: cypher: ${ cypher } ` , graph ) ;
218- graph = graph || this . activeGraph ;
216+ createGraphModelWithCypherQuery ( cypher : string , options ?: any ) : void {
217+ let graph : Graph | undefined = this . activeGraph ;
218+ let addToExistingGraph : boolean = false ;
219+ if ( options ) {
220+ graph = options . graph || graph ;
221+ addToExistingGraph = options . addToExistingGraph ;
222+ }
223+ console . log ( `createGraphModelWithCypherQuery: cypher: ${ cypher } ` , graph , addToExistingGraph ) ;
219224 if ( this . neo4jController ) {
220225 this . neo4jController . getCypherAsD3 ( cypher )
221226 . then ( data => {
222227 console . log ( data ) ;
223- this . graphModel = ModelToD3 . parseD3 ( data , undefined , this . getSvgOrigin ( ) ) ;
228+ let newGraphModel = ModelToD3 . parseD3 ( data , undefined , this . getSvgOrigin ( ) ) ;
229+ if ( addToExistingGraph ) {
230+ const existingData : any = ModelToD3 . convert ( this . graphModel ) ;
231+ const mergedData = ModelToD3 . mergeD3 ( data , existingData ) ;
232+ console . log ( mergedData ) ;
233+ newGraphModel = ModelToD3 . parseD3 ( mergedData , undefined , this . getSvgOrigin ( ) ) ;
234+ }
235+ this . graphModel = newGraphModel ;
224236 this . _activeNode = this . graphModel . nodeList ( ) [ 0 ] ;
225237 this . _activeRelationship = this . graphModel . relationshipList ( ) [ 0 ] ;
226238 this . activeGraph = graph ;
0 commit comments