/// <summary> /// Creates a Match object. /// </summary> /// <param name="graph"> A graph to conduct a query on. </param> /// <param name="variableMap"> An empty map of variables. </param> /// <param name="executionHelper"> A match execution helper. </param> /// <param name="matchNode"> A parse tree of match expression. </param> /// <param name="exprInfo"> A query expression information. </param> public MatchObject(Graph graph, VariableMap variableMap, IMatchExecutionHelper executionHelper, MatchNode matchNode, QueryExpressionInfo exprInfo) { if (executionHelper == null || matchNode == null || variableMap == null || graph == null) { throw new ArgumentNullException($"{this.GetType()}, passing null arguments to the constructor."); } this.helper = executionHelper; MatchVisitor matchVisitor = new MatchVisitor(graph.nodeTables, graph.edgeTables); matchNode.Accept(matchVisitor); // Create real pattern and variableMap. var result = matchVisitor.GetResult(); this.CheckParsedPatternCorrectness(result); // Create matcher and pattern based on the name of matcher and pattern. // Change if necessary . this.pattern = MatchFactory.CreatePattern(helper.ParallelPatternMatcherName, helper.PatternName, variableMap, result); // Now we have got enough information about results. // After creating pattern the variable map is filled and we know extend of the results. this.queryResults = new MatchFixedResults(this.helper.FixedArraySize, variableMap.GetCount(), executionHelper.ThreadCount); this.matcher = MatchFactory.CreateMatcher(helper.ParallelPatternMatcherName, pattern, graph, this.queryResults, executionHelper); }
/// <summary> /// Creates Streamed Match object. /// </summary> /// <param name="graph"> Graph to conduct a query on. </param> /// <param name="variableMap"> Empty map of variables. </param> /// <param name="executionHelper"> Match execution helper. </param> /// <param name="matchNode"> Parse tree of match expression. </param> /// <param name="exprInfo"> A query expression information. </param> public MatchObjectStreamed(Graph graph, VariableMap variableMap, IMatchExecutionHelper executionHelper, MatchNode matchNode, QueryExpressionInfo exprInfo) { if (executionHelper == null || matchNode == null || variableMap == null || graph == null) { throw new ArgumentNullException($"{this.GetType()}, passing null arguments to the constructor."); } this.helper = executionHelper; MatchVisitor matchVisitor = new MatchVisitor(graph.nodeTables, graph.edgeTables); matchNode.Accept(matchVisitor); //Create real pattern and variableMap var result = matchVisitor.GetResult(); this.CheckParsedPatternCorrectness(result); // Create matcher and pattern based on the name of matcher and pattern // Change if necessary this.pattern = MatchFactory.CreatePattern(helper.ParallelPatternMatcherName, helper.PatternName, variableMap, result); this.matcher = (IPatternMatcherStreamed)MatchFactory.CreateMatcher(helper.ParallelPatternMatcherName, pattern, graph, executionHelper); }