示例#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(OwlAnnotationProperty node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;

            if (parentElement != null)
            {
                XmlElement propertyElement = _owlDocument.CreateElement("owl:AnnotationProperty", OwlNamespaceCollection.OwlNamespace);
                // Add the name attribute to the node
                AddNameAttribute(propertyElement, node);

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

                // Attach the node eventually to its parent
                parentElement.AppendChild(propertyElement);
                _visited.Add(node);
            }
        }
 /// <summary>
 /// Adds an OWL Resource of type owl:AnnotationProperty to the graph</summary>
 /// <param name="nodeUri">The Uri of the resource.</param>
 /// <returns>Returns a reference to the newly added resource.</returns>
 /// <exception cref="UriFormatException">The specified nodeUri is not a well formed Uri.</exception>
 private OwlAnnotationProperty AddAnnotationPropertyToGraph(string nodeUri)
 {
     //if the uri is null then create a blank node uri
     if(nodeUri == null)
         nodeUri = GetBlankNodeUri(null);
     OwlNode node = (OwlNode)_owlGraph[nodeUri];
     if((node != null) && (node is OwlAnnotationProperty))
         return (OwlAnnotationProperty)node;
     OwlNode typeNode = (OwlNode)_owlGraph.AddNode(OwlNamespaceCollection.OwlNamespace+"AnnotationProperty");
     if(node == null)
     {
         node = new OwlAnnotationProperty(nodeUri,typeNode);
         _owlGraph.AddEdge(((OwlAnnotationProperty)node).Type);
         _owlGraph.AddNode(node);
         return (OwlAnnotationProperty)node;
     }
     OwlAnnotationProperty newNode = new OwlAnnotationProperty(nodeUri,typeNode);
     _owlGraph.AddEdge(newNode.Type);
     MoveEdges(node, newNode);
     _owlGraph.Nodes.Remove(node);
     _owlGraph.AddNode(newNode);
     return newNode;
 }
        /// <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(OwlAnnotationProperty node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;
            if(parentElement != null)
            {
                XmlElement propertyElement = _owlDocument.CreateElement("owl:AnnotationProperty", OwlNamespaceCollection.OwlNamespace);
                // Add the name attribute to the node
                AddNameAttribute(propertyElement, node);

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

                // Attach the node eventually to its parent
                parentElement.AppendChild(propertyElement);
                node.Visited = true;
            }
        }
 /// <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 abstract void Visit(OwlAnnotationProperty node, Object parent);
 /// <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 abstract void Visit(OwlAnnotationProperty node, Object parent);