AppendGraphMLAttributeValues ( IMetadataProvider oEdgeOrVertex, GraphMLXmlDocument oGraphMLXmlDocument, XmlNode oEdgeOrVertexXmlNode, String [] asAttributeNames, String AttributeIDPrefix ) { Debug.Assert(oEdgeOrVertex != null); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oEdgeOrVertexXmlNode != null); Debug.Assert(asAttributeNames != null); Debug.Assert(!String.IsNullOrEmpty(AttributeIDPrefix)); AssertValid(); foreach (String sAttributeName in asAttributeNames) { Object oAttributeValue; // Note that the value type isn't checked. Whatever type it is, // it gets converted to a string. if (oEdgeOrVertex.TryGetValue(sAttributeName, out oAttributeValue) && oAttributeValue != null) { oGraphMLXmlDocument.AppendGraphMLAttributeValue( oEdgeOrVertexXmlNode, AttributeIDPrefix + sAttributeName, oAttributeValue.ToString()); } } }
GetVertexCount ( XmlDocument oGraphMLXmlDocument ) { Debug.Assert(oGraphMLXmlDocument != null); AssertValid(); Int32 iVertexCount = 0; XmlNode oXmlNode; XmlNamespaceManager oXmlNamespaceManager = GraphMLXmlDocument.CreateXmlNamespaceManager( oGraphMLXmlDocument, "g"); if (XmlUtil2.TrySelectSingleNode(oGraphMLXmlDocument, "g:graphml/g:graph/g:node", oXmlNamespaceManager, out oXmlNode)) { while (oXmlNode != null) { if (oXmlNode.Name == "node") { iVertexCount++; } oXmlNode = oXmlNode.NextSibling; } } return(iVertexCount); }
AppendAllStatisticGraphMLAttributeValues ( GraphMLXmlDocument oGraphMLXmlDocument, Dictionary <String, XmlNode> oUserNameDictionary, RequestStatistics oRequestStatistics ) { Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oUserNameDictionary != null); Debug.Assert(oRequestStatistics != null); AssertValid(); foreach (KeyValuePair <String, XmlNode> oKeyValuePair in oUserNameDictionary) { String sUserName = oKeyValuePair.Key; ReportProgress(String.Format( "Getting statistics for \"{0}\"." , sUserName )); AppendAllStatisticGraphMLAttributeValues(sUserName, oKeyValuePair.Value, oGraphMLXmlDocument, oRequestStatistics); } }
AppendFriendOrFollowerEdgeXmlNode ( String sScreenName1, String sScreenName2, Boolean bAppendFriendEdgeXmlNode, GraphMLXmlDocument oGraphMLXmlDocument, RequestStatistics oRequestStatistics ) { Debug.Assert(!String.IsNullOrEmpty(sScreenName1)); Debug.Assert(!String.IsNullOrEmpty(sScreenName2)); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oRequestStatistics != null); AssertValid(); // Don't use "friend" or "follower" terminology here, which can be // confusing. Instead, simply indicate who follows whom. XmlNode oEdgeXmlNode = NodeXLGraphMLUtil.AppendEdgeXmlNode( oGraphMLXmlDocument, bAppendFriendEdgeXmlNode ? sScreenName1 : sScreenName2, bAppendFriendEdgeXmlNode ? sScreenName2 : sScreenName1, "Follows" ); AppendStartTimeRelationshipDateUtcGraphMLAttributeValue( oGraphMLXmlDocument, oEdgeXmlNode, oRequestStatistics); }
AppendSampleThumbnails ( Dictionary <String, XmlNode> oTagDictionary, GraphMLXmlDocument oGraphMLXmlDocument, String sApiKey, RequestStatistics oRequestStatistics ) { Debug.Assert(oTagDictionary != null); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(!String.IsNullOrEmpty(sApiKey)); Debug.Assert(oRequestStatistics != null); AssertValid(); foreach (KeyValuePair <String, XmlNode> oKeyValuePair in oTagDictionary) { String sTag = oKeyValuePair.Key; ReportProgress("Getting sample image file for \"" + sTag + "\"."); String sSampleImageUrl; if (TryGetSampleImageUrl(sTag, sApiKey, oRequestStatistics, out sSampleImageUrl)) { oGraphMLXmlDocument.AppendGraphMLAttributeValue( oKeyValuePair.Value, NodeXLGraphMLUtil.VertexImageFileID, sSampleImageUrl); } } }
AppendInt32GraphMLAttributeValue ( String sUrl, String sXPath, GraphMLXmlDocument oGraphMLXmlDocument, RequestStatistics oRequestStatistics, XmlNode oVertexXmlNode, String sGraphMLAttributeID ) { Debug.Assert(!String.IsNullOrEmpty(sUrl)); Debug.Assert(!String.IsNullOrEmpty(sXPath)); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oRequestStatistics != null); Debug.Assert(oVertexXmlNode != null); Debug.Assert(!String.IsNullOrEmpty(sGraphMLAttributeID)); AssertValid(); XmlDocument oXmlDocument; XmlNamespaceManager oXmlNamespaceManager; if (!TryGetXmlDocument(sUrl, oRequestStatistics, out oXmlDocument, out oXmlNamespaceManager)) { return; } AppendInt32GraphMLAttributeValue(oXmlDocument, sXPath, oXmlNamespaceManager, oGraphMLXmlDocument, oVertexXmlNode, sGraphMLAttributeID); }
AppendVertexXmlNode ( String sTag, GraphMLXmlDocument oGraphMLXmlDocument, Dictionary <String, XmlNode> oTagDictionary ) { Debug.Assert(!String.IsNullOrEmpty(sTag)); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oTagDictionary != null); if (!oTagDictionary.ContainsKey(sTag)) { XmlNode oVertexXmlNode = oGraphMLXmlDocument.AppendVertexXmlNode( sTag); oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, NodeXLGraphMLUtil.VertexLabelID, sTag); oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, NodeXLGraphMLUtil.VertexMenuTextID, "Open Flickr Page for This Tag"); oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, NodeXLGraphMLUtil.VertexMenuActionID, String.Format( "http://www.flickr.com/photos/tags/{0}/" , UrlUtil.EncodeUrlParameter(sTag) )); oTagDictionary.Add(sTag, oVertexXmlNode); } }
CreateGraphMLXmlDocument ( Boolean bIncludeAllStatistics ) { AssertValid(); GraphMLXmlDocument oGraphMLXmlDocument = new GraphMLXmlDocument(true); NodeXLGraphMLUtil.DefineVertexCustomMenuGraphMLAttributes( oGraphMLXmlDocument); NodeXLGraphMLUtil.DefineEdgeRelationshipGraphMLAttribute( oGraphMLXmlDocument); if (bIncludeAllStatistics) { oGraphMLXmlDocument.DefineGraphMLAttributes(false, "int", FriendsID, "Friends", SubscriptionsID, "People Subscribed To", SubscribersID, "Subscribers", VideosWatchedID, "Videos Watched", VideosUploadedID, "Videos Uploaded" ); oGraphMLXmlDocument.DefineVertexStringGraphMLAttributes( JoinedDateUtcID, "Joined YouTube Date (UTC)"); NodeXLGraphMLUtil.DefineVertexImageFileGraphMLAttribute( oGraphMLXmlDocument); } return(oGraphMLXmlDocument); }
AppendYouTubeDateGraphMLAttributeValue ( XmlNode oXmlNodeToSelectFrom, String sXPath, XmlNamespaceManager oXmlNamespaceManager, GraphMLXmlDocument oGraphMLXmlDocument, XmlNode oVertexXmlNode, String sGraphMLAttributeID ) { Debug.Assert(oXmlNodeToSelectFrom != null); Debug.Assert( !String.IsNullOrEmpty(sXPath) ); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oVertexXmlNode != null); Debug.Assert( !String.IsNullOrEmpty(sGraphMLAttributeID) ); AssertValid(); String sYouTubeDate; if ( XmlUtil2.TrySelectSingleNodeAsString(oXmlNodeToSelectFrom, sXPath, oXmlNamespaceManager, out sYouTubeDate) ) { oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, sGraphMLAttributeID, FormatYouTubeDate(sYouTubeDate) ); return (true); } return (false); }
TryAppendVertexXmlNode ( String sUserName, XmlNode oEntryXmlNode, GraphMLXmlDocument oGraphMLXmlDocument, Dictionary <String, XmlNode> oUserNameDictionary ) { Debug.Assert(!String.IsNullOrEmpty(sUserName)); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oUserNameDictionary != null); XmlNode oVertexXmlNode; if (oUserNameDictionary.TryGetValue(sUserName, out oVertexXmlNode)) { return(false); } oVertexXmlNode = oGraphMLXmlDocument.AppendVertexXmlNode(sUserName); oUserNameDictionary.Add(sUserName, oVertexXmlNode); oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, NodeXLGraphMLUtil.VertexMenuTextID, "Open YouTube Page for This Person"); oGraphMLXmlDocument.AppendGraphMLAttributeValue(oVertexXmlNode, NodeXLGraphMLUtil.VertexMenuActionID, String.Format(WebPageUrlPattern, sUserName)); return(true); }
AppendUserInformationGraphMLAttributeValues ( GraphMLXmlDocument oGraphMLXmlDocument, Dictionary <String, XmlNode> oUserIDDictionary, String sApiKey, RequestStatistics oRequestStatistics ) { Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oUserIDDictionary != null); Debug.Assert(!String.IsNullOrEmpty(sApiKey)); Debug.Assert(oRequestStatistics != null); AssertValid(); foreach (KeyValuePair <String, XmlNode> oKeyValuePair in oUserIDDictionary) { String sUserID = oKeyValuePair.Key; XmlNode oVertexXmlNode = oKeyValuePair.Value; ReportProgress(String.Format( "Getting information about \"{0}\"." , GetScreenNameFromVertexXmlNode(oVertexXmlNode) )); AppendUserInformationGraphMLAttributeValues(sUserID, oVertexXmlNode, oGraphMLXmlDocument, sApiKey, oRequestStatistics); } }
TryAppendVertexXmlNode ( String sUserID, String sScreenName, GraphMLXmlDocument oGraphMLXmlDocument, Dictionary <String, XmlNode> oUserIDDictionary ) { Debug.Assert(!String.IsNullOrEmpty(sUserID)); Debug.Assert(!String.IsNullOrEmpty(sScreenName)); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oUserIDDictionary != null); XmlNode oVertexXmlNode; if (oUserIDDictionary.TryGetValue(sUserID, out oVertexXmlNode)) { return(false); } oVertexXmlNode = oGraphMLXmlDocument.AppendVertexXmlNode(sScreenName); oUserIDDictionary.Add(sUserID, oVertexXmlNode); return(true); }
CreateGraphMLXmlDocument() { AssertValid(); GraphMLXmlDocument oGraphMLXmlDocument = new GraphMLXmlDocument(false); DefineRelationshipGraphMLAttribute(oGraphMLXmlDocument); oGraphMLXmlDocument.DefineGraphMLAttribute(false, TitleID, "Title", "string", null); oGraphMLXmlDocument.DefineGraphMLAttribute(false, RatingID, "Rating", "double", null); oGraphMLXmlDocument.DefineGraphMLAttribute(false, ViewsID, "Views", "int", null); oGraphMLXmlDocument.DefineGraphMLAttribute(false, FavoritedID, "Favorited", "int", null); oGraphMLXmlDocument.DefineGraphMLAttribute(false, CommentsID, "Comments", "int", null); oGraphMLXmlDocument.DefineGraphMLAttribute(false, CreatedDateUtcID, "Created Date (UTC)", "string", null); DefineImageFileGraphMLAttribute(oGraphMLXmlDocument); DefineCustomMenuGraphMLAttributes(oGraphMLXmlDocument); return(oGraphMLXmlDocument); }
AppendDoubleGraphMLAttributeValue ( XmlNode oXmlNodeToSelectFrom, String sXPath, XmlNamespaceManager oXmlNamespaceManager, GraphMLXmlDocument oGraphMLXmlDocument, XmlNode oEdgeOrVertexXmlNode, String sGraphMLAttributeID ) { Debug.Assert(oXmlNodeToSelectFrom != null); Debug.Assert(!String.IsNullOrEmpty(sXPath)); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(oEdgeOrVertexXmlNode != null); Debug.Assert(!String.IsNullOrEmpty(sGraphMLAttributeID)); AssertValid(); Double dAttributeValue; if (XmlUtil2.TrySelectSingleNodeAsDouble(oXmlNodeToSelectFrom, sXPath, oXmlNamespaceManager, out dAttributeValue)) { oGraphMLXmlDocument.AppendGraphMLAttributeValue( oEdgeOrVertexXmlNode, sGraphMLAttributeID, dAttributeValue); return(true); } return(false); }
GetVideoNetworkInternal ( String sSearchTerm, WhatToInclude eWhatToInclude, Int32 iMaximumVideos ) { Debug.Assert(!String.IsNullOrEmpty(sSearchTerm)); Debug.Assert(iMaximumVideos > 0); AssertValid(); GraphMLXmlDocument oGraphMLXmlDocument = CreateGraphMLXmlDocument(); RequestStatistics oRequestStatistics = new RequestStatistics(); try { GetVideoNetworkInternal(sSearchTerm, eWhatToInclude, iMaximumVideos, oRequestStatistics, oGraphMLXmlDocument); } catch (Exception oException) { OnTerminatingException(oException); } OnNetworkObtainedWithoutTerminatingException(oGraphMLXmlDocument, oRequestStatistics); return(oGraphMLXmlDocument); }
AppendRepliesToAndMentionsEdgeXmlNodes ( GraphMLXmlDocument graphmlXmlDocument, IEnumerable <TwitterUser> twitterUsers, HashSet <String> uniqueScreenNames ) { Debug.Assert(graphmlXmlDocument != null); Debug.Assert(twitterUsers != null); Debug.Assert(uniqueScreenNames != null); // This method uses only one instance of TwitterStatusTextParser to // avoid making it repeatedly recompile all of its regular expressions. TwitterStatusTextParser twitterStatusTextParser = new TwitterStatusTextParser(); foreach (TwitterUser twitterUser in twitterUsers) { foreach (TwitterStatus twitterStatus in twitterUser.Statuses) { AppendRepliesToAndMentionsEdgeXmlNodes( graphmlXmlDocument, twitterStatusTextParser, uniqueScreenNames, twitterUser.ScreenName, twitterStatus); } } }
AppendValueFromValueDictionary ( Dictionary <String, Object> valueDictionary, String name, GraphMLXmlDocument graphMLXmlDocument, XmlNode edgeOrVertexXmlNode, String graphMLAttributeID ) { Debug.Assert(valueDictionary != null); Debug.Assert(!String.IsNullOrEmpty(name)); Debug.Assert(graphMLXmlDocument != null); Debug.Assert(edgeOrVertexXmlNode != null); Debug.Assert(!String.IsNullOrEmpty(graphMLAttributeID)); String value; if (TwitterJsonUtil.TryGetJsonValueFromDictionary( valueDictionary, name, out value)) { graphMLXmlDocument.AppendGraphMLAttributeValue( edgeOrVertexXmlNode, graphMLAttributeID, value); return(true); } return(false); }
AppendUserStatisticsFromValueDictionary ( Dictionary <String, Object> userValueDictionary, GraphMLXmlDocument graphMLXmlDocument, TwitterUser twitterUser ) { Debug.Assert(userValueDictionary != null); Debug.Assert(graphMLXmlDocument != null); Debug.Assert(twitterUser != null); XmlNode vertexXmlNode = twitterUser.VertexXmlNode; AppendValueFromValueDictionary(userValueDictionary, "friends_count", graphMLXmlDocument, vertexXmlNode, VertexFollowedID); AppendValueFromValueDictionary(userValueDictionary, "followers_count", graphMLXmlDocument, vertexXmlNode, VertexFollowersID); AppendValueFromValueDictionary(userValueDictionary, "statuses_count", graphMLXmlDocument, vertexXmlNode, VertexStatusesID); AppendValueFromValueDictionary(userValueDictionary, "favourites_count", graphMLXmlDocument, vertexXmlNode, VertexFavoritesID); AppendValueFromValueDictionary(userValueDictionary, "description", graphMLXmlDocument, vertexXmlNode, VertexDescriptionID); AppendValueFromValueDictionary(userValueDictionary, "location", graphMLXmlDocument, vertexXmlNode, VertexLocationID); AppendValueFromValueDictionary(userValueDictionary, "url", graphMLXmlDocument, vertexXmlNode, VertexUrlID); AppendValueFromValueDictionary(userValueDictionary, "time_zone", graphMLXmlDocument, vertexXmlNode, VertexTimeZoneID); AppendValueFromValueDictionary(userValueDictionary, "utc_offset", graphMLXmlDocument, vertexXmlNode, VertexUtcOffsetID); String joinedDateUtc; if (TwitterJsonUtil.TryGetJsonValueFromDictionary(userValueDictionary, "created_at", out joinedDateUtc)) { graphMLXmlDocument.AppendGraphMLAttributeValue( vertexXmlNode, VertexJoinedDateUtcID, TwitterDateParser.ParseTwitterDate(joinedDateUtc)); } }
GetVideoNetworkInternal ( String sSearchTerm, WhatToInclude eWhatToInclude, Int32 iMaximumVideos, RequestStatistics oRequestStatistics, GraphMLXmlDocument oGraphMLXmlDocument ) { Debug.Assert(!String.IsNullOrEmpty(sSearchTerm)); Debug.Assert(iMaximumVideos > 0); Debug.Assert(oRequestStatistics != null); Debug.Assert(oGraphMLXmlDocument != null); AssertValid(); // First, add a vertex for each video matching the search term. HashSet <String> oVideoIDs; Dictionary <String, LinkedList <String> > oCategoryDictionary; AppendVertexXmlNodes(sSearchTerm, eWhatToInclude, iMaximumVideos, oGraphMLXmlDocument, oRequestStatistics, out oVideoIDs, out oCategoryDictionary); // Now add whatever edges were requested. if (WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.SharedCategoryEdges)) { Debug.Assert(oCategoryDictionary != null); ReportProgress("Adding edges for shared categories."); AppendEdgesFromDictionary(oCategoryDictionary, oGraphMLXmlDocument, "Shared category", SharedCategoryID); } oCategoryDictionary = null; if (WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.SharedCommenterEdges)) { AppendSharedResponderEdges(oGraphMLXmlDocument, oVideoIDs, MaximumCommentsPerVideo, "http://gdata.youtube.com/feeds/api/videos/{0}/comments", "commenter", SharedCommenterID, oRequestStatistics); } if (WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.SharedVideoResponderEdges)) { AppendSharedResponderEdges(oGraphMLXmlDocument, oVideoIDs, iMaximumVideos, "http://gdata.youtube.com/feeds/api/videos/{0}/responses", "video responder", SharedVideoResponderID, oRequestStatistics); } }
AppendEdgesFromDictionary ( Dictionary <String, LinkedList <String> > oDictionary, GraphMLXmlDocument oGraphMLXmlDocument, String sRelationship, String sKeyAttributeID ) { Debug.Assert(oDictionary != null); Debug.Assert(oGraphMLXmlDocument != null); Debug.Assert(!String.IsNullOrEmpty(sRelationship)); Debug.Assert(!String.IsNullOrEmpty(sKeyAttributeID)); AssertValid(); // For each key... foreach (KeyValuePair <String, LinkedList <String> > oKeyValuePair in oDictionary) { String sKey = oKeyValuePair.Key; // For each video ID that has the key... LinkedList <String> oVideoIDsWithThisKey = oKeyValuePair.Value; for ( LinkedListNode <String> oVideoIDWithThisKey = oVideoIDsWithThisKey.First; oVideoIDWithThisKey != null; oVideoIDWithThisKey = oVideoIDWithThisKey.Next ) { // For each of the subsequent video IDs in the LinkedList that // have the key... for ( LinkedListNode <String> oSubsequentVideoIDWithThisKey = oVideoIDWithThisKey.Next; oSubsequentVideoIDWithThisKey != null; oSubsequentVideoIDWithThisKey = oSubsequentVideoIDWithThisKey.Next ) { XmlNode oEdgeXmlNode = NodeXLGraphMLUtil.AppendEdgeXmlNode( oGraphMLXmlDocument, oVideoIDWithThisKey.Value, oSubsequentVideoIDWithThisKey.Value, sRelationship); oGraphMLXmlDocument.AppendGraphMLAttributeValue( oEdgeXmlNode, sKeyAttributeID, sKey); } } } }
GetNetworkInternal ( String sSearchTerm, WhatToInclude eWhatToInclude, Int32 iMaximumStatuses, RequestStatistics oRequestStatistics, GraphMLXmlDocument oGraphMLXmlDocument ) { Debug.Assert(!String.IsNullOrEmpty(sSearchTerm)); Debug.Assert(iMaximumStatuses > 0); Debug.Assert(iMaximumStatuses != Int32.MaxValue); Debug.Assert(oRequestStatistics != null); Debug.Assert(oGraphMLXmlDocument != null); AssertValid(); // The key is the Twitter user ID and the value is the corresponding // TwitterUser. Dictionary <String, TwitterUser> oUserIDDictionary = new Dictionary <String, TwitterUser>(); // First, append a vertex for each person who has tweeted the search // term. AppendVertexXmlNodesForSearchTerm(sSearchTerm, eWhatToInclude, iMaximumStatuses, oGraphMLXmlDocument, oUserIDDictionary, oRequestStatistics); // Now append a vertex for each person who was mentioned or replied to // by the first set of people, but who didn't tweet the search term // himself. AppendVertexXmlNodesForMentionsAndRepliesTo(eWhatToInclude, oGraphMLXmlDocument, oUserIDDictionary, oRequestStatistics); TwitterSearchNetworkGraphMLUtil.AppendVertexTooltipXmlNodes( oGraphMLXmlDocument, oUserIDDictionary); if (WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.FollowedEdges)) { // Look at each author's friends, and if a friend has also tweeted // the search term, add an edge between the author and the friend. AppendFriendEdgeXmlNodes(oUserIDDictionary, MaximumFriends, oGraphMLXmlDocument, oRequestStatistics); } AppendRepliesToAndMentionsEdgeXmlNodes(oGraphMLXmlDocument, oUserIDDictionary.Values, TwitterGraphMLUtil.TwitterUsersToUniqueScreenNames( oUserIDDictionary.Values) ); }
CreateGraphMLXmlDocument ( WhatToInclude eWhatToInclude ) { AssertValid(); GraphMLXmlDocument oGraphMLXmlDocument = new GraphMLXmlDocument(false); NodeXLGraphMLUtil.DefineEdgeRelationshipGraphMLAttribute( oGraphMLXmlDocument); if (WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.SharedCategoryEdges)) { oGraphMLXmlDocument.DefineEdgeStringGraphMLAttributes( SharedCategoryID, "Shared Category"); } if (WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.SharedCommenterEdges)) { oGraphMLXmlDocument.DefineEdgeStringGraphMLAttributes( SharedCommenterID, "Shared Commenter"); } if (WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.SharedVideoResponderEdges)) { oGraphMLXmlDocument.DefineEdgeStringGraphMLAttributes( SharedVideoResponderID, "Shared Video Responder"); } oGraphMLXmlDocument.DefineVertexStringGraphMLAttributes( TitleID, "Title", AuthorID, "Author", CreatedDateUtcID, "Created Date (UTC)" ); oGraphMLXmlDocument.DefineGraphMLAttribute(false, RatingID, "Rating", "double", null); oGraphMLXmlDocument.DefineGraphMLAttributes(false, "int", ViewsID, "Views", FavoritedID, "Favorited", CommentsID, "Comments" ); NodeXLGraphMLUtil.DefineVertexImageFileGraphMLAttribute( oGraphMLXmlDocument); NodeXLGraphMLUtil.DefineVertexCustomMenuGraphMLAttributes( oGraphMLXmlDocument); return(oGraphMLXmlDocument); }
GetUserNetworkInternal ( String sUserNameToAnalyze, WhatToInclude eWhatToInclude, NetworkLevel eNetworkLevel, Int32 iMaximumPeoplePerRequest, RequestStatistics oRequestStatistics, GraphMLXmlDocument oGraphMLXmlDocument ) { Debug.Assert(!String.IsNullOrEmpty(sUserNameToAnalyze)); Debug.Assert(eNetworkLevel == NetworkLevel.One || eNetworkLevel == NetworkLevel.OnePointFive || eNetworkLevel == NetworkLevel.Two); Debug.Assert(iMaximumPeoplePerRequest > 0); Debug.Assert(oRequestStatistics != null); Debug.Assert(oGraphMLXmlDocument != null); AssertValid(); // The key is the user name and the value is the corresponding GraphML // XML node that represents the user. This is used to prevent the same // user name from being added to the XmlDocument twice. Dictionary <String, XmlNode> oUserNameDictionary = new Dictionary <String, XmlNode>(); // Include friends, subscriptions, both, or neither. Boolean [] abIncludes = new Boolean[] { WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.FriendVertices), WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.SubscriptionVertices), }; for (Int32 i = 0; i < 2; i++) { if (abIncludes[i]) { GetUserNetworkRecursive(sUserNameToAnalyze, eWhatToInclude, (i == 0), eNetworkLevel, iMaximumPeoplePerRequest, 1, oGraphMLXmlDocument, oUserNameDictionary, oRequestStatistics); } } if (WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.AllStatistics)) { AppendAllStatisticGraphMLAttributeValues(oGraphMLXmlDocument, oUserNameDictionary, oRequestStatistics); } }
DefineEdgeRelationshipGraphMLAttribute ( GraphMLXmlDocument graphMLXmlDocument ) { Debug.Assert(graphMLXmlDocument != null); graphMLXmlDocument.DefineEdgeStringGraphMLAttributes( EdgeRelationshipID, "Relationship"); }
DefineVertexLabelGraphMLAttribute ( GraphMLXmlDocument graphMLXmlDocument ) { Debug.Assert(graphMLXmlDocument != null); graphMLXmlDocument.DefineVertexStringGraphMLAttributes( VertexLabelID, VertexLabelColumnName); }
DefineVertexImageFileGraphMLAttribute ( GraphMLXmlDocument graphMLXmlDocument ) { Debug.Assert(graphMLXmlDocument != null); graphMLXmlDocument.DefineVertexStringGraphMLAttributes( VertexImageFileID, VertexImageFileColumnName); }
DefineImportedIDGraphMLAttribute ( GraphMLXmlDocument graphMLXmlDocument, Boolean forEdges ) { Debug.Assert(graphMLXmlDocument != null); graphMLXmlDocument.DefineStringGraphMLAttributes(forEdges, ImportedIDID, "Imported ID"); }
DefineImageFileGraphMLAttribute ( GraphMLXmlDocument oGraphMLXmlDocument ) { Debug.Assert(oGraphMLXmlDocument != null); AssertValid(); oGraphMLXmlDocument.DefineGraphMLAttribute(false, ImageFileID, ImageColumnName, "string", null); }
DefineLabelGraphMLAttribute ( GraphMLXmlDocument oGraphMLXmlDocument ) { Debug.Assert(oGraphMLXmlDocument != null); AssertValid(); oGraphMLXmlDocument.DefineGraphMLAttribute(false, LabelID, LabelColumnName, "string", null); }
DefineRelationshipGraphMLAttribute ( GraphMLXmlDocument oGraphMLXmlDocument ) { Debug.Assert(oGraphMLXmlDocument != null); AssertValid(); oGraphMLXmlDocument.DefineGraphMLAttribute(true, RelationshipID, "Relationship", "string", null); }