ArangoDB: traverse only edges within a time range

mikewilliamson

I am experimenting with time based versioning. I have created a vertex that is connected to other vertices with this edge on one side:

{
  "_id": "edges/426647569364",
  "_key": "426647569364",
  "_rev": "426647569364",
  "_from": "nodes/426640688084",
  "_to": "nodes/426629284820",
  "valid_from": "1385787600000",
  "valid_till": "9007199254740991"
}

And this edge on the other:

{
  "_id": "edges/426679485396",
  "_key": "426679485396",
  "_rev": "426845488084",
  "_from": "nodes/426675749844",
  "_to": "nodes/426629284820",
  "valid_from": "1322629200000",
  "valid_till": "1417323600000"
}

The valid_till value in the first edge is the output of the Number.MAX_SAFE_INTEGER function.

I looked at custom vistors a little and it looks like its focused on filtering vertices rather than edges.

How can I restrict my traversal to edges with a valid_till value between new Date().getTime() and Number.MAX_SAFE_INTEGER?

stj

You can use the followEdges attribute in a traversal. followEdges can optionally be a JavaScript function for filtering edges. It will be invoked for each edge in the traversal:

var expandFilter = function (config, vertex, edge, path) { 
  return (edge.vaild_till >= new Date().getTime() && 
          edge.valid_till <= Number.MAX_SAFE_INTEGER);

};

require("org/arangodb/aql/functions").register("my::expandFilter", expandFilter);

It can then be used in a traversal like a regular custom filter by specifying it in the followEdges attribute of the traversal options, e.g.:

LET options = { 
   followEdges: 'my::expandFilter' 
}
FOR doc IN TRAVERSAL(nodes, edges, 'nodes/startNode', 'inbound', options) 
  RETURN doc.vertex

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

ArangoDB: traverse only edges within a time range

From Dev

arangodb traverse tree including edges

From Dev

arangodb traverse tree including edges

From Dev

Count time within time range

From Dev

Programmatically creating edges in ArangoDB

From Dev

Traverse up in ArangoDB

From Dev

How to find all nodes within a range of weighted edges with gremlin?

From Dev

Count weekdays within range of time

From Dev

ArangoDB copy Vertex and Edges to neighbors

From Dev

Traverse a tree represented by its edges

From Dev

Traverse directed edges recursively with OrientDB

From Dev

how to traverse all edges efficiently?

From Dev

how to check if time is within a specific range in swift

From Dev

Determine if the time an a certain timezone is within a range

From Dev

Merge array elements within time range - how?

From Dev

Select rows within a particular time range

From Dev

Float to minutes and seconds within time range in R?

From Dev

remove files within specific time range

From Dev

Determine if the time an a certain timezone is within a range

From Dev

How to check if a time is within a range with date

From Dev

Allow entry in QLineEdit only within range of QDoubleValidator

From Dev

Only show results within range chosen by user

From Dev

ArangoDB: is it possible to 'fake' edges in a graph traversal?

From Dev

Is it possible to create edges and vertexes simultaneously in ArangoDB

From Java

sed extract data only between time range

From Dev

PHP check if time falls within range, questioning common solution

From Dev

SQlite: Select rows within a specific time range, ignoring the date

From Dev

How to grep a group of files within a specific time range

From Java

Generate random time within a range of two times with condition

Related Related

  1. 1

    ArangoDB: traverse only edges within a time range

  2. 2

    arangodb traverse tree including edges

  3. 3

    arangodb traverse tree including edges

  4. 4

    Count time within time range

  5. 5

    Programmatically creating edges in ArangoDB

  6. 6

    Traverse up in ArangoDB

  7. 7

    How to find all nodes within a range of weighted edges with gremlin?

  8. 8

    Count weekdays within range of time

  9. 9

    ArangoDB copy Vertex and Edges to neighbors

  10. 10

    Traverse a tree represented by its edges

  11. 11

    Traverse directed edges recursively with OrientDB

  12. 12

    how to traverse all edges efficiently?

  13. 13

    how to check if time is within a specific range in swift

  14. 14

    Determine if the time an a certain timezone is within a range

  15. 15

    Merge array elements within time range - how?

  16. 16

    Select rows within a particular time range

  17. 17

    Float to minutes and seconds within time range in R?

  18. 18

    remove files within specific time range

  19. 19

    Determine if the time an a certain timezone is within a range

  20. 20

    How to check if a time is within a range with date

  21. 21

    Allow entry in QLineEdit only within range of QDoubleValidator

  22. 22

    Only show results within range chosen by user

  23. 23

    ArangoDB: is it possible to 'fake' edges in a graph traversal?

  24. 24

    Is it possible to create edges and vertexes simultaneously in ArangoDB

  25. 25

    sed extract data only between time range

  26. 26

    PHP check if time falls within range, questioning common solution

  27. 27

    SQlite: Select rows within a specific time range, ignoring the date

  28. 28

    How to grep a group of files within a specific time range

  29. 29

    Generate random time within a range of two times with condition

HotTag

Archive