Example #1
0
        /// <summary>
        /// Decides which check connectedness operations are needed for the given node and edge of fixed direction
        /// and inserts them into the interpretation plan
        /// receives insertion point, returns new insertion point
        /// </summary>
        private InterpretationPlan decideOnAndInsertCheckConnectednessOfNodeFixedDirection(
            InterpretationPlan insertionPoint,
            SearchPlanNodeNode currentNode,
            SearchPlanEdgeNode edge,
            CheckCandidateForConnectednessType connectednessType)
        {
            Debug.Assert(connectednessType == CheckCandidateForConnectednessType.Source || connectednessType == CheckCandidateForConnectednessType.Target);

            // check whether the pattern edges which must be incident to the candidate node (according to the pattern)
            // are really incident to it
            // only if edge is already matched by now (signaled by visited)
            if (edge.Visited)
            {
                if (connectednessType == CheckCandidateForConnectednessType.Source)
                {
                    insertionPoint.next = new InterpretationPlanCheckConnectednessSource(
                        currentNode.nodeMatcher, edge.edgeMatcher);
                    insertionPoint = insertionPoint.next;
                }
                else //if(connectednessType == CheckCandidateForConnectednessType.Target)
                {
                    insertionPoint.next = new InterpretationPlanCheckConnectednessTarget(
                        currentNode.nodeMatcher, edge.edgeMatcher);
                    insertionPoint = insertionPoint.next;
                }
            }

            return(insertionPoint);
        }
Example #2
0
        /// <summary>
        /// Decides which check connectedness operations are needed for the given edge of fixed direction
        /// and inserts them into the interpretation plan
        /// receives insertion point, returns new insertion point
        /// </summary>
        private InterpretationPlan decideOnAndInsertCheckConnectednessOfEdgeFixedDirection(
            InterpretationPlan insertionPoint,
            SearchPlanEdgeNode edge,
            CheckCandidateForConnectednessType connectednessType)
        {
            Debug.Assert(connectednessType == CheckCandidateForConnectednessType.Source || connectednessType == CheckCandidateForConnectednessType.Target);

            // check whether source/target-nodes of the candidate edge
            // are the same as the already found nodes to which the edge must be incident
            // don't need to, if that node is not matched by now (signaled by visited)
            SearchPlanNodeNode nodeRequiringCheck =
                connectednessType == CheckCandidateForConnectednessType.Source ?
                edge.PatternEdgeSource : edge.PatternEdgeTarget;

            if (nodeRequiringCheck.Visited)
            {
                if (connectednessType == CheckCandidateForConnectednessType.Source)
                {
                    insertionPoint.next = new InterpretationPlanCheckConnectednessSource(
                        nodeRequiringCheck.nodeMatcher, edge.edgeMatcher);
                    insertionPoint = insertionPoint.next;
                }
                else //if(connectednessType == CheckCandidateForConnectednessType.Target)
                {
                    insertionPoint.next = new InterpretationPlanCheckConnectednessTarget(
                        nodeRequiringCheck.nodeMatcher, edge.edgeMatcher);
                    insertionPoint = insertionPoint.next;
                }
            }

            return(insertionPoint);
        }
