In OrientDB I have setup a time series using this use case. However, instead of appending my Vertex as an embedded list to the respective hour I have opted to just create an edge from the hour to the time dependent Vertex.
For arguments sake lets say that each hour has up to 60 time Vertex
each identified by a timestamp. This means I can perform the following query to obtain a specific desired Vertex:
SELECT FROM ( SELECT expand( month[5].day[12].hour[0].out() ) FROM Year WHERE year = 2015) WHERE timestamp = 1434146922
The first part of this question is whether there are any advantages/disadvantages to storing the timestamp as a property of the Vertex (as above query) versus storing it as the edge (or an edge property). In which case I think the query would be:
SELECT expand( month[5].day[12].hour[0].out('1434146922') ) FROM Year WHERE year = 2015
Although this looks more elegant I have 2 concerns; the overhead of creating new edge types. The flexibility if you don't actually know the exact timestamp.
The second part of the question relates to the fact that once I have isolated the individual Vertex based on time, this is only the head of a hierarchal tree of Vertex.
I could of course get the @rid
from the above query and then construct a new query but I was wondering how I could adapt the above to do it all in one. For example assume there is a boolean
property called active
in all the hierarchal Vertexes. How can I get all the Vertex that are true
?
Aucun commentaire:
Enregistrer un commentaire