Skip to content

Commit

Permalink
Traversal query [OT-I432] (#905)
Browse files Browse the repository at this point in the history
Changed traversal query
  • Loading branch information
alexveljkovic authored and simonovic86 committed Mar 27, 2019
1 parent 6bdab6e commit f160880
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
37 changes: 20 additions & 17 deletions modules/Database/Arangojs.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,23 +231,26 @@ class ArangoJS {
if (startVertex === undefined || startVertex._key === undefined) {
return [];
}
const queryString = `FOR vertex, edge, path
IN 1 .. ${depth}
OUTBOUND 'ot_vertices/${startVertex._key}'
ot_edges
OPTIONS {bfs: false, uniqueVertices: 'path'}
FILTER edge.edge_type != 'IDENTIFIES'
AND edge.edge_type != 'IDENTIFIED_BY'
AND edge._to != 'ot_vertices/Actor'
AND edge._to != 'ot_vertices/Product'
AND edge._to != 'ot_vertices/Location'
AND edge._to != 'ot_vertices/Transport'
AND edge._to != 'ot_vertices/Transformation'
AND edge._to != 'ot_vertices/Observation'
AND edge._to != 'ot_vertices/Ownership'
AND vertex.vertex_type != 'CLASS'
AND vertex.vertex_type != 'IDENTIFIER'
RETURN path`;
const queryString = `let vertices = (FOR v, e, p IN 0..${depth} OUTBOUND 'ot_vertices/${startVertex._key}' ot_edges
OPTIONS {
bfs: true,
uniqueVertices: 'global',
uniqueEdges: 'path'
}
FILTER p.vertices[*].vertex_type ALL != 'CLASS'
FILTER p.edges[*].edge_type ALL != 'IDENTIFIES'
RETURN v)
let edges = (FOR v, e, p IN 0..${depth} OUTBOUND 'ot_vertices/${startVertex._key}' ot_edges
OPTIONS {
bfs: true,
uniqueVertices: 'global',
uniqueEdges: 'path'
}
FILTER p.vertices[*].vertex_type ALL != 'CLASS'
FILTER p.edges[*].edge_type ALL != 'IDENTIFIES'
RETURN e)
RETURN {vertices, edges}`;

const rawGraph = await this.runQuery(queryString);

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "2.0.50",
"version": "2.0.51",
"description": "OriginTrail node",
"main": ".eslintrc.js",
"config": {
Expand Down

0 comments on commit f160880

Please sign in to comment.