var noteScope = _db.Query()
.For(a => AQL.Traversal<Target, Relates>(startAt, EdgeDirection.Inbound))
.For(target => AQL.Edges<Relates>(target.Vertex.Id, EdgeDirection.Inbound))
.Filter(relation => relation.Label == Relates.NoteAttachementLabel )
.Return(relation => relation.Out);
for `n` in `Note`
filter ( `n`.`_id` in (
for `target` in traversal( `Target` , `Relates` , "Target/roomstay:1001,1" , "inbound" )
for `relation` in edges( `Relates` , `target`.`Vertex` .`_id` , "inbound" )
filter ( `relation`.`Label` == "Note attached to" )
return `relation`.`_from` )
and ( length( intersection( `n`.`Relevances` , ["Check In","Service"] ) ) > 0 ) )
return `n`