Exemplo n.º 1
0
        private String GenerateVertexViewHTML(IVertexView aVertex)
        {
            StringBuilder Output = new StringBuilder();

            // take one IVertexView and traverse through it
            #region Vertex Properties
            if (aVertex.GetCountOfProperties() > 0)
            {
                //Output.Append("<table class=\"gql_table\" border=\"1\"> <!-- VertexProperties -->");
                foreach (var _property in aVertex.GetAllProperties())
                {
                    if (_property.Item2 == null)
                    {
                        Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\"></td></tr>");
                    }
                    else
                    if (_property.Item2 is Stream)
                    {
                        Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\">BinaryProperty</td></tr>");
                    }
                    else
                    {
                        Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\">").Append(EscapeForXMLandHTML(_property.Item2.ToString())).Append("</td></tr>");
                    }
                }
                //Output.Append("</table> <!-- VertexProperties -->");
            }
            #endregion

            #region Edges
            Output.Append("<tr><td><td><table class=\"gql_table\"border=\"1\"> <!-- Edges -->");
            Output.Append("<tr><td style=\"width:250px\">edges</td><td style=\"width:400px\">");

            foreach (var _edge in aVertex.GetAllEdges())
            {
                if (_edge.Item2 == null)
                {
                    Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_edge.Item1)).Append("</td><td style=\"width:400px\"></td></tr>");
                }
                else
                {
                    Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_edge.Item1)).Append("</td><td style=\"width:400px\">").Append(GenerateEdgeViewHTML(_edge.Item2)).Append("</td></tr>");
                }
            }

            Output.Append("</td></td></tr>");
            Output.Append("</table> <!-- Edges -->");
            // add to the results...
            //_results.Add(new JObject(new JProperty("edges", _edges)));
            #endregion

            return(Output.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates an text vertex view.
        /// </summary>
        /// <param name="aVertex">The vertex.</param>
        /// <param name="Header">The header.</param>
        /// <returns>An string, that contains the text vertex view.</returns>
        private String GenerateVertexViewText(String Header, IVertexView aVertex)
        {
            StringBuilder Output = new StringBuilder();

            // take one IVertexView and traverse through it
            #region Vertex Properties

            Output.AppendLine();

            if (aVertex.GetCountOfProperties() > 0)
            {
                foreach (var _property in aVertex.GetAllProperties())
                {
                    if (_property.Item2 == null)
                    {
                        Output.AppendLine(Header + _property.Item1);
                    }
                    else
                    {
                        if (_property.Item2 is Stream)
                        {
                            Output.AppendLine(Header + _property.Item1 + "\t BinaryProperty");
                        }
                        else
                        {
                            if (_property.Item2 is ICollectionWrapper)
                            {
                                Output.AppendLine(Header + _property.Item1);
                                HandleListProperties((ICollectionWrapper)_property.Item2, Header, ref Output);
                            }
                            else
                            {
                                Output.AppendLine(Header + _property.Item1 + "\t " + _property.Item2.ToString());
                            }
                        }
                    }
                }
            }

            #endregion

            #region Edges

            Output.AppendLine(Header + "\t Edges:");

            foreach (var _edge in aVertex.GetAllEdges())
            {
                if (_edge.Item2 == null)
                {
                    Output.AppendLine(Header+"\t\t"+_edge.Item1);
                }
                else
                {
                    Output.AppendLine(Header+"\t\t"+_edge.Item2.GetType().Name);
                    Output.AppendLine(Header+"\t\t"+_edge.Item1).Append(GenerateEdgeViewText(Header+"\t\t\t",_edge.Item2));
                }
            }

            #endregion

            return Output.ToString();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Generates an text vertex view.
        /// </summary>
        /// <param name="aVertex">The vertex.</param>
        /// <param name="Header">The header.</param>
        /// <returns>An string, that contains the text vertex view.</returns>
        private String GenerateVertexViewText(String Header, IVertexView aVertex)
        {
            StringBuilder Output = new StringBuilder();

            // take one IVertexView and traverse through it
            #region Vertex Properties

            Output.AppendLine();

            if (aVertex.GetCountOfProperties() > 0)
            {
                foreach (var _property in aVertex.GetAllProperties())
                {
                    if (_property.Property == null)
                    {
                        Output.AppendLine(Header + _property.PropertyName);
                    }
                    else
                    {
                        if (_property.Property is Stream)
                        {
                            Output.AppendLine(Header + _property.PropertyName + "\t BinaryProperty");
                        }
                        else
                        {
                            if (_property.Property is ICollectionWrapper)
                            {
                                Output.AppendLine(Header + _property.PropertyName);
                                HandleListProperties((ICollectionWrapper)_property.Property, Header, ref Output);
                            }
                            else
                            {
                                Output.AppendLine(Header + _property.PropertyName + "\t " + _property.Property.ToString());
                            }
                        }
                    }
                }
            }

            #endregion

            #region Edges

            Output.AppendLine(Header + "\t Edges:");

            foreach (var _edge in aVertex.GetAllEdges())
            {
                if (_edge.Edge == null)
                {
                    Output.AppendLine(Header + "\t\t" + _edge.EdgeName);
                }
                else
                {
                    Output.AppendLine(Header + "\t\t" + _edge.Edge.GetType().Name);
                    Output.AppendLine(Header + "\t\t" + _edge.EdgeName).Append(GenerateEdgeViewText(Header + "\t\t\t", _edge.Edge));
                }
            }

            #endregion

            return(Output.ToString());
        }
Exemplo n.º 4
0
        private String GenerateVertexViewHTML(IVertexView aVertex)
        {
            StringBuilder Output = new StringBuilder();
            // take one IVertexView and traverse through it
            #region Vertex Properties
            if (aVertex.GetCountOfProperties() > 0)
            {
                //Output.Append("<table class=\"gql_table\" border=\"1\"> <!-- VertexProperties -->");
                foreach (var _property in aVertex.GetAllProperties())
                {
                    if (_property.Item2 == null)
                        Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\"></td></tr>");
                    else
                        if (_property.Item2 is Stream)
                            Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\">BinaryProperty</td></tr>");
                        else
                            Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\">").Append(EscapeForXMLandHTML(_property.Item2.ToString())).Append("</td></tr>");
                }
                //Output.Append("</table> <!-- VertexProperties -->");
            }
            #endregion

            #region Edges
            Output.Append("<tr><td><td><table class=\"gql_table\"border=\"1\"> <!-- Edges -->");
            Output.Append("<tr><td style=\"width:250px\">edges</td><td style=\"width:400px\">");

            foreach (var _edge in aVertex.GetAllEdges())
            {
                if (_edge.Item2 == null)
                {
                    Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_edge.Item1)).Append("</td><td style=\"width:400px\"></td></tr>");
                }
                else
                {
                    Output.Append("<tr><td style=\"width:250px\">").Append(EscapeForXMLandHTML(_edge.Item1)).Append("</td><td style=\"width:400px\">").Append(GenerateEdgeViewHTML(_edge.Item2)).Append("</td></tr>");
                }
            }

            Output.Append("</td></td></tr>");
            Output.Append("</table> <!-- Edges -->");
            // add to the results...
            //_results.Add(new JObject(new JProperty("edges", _edges)));
            #endregion

            return Output.ToString();
        }
