コード例 #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(OwlOntologyProperty node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;

            if (parentElement != null)
            {
                XmlElement propertyElement = _owlDocument.CreateElement("owl:OntologyProperty", 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);
            }
        }
コード例 #2
0
 /// <summary>
 /// Adds an OWL Resource of type owl:OntologyProperty 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 OwlOntologyProperty AddOntologyPropertyToGraph(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 OwlOntologyProperty))
         return (OwlOntologyProperty)node;
     OwlNode typeNode = (OwlNode)_owlGraph.AddNode(OwlNamespaceCollection.OwlNamespace+"OntologyProperty");
     if(node == null)
     {
         node = new OwlOntologyProperty(nodeUri,typeNode);
         _owlGraph.AddEdge(((OwlOntologyProperty)node).Type);
         _owlGraph.AddNode(node);
         return (OwlOntologyProperty)node;
     }
     OwlOntologyProperty newNode = new OwlOntologyProperty(nodeUri,typeNode);
     _owlGraph.AddEdge(newNode.Type);
     MoveEdges(node, newNode);
     _owlGraph.Nodes.Remove(node);
     _owlGraph.AddNode(newNode);
     return newNode;
 }
コード例 #3
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(OwlOntologyProperty node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;
            if(parentElement != null)
            {
                XmlElement propertyElement = _owlDocument.CreateElement("owl:OntologyProperty", 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;
            }
        }
コード例 #4
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 abstract void Visit(OwlOntologyProperty node, Object parent);
コード例 #5
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 abstract void Visit(OwlOntologyProperty node, Object parent);