예제 #1
0
 public void AddRelatedNode(BirdsNestNode node)
 {
     if (this._relatedNodes.ContainsKey(node.DbId) == false)
     {
         this._relatedNodes.Add(node.DbId, node);
     }
 }
예제 #2
0
 public RelatedDetail(BirdsNestNode node, ResultSet set)
 {
     this.Node = node;
     foreach (BirdsNestNode newnode in set.Nodes)
     {
         this.AddRelatedNode(newnode);
     }
     foreach (BirdsNestRelationship newrel in set.Edges)
     {
         this.AddDirectEdge(newrel);
     }
 }
예제 #3
0
        private void AddToResultSet(object o, ResultSet results)
        {
            INode node = o as INode;

            if (node != null)
            {
                results.Nodes.Add(BirdsNestNode.GetNode(node));
                return;
            }

            List <object> nodelist = o as List <object>;

            if (nodelist != null)
            {
                foreach (object obj in nodelist)
                {
                    AddToResultSet(obj, results);
                }
                return;
            }

            IRelationship rel = o as IRelationship;

            if (rel != null)
            {
                results.Edges.Add(BirdsNestRelationship.GetRelationship(rel));
                return;
            }

            IPath path = o as IPath;

            if (path != null)
            {
                foreach (INode n in path.Nodes)
                {
                    results.Nodes.Add(BirdsNestNode.GetNode(n));
                }
                foreach (IRelationship r in path.Relationships)
                {
                    results.Edges.Add(BirdsNestRelationship.GetRelationship(r));
                }
                return;
            }
        }
예제 #4
0
        public static BirdsNestNode GetNode(INode noderecord)
        {
            BirdsNestNode newnode = new BirdsNestNode();

            newnode.DbId       = noderecord.Id;
            newnode.Properties = noderecord.Properties;

            object o;

            if (newnode.Properties.TryGetValue("name", out o))
            {
                newnode.Name = o.ToString();
            }

            if (newnode.Properties.TryGetValue("scope", out o))
            {
                newnode.Scope = (long)o;
            }

            newnode.Labels = noderecord.Labels as List <string>;

            return(newnode);
        }