Example #3
0
        public CheckCandidateForConnectedness(
            string patternElementName,
            string patternNodeName,
            string patternEdgeName,
            CheckCandidateForConnectednessType connectednessType)
            : base(patternElementName) // pattern element is the candidate to check, either node or edge
        {
            Debug.Assert(connectednessType != CheckCandidateForConnectednessType.TheOther);

            PatternNodeName   = patternNodeName;
            PatternEdgeName   = patternEdgeName;
            ConnectednessType = connectednessType;
        }
        /// <summary>
        /// Decides which check connectedness operations are needed for the given edge of fixed direction
        /// and inserts them into the interpretation plan
        /// receives insertion point, returns new insertion point
        /// </summary>
        private InterpretationPlan decideOnAndInsertCheckConnectednessOfEdgeFixedDirection(
            InterpretationPlan insertionPoint,
            SearchPlanEdgeNode edge,
            CheckCandidateForConnectednessType connectednessType)
        {
            Debug.Assert(connectednessType == CheckCandidateForConnectednessType.Source || connectednessType == CheckCandidateForConnectednessType.Target);

            // check whether source/target-nodes of the candidate edge
            // are the same as the already found nodes to which the edge must be incident
            // don't need to, if that node is not matched by now (signaled by visited)
            SearchPlanNodeNode nodeRequiringCheck = 
                connectednessType == CheckCandidateForConnectednessType.Source ?
                    edge.PatternEdgeSource : edge.PatternEdgeTarget;
            if (nodeRequiringCheck.Visited)
            {
                if(connectednessType == CheckCandidateForConnectednessType.Source)
                {
                    insertionPoint.next = new InterpretationPlanCheckConnectednessSource(
                            nodeRequiringCheck.nodeMatcher, edge.edgeMatcher);
                    insertionPoint = insertionPoint.next;
                }
                else //if(connectednessType == CheckCandidateForConnectednessType.Target)
                {
                    insertionPoint.next = new InterpretationPlanCheckConnectednessTarget(
                            nodeRequiringCheck.nodeMatcher, edge.edgeMatcher);
                    insertionPoint = insertionPoint.next;
                }
            }

            return insertionPoint;
        }
        /// <summary>
        /// Decides which check connectedness operations are needed for the given node and edge of fixed direction
        /// and inserts them into the interpretation plan
        /// receives insertion point, returns new insertion point
        /// </summary>
        private InterpretationPlan decideOnAndInsertCheckConnectednessOfNodeFixedDirection(
            InterpretationPlan insertionPoint,
            SearchPlanNodeNode currentNode,
            SearchPlanEdgeNode edge,
            CheckCandidateForConnectednessType connectednessType)
        {
            Debug.Assert(connectednessType == CheckCandidateForConnectednessType.Source || connectednessType == CheckCandidateForConnectednessType.Target);

            // check whether the pattern edges which must be incident to the candidate node (according to the pattern)
            // are really incident to it
            // only if edge is already matched by now (signaled by visited)
            if (edge.Visited)
            {
                if(connectednessType == CheckCandidateForConnectednessType.Source)
                {
                    insertionPoint.next = new InterpretationPlanCheckConnectednessSource(
                            currentNode.nodeMatcher, edge.edgeMatcher);
                    insertionPoint = insertionPoint.next;
                }
                else //if(connectednessType == CheckCandidateForConnectednessType.Target)
                {
                    insertionPoint.next = new InterpretationPlanCheckConnectednessTarget(
                            currentNode.nodeMatcher, edge.edgeMatcher);
                    insertionPoint = insertionPoint.next;
                }
            }

            return insertionPoint;
        }
        /// <summary>
        /// Decides which check connectedness operations are needed for the given edge of fixed direction
        /// and inserts them into the search program
        /// </summary>
        private SearchProgramOperation decideOnAndInsertCheckConnectednessOfEdgeFixedDirection(
            SearchProgramOperation insertionPoint,
            SearchPlanEdgeNode edge,
            CheckCandidateForConnectednessType connectednessType)
        {
            // check whether source/target-nodes of the candidate edge
            // are the same as the already found nodes to which the edge must be incident
            // don't need to, if that node is not matched by now (signaled by visited)
            SearchPlanNodeNode nodeRequiringCheck = 
                connectednessType == CheckCandidateForConnectednessType.Source ?
                    edge.PatternEdgeSource : edge.PatternEdgeTarget;
            if (nodeRequiringCheck.Visited)
            {
                CheckCandidateForConnectedness checkConnectedness =
                    new CheckCandidateForConnectedness(
                        edge.PatternElement.Name,
                        nodeRequiringCheck.PatternElement.Name,
                        edge.PatternElement.Name,
                        connectednessType);
                insertionPoint = insertionPoint.Append(checkConnectedness);
            }

            return insertionPoint;
        }
        /// <summary>
        /// Decides which check connectedness operations are needed for the given node and edge of fixed direction
        /// and inserts them into the search program
        /// </summary>
        private SearchProgramOperation decideOnAndInsertCheckConnectednessOfNodeFixedDirection(
            SearchProgramOperation insertionPoint,
            SearchPlanNodeNode currentNode,
            SearchPlanEdgeNode edge,
            CheckCandidateForConnectednessType connectednessType)
        {
            Debug.Assert(connectednessType == CheckCandidateForConnectednessType.Source || connectednessType == CheckCandidateForConnectednessType.Target);

            // check whether the pattern edges which must be incident to the candidate node (according to the pattern)
            // are really incident to it
            // only if edge is already matched by now (signaled by visited)
            if (edge.Visited)
            {
                CheckCandidateForConnectedness checkConnectedness =
                    new CheckCandidateForConnectedness(
                        currentNode.PatternElement.Name,
                        currentNode.PatternElement.Name,
                        edge.PatternElement.Name,
                        connectednessType);
                insertionPoint = insertionPoint.Append(checkConnectedness);
            }

            return insertionPoint;
        }
Example #8
0
        public CheckCandidateForConnectedness(
            string patternElementName,
            string patternNodeName,
            string patternEdgeName,
            string theOtherPatternNodeName,
            CheckCandidateForConnectednessType connectednessType)
        {
            Debug.Assert(connectednessType == CheckCandidateForConnectednessType.TheOther);

            // pattern element is the candidate to check, either node or edge
            PatternElementName = patternElementName;
            PatternNodeName = patternNodeName;
            PatternEdgeName = patternEdgeName;
            TheOtherPatternNodeName = theOtherPatternNodeName;
            ConnectednessType = connectednessType;
        }