Пример #1
0
        private void AddCommunityScoreSubpattern(PatternNode person)
        {
            var communityPoint = CreatePatternNode(PatternNodes.CommunityScore);

            person.ConnectTo(communityPoint, EdgeDirection.Both);
            this.pattern.AddNodes(communityPoint);
        }
Пример #2
0
        public PatternNode Copy()
        {
            var pn = new PatternNode(this.name, this.factory);

            pn.MatchedNode = this.MatchedNode;
            return(pn);
        }
Пример #3
0
        private void AddGroupLeaderSubpattern(PatternNode person)
        {
            var groupLeader = CreatePatternNode(PatternNodes.GroupLeader);

            person.ConnectTo(groupLeader, EdgeDirection.Both);

            this.pattern.AddNodes(groupLeader);
        }
Пример #4
0
        private void AddActiveMembershipSubpattern(PatternNode person)
        {
            var activeMembership2 = CreatePatternNode(PatternNodes.ActiveMembership2);
            var group2            = CreatePatternNode(PatternNodes.Group2);

            person.ConnectTo(activeMembership2, EdgeDirection.Both);
            activeMembership2.ConnectTo(group2, EdgeDirection.Both);

            this.pattern.AddNodes(activeMembership2, group2);
        }
Пример #5
0
        public void Deserialize(XmlReader reader, IContext context)
        {
            if (reader.Name != "CurrentPatternNodeName")
            {
                reader.ReadToFollowing("CurrentPatternNodeName");
            }

            this.CurrentPatternNodeName = reader.ReadElementContentAsString();

            this.CurrentNode = context.EntityFactory.CreateId();
            this.CurrentNode.Deserialize(reader, context);

            this.MatchedFullSubpattern = bool.Parse(reader.ReadElementContentAsString());

            if (reader.Name != "PatternNodes")
            {
                reader.ReadToFollowing("PatternNodes");
            }
            var subreader = reader.ReadSubtree();
            Dictionary <string, PatternNode> nodes = new Dictionary <string, PatternNode>();

            while (subreader.ReadToFollowing("PatternNode"))
            {
                var pn = new PatternNode(context.EntityFactory);
                pn.Deserialize(subreader.ReadSubtree(), context);
                nodes.Add(pn.Name, pn);
            }
            this.patternNodes = nodes;

            List <IMatchEdge> remoteEdges = new List <IMatchEdge>();

            if (reader.Name != "RemoteEdges")
            {
                reader.ReadToFollowing("RemoteEdges");
            }
            subreader = reader.ReadSubtree();
            while (subreader.ReadToFollowing("RemoteEdge"))
            {
                IMatchEdge e = (IMatchEdge)context.EntityFactory.CreateEdge();
                e.Deserialize(subreader.ReadSubtree(), context);
                remoteEdges.Add(e);
            }

            foreach (var pn in this.patternNodes.Values)
            {
                if (pn.IsMatched)
                {
                    pn.RemoteEdges = remoteEdges.Where(e =>
                    {
                        return(e.EndA.Id.Equals(pn.MatchedNode.Id) ||
                               e.EndB.Id.Equals(pn.MatchedNode.Id));
                    });
                }
            }
        }
Пример #6
0
        private void AddSemesterValuationWithActiveMemebershipSuppattern(PatternNode person)
        {
            var activeMembership1     = CreatePatternNode(PatternNodes.ActiveMembership1);
            var group1                = CreatePatternNode(PatternNodes.Group1);
            var semesterValuation     = CreatePatternNode(PatternNodes.SemesterValuation);
            var semesterValuationNext = CreatePatternNode(PatternNodes.SemesterValuationNext);

            person.ConnectTo(activeMembership1, EdgeDirection.Both);
            activeMembership1.ConnectTo(group1, EdgeDirection.Both);
            group1.ConnectTo(semesterValuation, EdgeDirection.Both);
            group1.ConnectTo(semesterValuationNext, EdgeDirection.Both);
            semesterValuation.ConnectTo(person, EdgeDirection.Both);
            semesterValuationNext.ConnectTo(person, EdgeDirection.Both);
            semesterValuation.ConnectTo(semesterValuation, EdgeDirection.Both);

            this.pattern.AddNodes(activeMembership1, group1, semesterValuation, semesterValuationNext);
        }
Пример #7
0
 public void Merge(PatternNode other)
 {
     this.MatchedNode   = other.MatchedNode;
     this.RemoteEdges   = other.RemoteEdges;
     this.IsRemoteMatch = true;
 }