示例#1
0
        DefineCustomMenuGraphMLAttributes
        (
            GraphMLXmlDocument oGraphMLXmlDocument
        )
        {
            Debug.Assert(oGraphMLXmlDocument != null);
            AssertValid();

            oGraphMLXmlDocument.DefineGraphMLAttribute(false, MenuTextID,
                                                       MenuTextColumnName, "string", null);

            oGraphMLXmlDocument.DefineGraphMLAttribute(false, MenuActionID,
                                                       MenuActionColumnName, "string", null);
        }
        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);
        }
示例#3
0
        DefineRelationshipGraphMLAttribute
        (
            GraphMLXmlDocument oGraphMLXmlDocument
        )
        {
            Debug.Assert(oGraphMLXmlDocument != null);
            AssertValid();

            oGraphMLXmlDocument.DefineGraphMLAttribute(true, RelationshipID,
                                                       "Relationship", "string", null);
        }
示例#4
0
        DefineLabelGraphMLAttribute
        (
            GraphMLXmlDocument oGraphMLXmlDocument
        )
        {
            Debug.Assert(oGraphMLXmlDocument != null);
            AssertValid();

            oGraphMLXmlDocument.DefineGraphMLAttribute(false, LabelID,
                                                       LabelColumnName, "string", null);
        }
示例#5
0
        DefineImageFileGraphMLAttribute
        (
            GraphMLXmlDocument oGraphMLXmlDocument
        )
        {
            Debug.Assert(oGraphMLXmlDocument != null);
            AssertValid();

            oGraphMLXmlDocument.DefineGraphMLAttribute(false, ImageFileID,
                                                       ImageColumnName, "string", null);
        }
        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);
        }
示例#7
0
        CreateGraphMLXmlDocument
        (
            Boolean bIncludeCommenterVertices,
            Boolean bIncludeUserInformation
        )
        {
            AssertValid();

            GraphMLXmlDocument oGraphMLXmlDocument = new GraphMLXmlDocument(true);

            DefineRelationshipGraphMLAttribute(oGraphMLXmlDocument);

            if (bIncludeCommenterVertices)
            {
                oGraphMLXmlDocument.DefineGraphMLAttribute(true, CommentDateUtcID,
                                                           "Comment Time (UTC)", "string", null);

                oGraphMLXmlDocument.DefineGraphMLAttribute(true, CommentUrlID,
                                                           "Comment URL", "string", null);
            }

            if (bIncludeUserInformation)
            {
                oGraphMLXmlDocument.DefineGraphMLAttribute(false, RealNameID,
                                                           "Real Name", "string", null);

                oGraphMLXmlDocument.DefineGraphMLAttribute(false, TotalPhotosID,
                                                           "Total Photos", "int", null);

                oGraphMLXmlDocument.DefineGraphMLAttribute(false, IsProfessionalID,
                                                           "Is Professional", "string", null);

                DefineImageFileGraphMLAttribute(oGraphMLXmlDocument);
                DefineCustomMenuGraphMLAttributes(oGraphMLXmlDocument);
            }

            return(oGraphMLXmlDocument);
        }
        CreateGraphMLXmlDocument
        (
            Boolean bIncludeAllStatistics
        )
        {
            AssertValid();

            GraphMLXmlDocument oGraphMLXmlDocument = new GraphMLXmlDocument(true);

            DefineCustomMenuGraphMLAttributes(oGraphMLXmlDocument);
            DefineRelationshipGraphMLAttribute(oGraphMLXmlDocument);

            if (bIncludeAllStatistics)
            {
                oGraphMLXmlDocument.DefineGraphMLAttribute(false, FriendsID,
                                                           "Friends", "int", null);

                oGraphMLXmlDocument.DefineGraphMLAttribute(false, SubscriptionsID,
                                                           "People Subscribed To", "int", null);

                oGraphMLXmlDocument.DefineGraphMLAttribute(false, SubscribersID,
                                                           "Subscribers", "int", null);

                oGraphMLXmlDocument.DefineGraphMLAttribute(false, VideosWatchedID,
                                                           "Videos Watched", "int", null);

                oGraphMLXmlDocument.DefineGraphMLAttribute(false,
                                                           JoinedDateUtcID, "Joined YouTube Date (UTC)", "string", null);

                oGraphMLXmlDocument.DefineGraphMLAttribute(false, VideosUploadedID,
                                                           "Videos Uploaded", "int", null);

                DefineImageFileGraphMLAttribute(oGraphMLXmlDocument);
            }

            return(oGraphMLXmlDocument);
        }
