public override async Task VisitRecursionQueryStepAsync(RecursionQueryStep rqs)
        {
            _writer.WriteStartObject();
            _writer.WritePropertyName("Type");
            _writer.WriteString("RecursionQueryStep");
            _writer.WriteComma();
            _writer.WritePropertyName("Left");
            await VisitAsync(rqs.Left);

            _writer.WriteComma();
            _writer.WritePropertyName("Steps");
            _writer.WriteStartArray();
            var first = true;

            foreach (var step in rqs.Steps)
            {
                if (first == false)
                {
                    _writer.WriteComma();
                }

                first = false;
                await VisitAsync(step.Right);
            }
            _writer.WriteEndArray();
            _writer.WriteComma();
            await VisitAsync(rqs.GetNextStep());

            WriteIntermidiateResults(rqs.IntermediateResults);
            _writer.WriteEndObject();
        }
Beispiel #2
0
        public virtual void VisitRecursionQueryStep(RecursionQueryStep rqs)
        {
            Visit(rqs.Left);

            foreach (var step in rqs.Steps)
            {
                Visit(step.Right);
            }

            Visit(rqs.GetNextStep());
        }
Beispiel #3
0
        public virtual async Task VisitRecursionQueryStepAsync(RecursionQueryStep rqs)
        {
            await VisitAsync(rqs.Left);

            foreach (var step in rqs.Steps)
            {
                await VisitAsync(step.Right);
            }

            await VisitAsync(rqs.GetNextStep());
        }
Beispiel #4
0
        public override IGraphQueryStep VisitRecursionQueryStep(RecursionQueryStep rqs)
        {
            _token.ThrowIfCancellationRequested();
            var  left     = Visit(rqs.Left);
            bool modified = ReferenceEquals(left, rqs.Left) == false;

            var steps = new List <SingleEdgeMatcher>();

            foreach (var step in rqs.Steps)
            {
                _isVisitingRight = true;
                var right = Visit(step.Right);
                _isVisitingRight = false;
                if (ReferenceEquals(right, step.Right) == false)
                {
                    modified = true;
                    steps.Add(new SingleEdgeMatcher(step, right, _documentsStorage.DocumentDatabase.IdentityPartsSeparator));
                }
                else
                {
                    steps.Add(step);
                }
            }
            var next = rqs.GetNextStep();

            Visit(next);

            if (modified == false)
            {
                return(rqs);
            }

            var result = new RecursionQueryStep(rqs, left, steps, _token);

            if (next != null)
            {
                next.SetPrev(result);
                result.SetNext(next);
                result.SetAliases(rqs.GetAllAliases());
            }

            return(result);
        }
Beispiel #5
0
        public virtual IGraphQueryStep VisitRecursionQueryStep(RecursionQueryStep rqs)
        {
            _token.ThrowIfCancellationRequested();
            var  left     = Visit(rqs.Left);
            bool modified = ReferenceEquals(left, rqs.Left) == false;

            var steps = new List <SingleEdgeMatcher>();

            foreach (var step in rqs.Steps)
            {
                var right = Visit(step.Right);
                if (ReferenceEquals(right, step.Right) == false)
                {
                    modified = true;
                    steps.Add(new SingleEdgeMatcher(step, right));
                }
                else
                {
                    steps.Add(step);
                }
            }

            var next = rqs.GetNextStep();

            if (next != null)
            {
                Visit(next);
            }

            if (modified)
            {
                return(new RecursionQueryStep(rqs, left, steps, _token));
            }

            return(rqs);
        }