示例#1
0
        /// <summary>
        /// Implementation of the visit function to generate some output, used in the visitor pattern
        /// </summary>
        /// <param name="node">The actual node which needs to be generated</param>
        /// <param name="parent">The parent object of the node</param>
        public override void Visit(OwlRestriction node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;

            if (parentElement != null)
            {
                XmlElement restrictionElement = _owlDocument.CreateElement("owl:Restriction", OwlNamespaceCollection.OwlNamespace);

                // If the node is not a blank one
                if (!node.IsAnonymous())
                {
                    // Add the name as one of its attributes
                    AddNameAttribute(restrictionElement, node);
                }

                // Generate all the edges going out of this node
                if (!_visited.Contains(node))
                {
                    VisitEdges(node, restrictionElement);
                }

                // Attach the node eventually to its parent
                parentElement.AppendChild(restrictionElement);
                _visited.Add(node);
            }
        }
        /// <summary>
        /// Implementation of the visit function to generate some output, used in the visitor pattern
        /// </summary>
        /// <param name="node">The actual node which needs to be generated</param>
        /// <param name="parent">The parent object of the node</param>
        public override void Visit(OwlRestriction node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;
            if(parentElement != null)
            {
                XmlElement restrictionElement = _owlDocument.CreateElement("owl:Restriction", OwlNamespaceCollection.OwlNamespace);

                // If the node is not a blank one
                if(!node.IsAnonymous())
                {
                    // Add the name as one of its attributes
                    AddNameAttribute(restrictionElement, node);
                }

                // Generate all the edges going out of this node
                if(!node.Visited)
                    VisitEdges(node, restrictionElement);

                // Attach the node eventually to its parent
                parentElement.AppendChild(restrictionElement);
                node.Visited = true;
            }
        }