示例#9
0
        SaveGraphCore
        (
            IGraph graph,
            Stream stream
        )
        {
            Debug.Assert(graph != null);
            Debug.Assert(stream != null);
            AssertValid();

            GraphMLXmlDocument oGraphMLXmlDocument = new GraphMLXmlDocument(
                graph.Directedness == GraphDirectedness.Directed);

            String [] asEdgeAttributeNames = ( String[] )graph.GetRequiredValue(
                ReservedMetadataKeys.AllEdgeMetadataKeys, typeof(String[]));

            String [] asVertexAttributeNames = ( String[] )graph.GetRequiredValue(
                ReservedMetadataKeys.AllVertexMetadataKeys, typeof(String[]));

            // Define the Graph-ML attributes.

            const String VertexAttributeIDPrefix = "V-";
            const String EdgeAttributeIDPrefix   = "E-";

            foreach (String sVertexAttributeName in asVertexAttributeNames)
            {
                oGraphMLXmlDocument.DefineGraphMLAttribute(false,
                                                           VertexAttributeIDPrefix + sVertexAttributeName,
                                                           sVertexAttributeName, "string", null);
            }

            foreach (String sEdgeAttributeName in asEdgeAttributeNames)
            {
                oGraphMLXmlDocument.DefineGraphMLAttribute(true,
                                                           EdgeAttributeIDPrefix + sEdgeAttributeName,
                                                           sEdgeAttributeName, "string", null);
            }

            // Add the vertices and their Graph-ML attribute values.

            foreach (IVertex oVertex in graph.Vertices)
            {
                XmlNode oVertexXmlNode = oGraphMLXmlDocument.AppendVertexXmlNode(
                    oVertex.Name);

                AppendGraphMLAttributeValues(oVertex, oGraphMLXmlDocument,
                                             oVertexXmlNode, asVertexAttributeNames,
                                             VertexAttributeIDPrefix);
            }

            // Add the edges and their Graph-ML attribute values.

            foreach (IEdge oEdge in graph.Edges)
            {
                IVertex [] oVertices = oEdge.Vertices;

                XmlNode oEdgeXmlNode = oGraphMLXmlDocument.AppendEdgeXmlNode(
                    oVertices[0].Name, oVertices[1].Name);

                AppendGraphMLAttributeValues(oEdge, oGraphMLXmlDocument,
                                             oEdgeXmlNode, asEdgeAttributeNames, EdgeAttributeIDPrefix);
            }

            oGraphMLXmlDocument.Save(stream);
        }
示例#10
0
        GetSearchNetworkInternal
        (
            String sSearchTerm,
            WhatToInclude eWhatToInclude,
            Int32 iMaximumPeoplePerRequest,
            RequestStatistics oRequestStatistics,
            GraphMLXmlDocument oGraphMLXmlDocument
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(sSearchTerm));
            Debug.Assert(iMaximumPeoplePerRequest > 0);
            Debug.Assert(oRequestStatistics != null);
            Debug.Assert(oGraphMLXmlDocument != null);
            AssertValid();

            if (WhatToIncludeFlagIsSet(eWhatToInclude, WhatToInclude.Statuses))
            {
                oGraphMLXmlDocument.DefineGraphMLAttribute(false, StatusID,
                                                           "Tweet", "string", null);

                oGraphMLXmlDocument.DefineGraphMLAttribute(false, StatusDateUtcID,
                                                           "Tweet Date (UTC)", "string", null);
            }

            // The key is the screen name and the value is the corresponding
            // TwitterVertex.  This is used to prevent the same screen name from
            // being added to the XmlDocument twice.

            Dictionary <String, TwitterVertex> oScreenNameDictionary =
                new Dictionary <String, TwitterVertex>();

            // First, add a vertex for each person who has tweeted the search term.

            AppendVertexXmlNodes(sSearchTerm, eWhatToInclude,
                                 iMaximumPeoplePerRequest, oGraphMLXmlDocument,
                                 oScreenNameDictionary, oRequestStatistics);

            if (WhatToIncludeFlagIsSet(eWhatToInclude,
                                       WhatToInclude.FollowedEdges))
            {
                // Look at the people followed by each author, and if a followed
                // has also tweeted the search term, add an edge between the author
                // and the followed.

                AppendFollowedEdgeXmlNodes(eWhatToInclude,
                                           iMaximumPeoplePerRequest, oGraphMLXmlDocument,
                                           oScreenNameDictionary, oRequestStatistics);
            }

            Boolean bIncludeStatistics = WhatToIncludeFlagIsSet(
                eWhatToInclude, WhatToInclude.Statistics);

            AppendMissingGraphMLAttributeValues(oGraphMLXmlDocument,
                                                oScreenNameDictionary, bIncludeStatistics, false,
                                                oRequestStatistics);

            AppendRepliesToAndMentionsXmlNodes(oGraphMLXmlDocument,
                                               oScreenNameDictionary,

                                               WhatToIncludeFlagIsSet(eWhatToInclude,
                                                                      WhatToInclude.RepliesToEdges),

                                               WhatToIncludeFlagIsSet(eWhatToInclude,
                                                                      WhatToInclude.MentionsEdges)
                                               );
        }