示例#1
0
 internal virtual GraphViewExecutionOperator Compile(QueryCompilationContext context, GraphViewConnection dbConnection)
 {
     return(null);
 }
示例#2
0
        internal override ScalarFunction CompileToFunction(QueryCompilationContext context, GraphViewConnection dbConnection)
        {
            string funcName = FunctionName.ToString().ToLowerInvariant();

            switch (funcName)
            {
            case "withinarray":
                WColumnReferenceExpression checkField = Parameters[0] as WColumnReferenceExpression;
                WColumnReferenceExpression arrayField = Parameters[1] as WColumnReferenceExpression;
                return(new WithInArray(context.LocateColumnReference(checkField), context.LocateColumnReference(arrayField)));

            case "withoutarray":
                checkField = Parameters[0] as WColumnReferenceExpression;
                arrayField = Parameters[1] as WColumnReferenceExpression;
                return(new WithOutArray(context.LocateColumnReference(checkField), context.LocateColumnReference(arrayField)));

            case "hasproperty":
                checkField = Parameters[0] as WColumnReferenceExpression;
                WValueExpression propertyName = Parameters[1] as WValueExpression;
                return(new HasProperty(context.LocateColumnReference(checkField), propertyName.Value));

            case "compose1":
                List <Tuple <string, int> > targetFieldsAndTheirNames = new List <Tuple <string, int> >();
                WValueExpression            defaultProjectionKey      = Parameters[0] as WValueExpression;
                if (defaultProjectionKey == null)
                {
                    throw new SyntaxErrorException("The first parameter of Compose1 has to be a WValueExpression.");
                }

                for (int i = 1; i < Parameters.Count; i += 2)
                {
                    WColumnReferenceExpression columnRef = Parameters[i] as WColumnReferenceExpression;
                    WValueExpression           name      = Parameters[i + 1] as WValueExpression;

                    if (name == null)
                    {
                        throw new SyntaxErrorException("The parameter of Compose1 at an odd position has to be a WValueExpression.");
                    }
                    if (columnRef == null)
                    {
                        throw new SyntaxErrorException("The parameter of Compose1 at an even position has to be a WColumnReference.");
                    }

                    targetFieldsAndTheirNames.Add(new Tuple <string, int>(name.Value, context.LocateColumnReference(columnRef)));
                }

                return(new Compose1(targetFieldsAndTheirNames, defaultProjectionKey.Value));

            case "compose2":
                List <ScalarFunction> inputOfCompose2 = new List <ScalarFunction>();

                foreach (var parameter in Parameters)
                {
                    inputOfCompose2.Add(parameter.CompileToFunction(context, dbConnection));
                }

                return(new Compose2(inputOfCompose2));

            case "path":
                List <Tuple <ScalarFunction, bool, HashSet <string> > > pathStepList;
                List <ScalarFunction> byFuncList;
                WPathTableReference.GetPathStepListAndByFuncList(context, dbConnection, this.Parameters,
                                                                 out pathStepList, out byFuncList);
                return(new Path(pathStepList));

            default:
                throw new NotImplementedException("Function " + funcName + " hasn't been implemented.");
            }
            throw new NotImplementedException("Function " + funcName + " hasn't been implemented.");
        }
 internal override BooleanFunction CompileToFunction(QueryCompilationContext context, GraphViewConnection dbConnection)
 {
     return(Expression.CompileToFunction(context, dbConnection));
 }
示例#4
0
 internal virtual ScalarFunction CompileToFunction(QueryCompilationContext context, GraphViewConnection dbConnection)
 {
     throw new NotImplementedException();
 }
 internal virtual BooleanFunction CompileToFunction(QueryCompilationContext context, GraphViewConnection dbConnection)
 {
     return(null);
 }