Is there a way to check how many records were found, and in case less than X records were returned do another query?
For example first run this query ->
g.V().
hasLabel('courseContent').
has('status', 'active').as('cc').
outE('ccBelongsToCourse').
has('status', 'active').
inV().
hasLabel('course').
has('externalId', ':courseId').
select('cc').by(valueMap('externalId')).
dedup().
range(:offSet, :limit);
And in case less than 10 records were found, run this query:
g.V().
hasLabel('educatorContent').
has('status', 'active').as('ec').
select('ec').by(valueMap('externalId')).
dedup().
range(:offSet, :limit);
but do it all inside the same .gremlin
file?
(Sorry if the question is too basic, super new to Gremlin)
You could use choose()
which provides if-then semantics:
range(:offSet, :limit).fold().
choose(count(local).is(gt(9)),
identity(),
V().has('educatorContent', 'status','active')....)