private IEnumerable <Node> CheckMetadataDateTimeOperator(Node node, GraphQueryMetadata metadataTest)
        {
            IEnumerable <Node> stoppingPointNodes = null;

            if (metadataTest.Operator == "Equals")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) == DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "NotEquals")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) != DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "GreaterThan")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) > DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "LessThan")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) < DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "GreaterThanOrEqual")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) >= DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "LessThanOrEqual")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) <= DateTime.Parse(metadataTest.Value)).Count() > 0);
            }

            return(stoppingPointNodes);
        }
        private IEnumerable <Node> CheckMetadataStringOperator(Node node, GraphQueryMetadata metadataTest)
        {
            IEnumerable <Node> stoppingPointNodes = null;

            if (metadataTest.Operator == "Equals")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue == metadataTest.Value).Count() > 0);
            }
            else if (metadataTest.Operator == "NotEquals")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue != metadataTest.Value).Count() > 0);
            }

            return(stoppingPointNodes);
        }
        private IEnumerable<Node> CheckMetadataStringOperator(MappingToolDatabaseDataContext dbContext, IEnumerable<Node> nodes, GraphQueryMetadata metadataTest)
        {
            List<Node> filteredNodes = null;

            if (metadataTest.Operator.Equals("Contains", StringComparison.InvariantCultureIgnoreCase))
            {
                IQueryable<Node> queryableNodes = nodes.AsQueryable();
                var filteredMetadata = from dbMetadata in dbContext.udf_SearchMetadataContains(metadataTest.Name, metadataTest.Value) select dbMetadata;
                int counter = filteredMetadata.Count();
                filteredNodes = nodes.Join(filteredMetadata, x => x.NodeUid, y => y.NodeUid, (a, b) => a).ToList();
            }
            else if (metadataTest.Operator.Equals("FreeText", StringComparison.InvariantCultureIgnoreCase))
            {
                IQueryable<Node> queryableNodes = nodes.AsQueryable();
                var filteredMetadata = from dbMetadata in dbContext.udf_SearchMetadataFreeText(metadataTest.Name, metadataTest.Value) select dbMetadata;
                int counter = filteredMetadata.Count();
                filteredNodes = nodes.Join(filteredMetadata, x => x.NodeUid, y => y.NodeUid, (a, b) => a).ToList();
            }
            else
            {
                filteredNodes = new List<Node>();

                foreach (Node node in nodes)
                {
                    if (metadataTest.Operator.Equals("Equals", StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue.Contains(metadataTest.Value)).Count() > 0)
                        {
                            filteredNodes.Add(node);
                        }
                    }
                    else if (metadataTest.Operator.Equals("NotEquals", StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue != metadataTest.Value).Count() > 0)
                        {
                            filteredNodes.Add(node);
                        }
                    }
                }
            }

            return filteredNodes;
        }
        private IEnumerable <Node> CheckMetadataStringOperator(MappingToolDatabaseDataContext dbContext, IEnumerable <Node> nodes, GraphQueryMetadata metadataTest)
        {
            List <Node> filteredNodes = null;

            if (metadataTest.Operator.Equals("Contains", StringComparison.InvariantCultureIgnoreCase))
            {
                IQueryable <Node> queryableNodes = nodes.AsQueryable();
                var filteredMetadata             = from dbMetadata in dbContext.udf_SearchMetadataContains(metadataTest.Name, metadataTest.Value) select dbMetadata;
                int counter = filteredMetadata.Count();
                filteredNodes = nodes.Join(filteredMetadata, x => x.NodeUid, y => y.NodeUid, (a, b) => a).ToList();
            }
            else if (metadataTest.Operator.Equals("FreeText", StringComparison.InvariantCultureIgnoreCase))
            {
                IQueryable <Node> queryableNodes = nodes.AsQueryable();
                var filteredMetadata             = from dbMetadata in dbContext.udf_SearchMetadataFreeText(metadataTest.Name, metadataTest.Value) select dbMetadata;
                int counter = filteredMetadata.Count();
                filteredNodes = nodes.Join(filteredMetadata, x => x.NodeUid, y => y.NodeUid, (a, b) => a).ToList();
            }
            else
            {
                filteredNodes = new List <Node>();

                foreach (Node node in nodes)
                {
                    if (metadataTest.Operator.Equals("Equals", StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue.Contains(metadataTest.Value)).Count() > 0)
                        {
                            filteredNodes.Add(node);
                        }
                    }
                    else if (metadataTest.Operator.Equals("NotEquals", StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue != metadataTest.Value).Count() > 0)
                        {
                            filteredNodes.Add(node);
                        }
                    }
                }
            }

            return(filteredNodes);
        }
        private IEnumerable <Node> CheckMetadataDateTimeOperator(IEnumerable <Node> nodes, GraphQueryMetadata metadataTest)
        {
            List <Node> filteredNodes = new List <Node>();

            foreach (Node node in nodes)
            {
                if (metadataTest.Operator.Equals("Equals", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) == DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("NotEquals", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) != DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("GreaterThan", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) > DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("LessThan", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) < DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("GreaterThanOrEqual", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) >= DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("LessThanOrEqual", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) <= DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
            }

            return(filteredNodes);
        }
        private IEnumerable<Node> CheckMetadataDateTimeOperator(IEnumerable<Node> nodes, GraphQueryMetadata metadataTest)
        {
            List<Node> filteredNodes = new List<Node>();

            foreach (Node node in nodes)
            {
                if (metadataTest.Operator.Equals("Equals", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) == DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("NotEquals", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) != DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("GreaterThan", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) > DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("LessThan", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) < DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("GreaterThanOrEqual", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) >= DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
                else if (metadataTest.Operator.Equals("LessThanOrEqual", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) <= DateTime.Parse(metadataTest.Value)).Count() > 0)
                    {
                        filteredNodes.Add(node);
                    }
                }
            }

            return filteredNodes;
        }
        private IEnumerable<Node> CheckMetadataDateTimeOperator(Node node, GraphQueryMetadata metadataTest)
        {
            IEnumerable<Node> stoppingPointNodes = null;

            if (metadataTest.Operator == "Equals")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) == DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "NotEquals")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) != DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "GreaterThan")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) > DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "LessThan")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) < DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "GreaterThanOrEqual")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) >= DateTime.Parse(metadataTest.Value)).Count() > 0);
            }
            else if (metadataTest.Operator == "LessThanOrEqual")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && DateTime.Parse(metadata.MetadataValue) <= DateTime.Parse(metadataTest.Value)).Count() > 0);
            }

            return stoppingPointNodes;
        }
        private IEnumerable<Node> CheckMetadataStringOperator(Node node, GraphQueryMetadata metadataTest)
        {
            IEnumerable<Node> stoppingPointNodes = null;

            if (metadataTest.Operator == "Equals")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue == metadataTest.Value).Count() > 0);
            }
            else if (metadataTest.Operator == "NotEquals")
            {
                stoppingPointNodes = node.GetConnectedNodes((Descriptor localDescriptor) => true, (Descriptor foreignDescriptor) => foreignDescriptor.Node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue != metadataTest.Value).Count() > 0);
            }

            return stoppingPointNodes;
        }