Exemplo n.º 5
0
        public bool Equals(IVertexView x, IVertexView y)
        {
            if (x.GetCountOfProperties() != y.GetCountOfProperties())
            {
                return(false);
            }

            var xProperties = x.GetAllProperties().ToList();
            var yProperties = y.GetAllProperties().ToList();

            if (xProperties.Count != xProperties.Count)
            {
                return(false);
            }


            for (int i = 0; i <= xProperties.Count; i++)
            {
                if (xProperties[i].PropertyName != yProperties[i].PropertyName)
                {
                    return(false);
                }

                if (!xProperties[i].Property.Equals(yProperties[i].Property))
                {
                    return(false);
                }
            }

            var xBinaryProperties = x.GetAllBinaryProperties().ToList();
            var yBinaryProperties = y.GetAllBinaryProperties().ToList();

            if (xBinaryProperties.Count != yBinaryProperties.Count)
            {
                return(false);
            }

            for (int i = 0; i <= xBinaryProperties.Count; i++)
            {
                if (xBinaryProperties[i].PropertyName != yBinaryProperties[i].PropertyName)
                {
                    return(false);
                }

                if (!xBinaryProperties[i].BinaryPropery.Equals(yBinaryProperties[i].BinaryPropery))
                {
                    return(false);
                }
            }

            var xEdges = x.GetAllEdges().ToList();
            var yEdges = y.GetAllEdges().ToList();

            if (xEdges.Count != yEdges.Count)
            {
                return(false);
            }

            for (int i = 0; i <= xEdges.Count; i++)
            {
                if (xEdges[i].EdgeName != xEdges[i].EdgeName)
                {
                    return(false);
                }


                if (!this.Equals(xEdges[i].Edge, yEdges[i].Edge))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Generates an text vertex view.
        /// </summary>
        /// <param name="aVertex">The vertex.</param>
        /// <param name="Header">The header.</param>
        /// <returns>An string, that contains the text vertex view.</returns>
        private String GenerateVertexViewText(String Header, IVertexView aVertex)
        {
            StringBuilder Output = new StringBuilder();

            // take one IVertexView and traverse through it
            #region Vertex Properties

            Output.AppendLine();

            if (aVertex.GetCountOfProperties() > 0)
            {
                foreach (var _property in aVertex.GetAllProperties())
                {
                    if (_property.Item2 == null)
                    {
                        Output.AppendLine(Header + _property.Item1);
                    }
                    else
                    {
                        if (_property.Item2 is Stream)
                        {
                            Output.AppendLine(Header + _property.Item1 + "\t BinaryProperty");
                        }
                        else
                        {
                            if (_property.Item2 is ICollectionWrapper)
                            {
                                Output.AppendLine(Header + _property.Item1);
                                HandleListProperties((ICollectionWrapper)_property.Item2, Header, ref Output);
                            }
                            else
                            {
                                if (_property.Item2.GetType().IsSubclassOf(typeof(AUserdefinedDataType)))
                                {
                                    Output.AppendLine(Header + _property.Item1 + "\t " + ((AUserdefinedDataType)_property.Item2).Value);
                                }
                                else
                                {
                                    Output.AppendLine(Header + _property.Item1 + "\t " + _property.Item2.ToString());
                                }
                            }
                        }
                    }
                }
            }

            #endregion

            #region Edges

            Output.AppendLine(Header + "\t Edges:");

            foreach (var _edge in aVertex.GetAllEdges())
            {
                if (_edge.Item2 == null)
                {
                    Output.AppendLine(Header + "\t\t" + _edge.Item1);
                }
                else
                {
                    Output.AppendLine(Header + "\t\t" + _edge.Item2.GetType().Name);
                    Output.AppendLine(Header + "\t\t" + _edge.Item1).Append(GenerateEdgeViewText(Header + "\t\t\t", _edge.Item2));
                }
            }

            #endregion

            return(Output.ToString());
        }