DefineGraphMLAttribute() public method

public DefineGraphMLAttribute ( System.Boolean forEdge, String attributeID, String attributeName, String attributeType, String defaultAttributeValue ) : void
forEdge System.Boolean
attributeID String
attributeName String
attributeType String
defaultAttributeValue String
return void
    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);
    }
    DefineRelationshipGraphMLAttribute
    (
        GraphMLXmlDocument oGraphMLXmlDocument
    )
    {
        Debug.Assert(oGraphMLXmlDocument != null);
        AssertValid();

        oGraphMLXmlDocument.DefineGraphMLAttribute(true, RelationshipID,
            "Relationship", "string", null);
    }
    SaveGraphCore
    (
        IGraph graph,
        Stream stream
    )
    {
        Debug.Assert(graph != null);
        Debug.Assert(stream != null);
        AssertValid();

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

        String [] asEdgeAttributeNames = GetAttributeNames(graph, false);
        String [] asVertexAttributeNames = GetAttributeNames(graph, true);

        // Define the GraphML-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 GraphML-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 GraphML-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);
    }
    DefineCustomMenuGraphMLAttributes
    (
        GraphMLXmlDocument oGraphMLXmlDocument
    )
    {
        Debug.Assert(oGraphMLXmlDocument != null);
        AssertValid();

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

        oGraphMLXmlDocument.DefineGraphMLAttribute(false, MenuActionID,
            MenuActionColumnName, "string", null);
    }
    DefineLabelGraphMLAttribute
    (
        GraphMLXmlDocument oGraphMLXmlDocument
    )
    {
        Debug.Assert(oGraphMLXmlDocument != null);
        AssertValid();

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

        oGraphMLXmlDocument.DefineGraphMLAttribute(false, ImageFileID,
            ImageColumnName, "string", null);
    }
    CreateGraphMLXmlDocument
    (
        Boolean bIncludeCommenterVertices,
        Boolean bIncludeUserInformation
    )
    {
        AssertValid();

        GraphMLXmlDocument oGraphMLXmlDocument = new GraphMLXmlDocument(true);

        NodeXLGraphMLUtil.DefineEdgeRelationshipGraphMLAttribute(
            oGraphMLXmlDocument);

        if (bIncludeCommenterVertices)
        {
            oGraphMLXmlDocument.DefineEdgeStringGraphMLAttributes(
                CommentDateUtcID, "Comment Time (UTC)",
                CommentUrlID, "Comment URL"
                );
        }

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

            oGraphMLXmlDocument.DefineVertexStringGraphMLAttributes(
                RealNameID, "Real Name",
                IsProfessionalID, "Is Professional"
                );

            NodeXLGraphMLUtil.DefineVertexImageFileGraphMLAttribute(
                oGraphMLXmlDocument);

            NodeXLGraphMLUtil.DefineVertexCustomMenuGraphMLAttributes(
                oGraphMLXmlDocument);
        }

        return (oGraphMLXmlDocument);
    }
        CreateGraphMLXmlDocument
        (
            AttributesDictionary<bool> attributes
        )
        {
            AssertValid();

            GraphMLXmlDocument oGraphMLXmlDocument = new GraphMLXmlDocument(false);

            DefineImageFileGraphMLAttribute(oGraphMLXmlDocument);
            DefineCustomMenuGraphMLAttributes(oGraphMLXmlDocument);
            oGraphMLXmlDocument.DefineGraphMLAttribute(false, TooltipID,
            "Tooltip", "string", null);
            oGraphMLXmlDocument.DefineGraphMLAttribute(false, "type", "Type", "string", null);

            oGraphMLXmlDocument.DefineGraphMLAttribute(true, "e_type", "Edge Type", "string", null);
            oGraphMLXmlDocument.DefineGraphMLAttribute(true, "e_comment", "Tweet", "string", null);
            oGraphMLXmlDocument.DefineGraphMLAttribute(true, "e_origin", "Feed of Origin", "string", null);
            oGraphMLXmlDocument.DefineGraphMLAttribute(true, "e_timestamp", "Timestamp", "string", null);
            DefineRelationshipGraphMLAttribute(oGraphMLXmlDocument);

            foreach (KeyValuePair<AttributeUtils.Attribute, bool> kvp in attributes)
            {
                if (kvp.Value)
                {
                    if (kvp.Key.value.Equals("hometown_location"))
                    {
                        oGraphMLXmlDocument.DefineGraphMLAttribute(false, "hometown",
                        "Hometown", "string", null);
                        oGraphMLXmlDocument.DefineGraphMLAttribute(false, "hometown_city",
                        "Hometown City", "string", null);
                        oGraphMLXmlDocument.DefineGraphMLAttribute(false, "hometown_state",
                        "Hometown State", "string", null);
                        oGraphMLXmlDocument.DefineGraphMLAttribute(false, "hometown_country",
                        "Hometown Country", "string", null);
                    }
                    else if (kvp.Key.value.Equals("current_location"))
                    {
                        oGraphMLXmlDocument.DefineGraphMLAttribute(false, "location",
                        "Current Location", "string", null);
                        oGraphMLXmlDocument.DefineGraphMLAttribute(false, "location_city",
                        "Current Location City", "string", null);
                        oGraphMLXmlDocument.DefineGraphMLAttribute(false, "location_state",
                        "Current Location State", "string", null);
                        oGraphMLXmlDocument.DefineGraphMLAttribute(false, "location_country",
                        "Current Location Country", "string", null);
                    }
                    else
                    {
                        oGraphMLXmlDocument.DefineGraphMLAttribute(false, kvp.Key.value,
                        kvp.Key.name, "string", null);
                    }
                }
            }            

            return (oGraphMLXmlDocument);
        }