I have a generic (non-V) class with a LINKMAP field that links a chain of time-series data. Each record links to the next record based on a key of the next month/day/hour/etc. and a value of the @rid of the next record. I could use edges (non-lightweight, with a single property the same as the LINKMAP key), but I don't want to because I only need a one-direction link and want to use the least amount of storage space (plus my assumption is that while using edges might offer slightly easier querying, it wouldn't offer any benefit in terms of performance or storage space).
I currently have the following batch query:
let r = select from data where key='AAA';
let y = select expand(links['2017']) from $r;
let m = select expand(links['07']) from $y;
let d = select expand(links['15']) from $m;
let h = select expand(links['10']) from $d;
return (select $r, $y, $m, $d, $h)
This works, in the sense that I get a result set with the @rids of each record in the link'ed list.
I have two questions:
- Is there a more efficient way to do this query? I've tried various TRAVERSE options with $path and such, but nothing else I attempted worked at all. I did not try MATCH because I'm not using edges.
- The current result set is flat, with each value prop ($r, $y, etc.) containing the corresponding @rid. That's OK for my purposes, but I'd like to know if there's a way to return the actual records instead of just the @rids. Nothing I've tried works.
PS - I'm using orientjs, but the batch runs identically from the console as well.