Exemplo n.º 1
0
 public Edge(Vertex Vertex1, Vertex Vertex2, string Type,
             string Relationship, string Comment, int Weight)
 {
     this.Vertex1 = Vertex1;
     this.Vertex2 = Vertex2;
     this.Type = Type;
     this.Relationship = Relationship;
     this.Comment = Comment;            
     this.Weight = Weight;
     this.FeedOfOrigin = "";
     this.Direction = EdgeDirection.Undirected;
 }
Exemplo n.º 2
0
 public Edge(Vertex Vertex1, Vertex Vertex2, string Type,
             string Relationship, string Comment, int Weight,
             int Timestamp, string FeedOfOrigin, EdgeDirection eDirection)
 {
     this.Vertex1 = Vertex1;
     this.Vertex2 = Vertex2;
     this.Type = Type;
     this.Relationship = Relationship;
     this.Comment = Comment;
     this.Weight = Weight;
     this.FeedOfOrigin = FeedOfOrigin;
     if (Timestamp > 0)
         this.Timestamp = DateUtil.ConvertToDateTime(Timestamp);
     this.Direction = eDirection;
 }
Exemplo n.º 3
0
 private bool Equals(Vertex obj)
 {
     return (obj != null &&                    
             obj.ID.Equals(this.ID));
 }
        private void GetLikers
        (        
            bool bLimitCommentsLikes,
            int iNrLimit
        )
        {
            int iIndex = 1;
            int iCount = oPosts.Count;

            List<JSONObject> oTmpLikers = new List<JSONObject>();
            foreach (KeyValuePair<string, List<JSONObject>> kvp in oPosts)
            {
                ReportProgress(String.Format("Downloading Likers (Batch {0}/{1})", iIndex, iCount));
                foreach (JSONObject oPost in kvp.Value)
                {
                    int iNrOfComments = (int)oPost.Dictionary["like_info"].Dictionary["like_count"].Integer;
                    if(bLimitCommentsLikes)
                    {
                        oTmpLikers = GetInfo("like", oPost.Dictionary["post_id"].String, iNrLimit, iNrOfComments, 0);
                    }
                    else
                    {
                        oTmpLikers = GetInfo("like", oPost.Dictionary["post_id"].String, -1, iNrOfComments, 0);
                    }
                    oLikers.AddRange(oTmpLikers);
                    foreach (JSONObject oLike in oTmpLikers)
                    {
                        Vertex oLiker = new Vertex(oLike.Dictionary["user_id"].String, "", "Liker");
                        oVertices.Add(oLiker);
                    }
                }
                iIndex++;
            }            
        }
 private void GetUsersTagged
 (            
 )
 {
     int iIndex = 1;
     int iCount = oPosts.Count;
     foreach (KeyValuePair<string, List<JSONObject>> kvp in oPosts)
     {
         ReportProgress(String.Format("Downloading Users Tagged (Batch {0}/{1})", iIndex, iCount));
         foreach (JSONObject oPost in kvp.Value)
         {
             Vertex oAuthor = oVertices[oPost.Dictionary["actor_id"].String];
             foreach(JSONObject oTaggedId in oPost.Dictionary["tagged_ids"].Array)
             {
                 Vertex oUserTagged = new Vertex(oTaggedId.String, "", "User Tagged");
                 oVertices.Add(oUserTagged);                        
             }                    
         }
         iIndex++;
     }            
 }
        private void AddVertexAttributes
        (
            XmlNode oVertexXmlNode,
            Vertex oVertex
        )
        {
            string sAttribtueValue;
            foreach (KeyValuePair<AttributeUtils.Attribute, JSONObject> kvp in oVertex.Attributes)
            {

                if (kvp.Value == null || (kvp.Value.String == null && !kvp.Value.IsDictionary))
                {
                    sAttribtueValue = "";
                }
                else if (kvp.Key.value.Equals("hometown_location"))
                {

                    oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "hometown", kvp.Value.Dictionary.ContainsKey("name") ? kvp.Value.Dictionary["name"].String : "");
                    oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "hometown_city", kvp.Value.Dictionary.ContainsKey("city") ? kvp.Value.Dictionary["city"].String : "");
                    oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "hometown_state", kvp.Value.Dictionary.ContainsKey("state") ? kvp.Value.Dictionary["state"].String : "");
                    oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "hometown_country", kvp.Value.Dictionary.ContainsKey("country") ? kvp.Value.Dictionary["country"].String : "");
                }
                else if (kvp.Key.value.Equals("current_location"))
                {
                    oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "location", kvp.Value.Dictionary.ContainsKey("name") ? kvp.Value.Dictionary["name"].String : "");
                    oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "location_city", kvp.Value.Dictionary.ContainsKey("city") ? kvp.Value.Dictionary["city"].String : "");
                    oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "location_state", kvp.Value.Dictionary.ContainsKey("state") ? kvp.Value.Dictionary["state"].String : "");
                    oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "location_country", kvp.Value.Dictionary.ContainsKey("country") ? kvp.Value.Dictionary["country"].String : "");
                }
                else
                {
                    if (kvp.Value.String.Length > 8000)
                    {
                        sAttribtueValue = kvp.Value.String.Remove(8000);
                    }
                    else
                    {
                        sAttribtueValue = kvp.Value.String;
                    }

                    oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, kvp.Key.value, sAttribtueValue);
                }


            }

            oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "type", oVertex.Type);

            oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, MenuTextID,
                "Open Facebook Page for This User");
            oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, MenuActionID,
                FacebookURL + oVertex.ID);

            AppendVertexTooltipXmlNodes(oGraphMLXmlDocument, oVertexXmlNode, oVertex.Name, oVertex.ToolTip==null?"":oVertex.ToolTip);

            if (oVertex.Attributes.ContainsKey("pic_small") &&
                oVertex.Attributes["pic_small"] != null)
            {
                oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, "Image", oVertex.Attributes["pic_small"].String);
            }
            
        }