public override void BuildRelationship(Shape shape)
        {
            Shape incomingShape = ToolKit.QueryFlowRelationship(shape, VisGluedShapesFlags.visGluedShapesIncoming2D)[0];

            Shape outgoingShape = ToolKit.QueryFlowRelationship(shape, VisGluedShapesFlags.visGluedShapesOutgoing2D)[0];

            Shape[] incomingShapes = ToolKit.ShapeToArray(incomingShape);
            Shape[] outgoingShapes = ToolKit.ShapeToArray(outgoingShape);

            foreach (Shape incoming in incomingShapes)
            {
                foreach (Shape outgoing in outgoingShapes)
                {

                    IOwlNode incomingNode = base._graph.Nodes[ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, ToolKit.StringShift(incoming.Text))];
                    IOwlNode outgoingNode = base._graph.Nodes[ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, ToolKit.StringShift(outgoing.Text))];

                    string relationship = ToolKit.FlowElementNaming(incoming, shape, outgoing);
                    IOwlNode relationshipNode = new OwlNode(ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, relationship));
                    IOwlEdge incomingEdge = new OwlEdge(ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, "incoming"));
                    IOwlEdge outgoingEdge = new OwlEdge(ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, "outgoing"));
                    incomingEdge.ChildNode = new OwlLiteral(relationship,"en-us","xsd:string");
                    incomingNode.AttachChildEdge(incomingEdge);

                    outgoingEdge.ChildNode = new OwlLiteral(relationship, "en-us", "xsd:string");
                    outgoingNode.AttachChildEdge(outgoingEdge);

                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the OwlEdge class with the given URI
        /// </summary>
        /// <param name="edgeUri">A string representing the Uri of this edge. The ChildNode and ParentNode properties are set to null</param>
        /// <exception cref="UriFormatException">The specified edgeUri was not a well formed URI</exception>
        public OwlEdge(string edgeUri)
        {
            Uri u = new Uri(edgeUri);

            _edgeID     = edgeUri;
            _childNode  = null;
            _parentNode = null;
        }
Esempio n. 3
0
        /// <summary>
        /// Generates the OWL graph into an XmlDocument object
        /// </summary>
        /// <param name="graph">The graph which needs to be generated</param>
        /// <param name="doc">The XmlDocument object used as a destination for the graph</param>
        public void GenerateOwl(IOwlGraph graph, XmlDocument doc)
        {
            if (doc == null)
            {
                throw (new ArgumentNullException("The specified XmlDocument object is a null reference"));
            }

            Warnings.Clear();
            Errors.Clear();

            _visited.Clear();

            XmlElement root = _owlDocument.CreateElement("rdf:RDF", OwlNamespaceCollection.RdfNamespace);

            _owlDocument.AppendChild(root);

            //Added by HM
            // Create an XML declaration.
            XmlDeclaration xmldecl = _owlDocument.CreateXmlDeclaration("1.0", null, null);

            xmldecl.Encoding   = "UTF-8";
            xmldecl.Standalone = "yes";

            // Add the new node to the document.
            _owlDocument.InsertBefore(xmldecl, root);

            //End of HM addition

            _baseUri = graph.NameSpaces["xml:base"];

            IDictionaryEnumerator nsEnumerator = (IDictionaryEnumerator)graph.NameSpaces.GetEnumerator();

            while (nsEnumerator.MoveNext())
            {
                // Write all the namespaces to the document
                XmlAttribute nsAttribute = _owlDocument.CreateAttribute((nsEnumerator.Key).ToString());
                nsAttribute.Value = (nsEnumerator.Value).ToString();
                root.Attributes.Append(nsAttribute);
                // Also insert the reversed namespaces into the a local variable
                _namespaces[nsEnumerator.Value.ToString()] = nsEnumerator.Key.ToString();
            }

            IDictionaryEnumerator nEnumerator = (IDictionaryEnumerator)graph.Nodes.GetEnumerator();

            while (nEnumerator.MoveNext())
            {
                OwlNode node = (OwlNode)graph.Nodes[(nEnumerator.Key).ToString()];
                if (!node.IsAnonymous())
                {
                    node.Accept(this, root);
                }
            }

            XmlComment comment = _owlDocument.CreateComment("This file has been generated by the OwlDotNetApi.");

            _owlDocument.AppendChild(comment);
            doc = _owlDocument;
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the OwlClass class with the given Uri and TypeNode
 /// </summary>
 /// <param name="nodeUri">A string representing the Uri of this Resource</param>
 /// <param name="typeNode">The OwlNode object to attach to the edge specifying the type. This is usually a node with ID owl:Class.</param>
 /// <exception cref="ArgumentNullException">typeNode is a null reference</exception>
 public OwlClass(string nodeUri, OwlNode typeNode)
 {
     if(typeNode == null)
         throw(new ArgumentNullException());
     ID = nodeUri;
     _typeEdge = new OwlEdge(OwlNamespaceCollection.RdfNamespace+"type");
     _typeEdge.AttachChildNode(typeNode);
     AttachChildEdge(_typeEdge);
 }
Esempio n. 5
0
        /// <summary>
        /// Visit all the outgoing edges of the node and add them to the parent
        /// </summary>
        /// <param name="node">The actual node of which we need to visit the edges</param>
        /// <param name="parent">The xml representative of the node</param>
        public void VisitEdges(OwlNode node, Object parent)
        {
            OwlEdgeCollection edges = (OwlEdgeCollection)node.ChildEdges;

            foreach (OwlEdge e in edges)
            {
                e.Accept(this, parent);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// This method extracts the reference of the node.
        /// </summary>
        /// <param name="node">The node from which we want to retrieve the reference</param>
        /// <returns>The reference of the node if it has a short reference, or the full uri otherwise</returns>
        private string GetNodeReference(OwlNode node)
        {
            Uri    uri  = new Uri(node.ID);
            string name = uri.ToString();

            if (name.StartsWith(_baseUri))
            {
                name = uri.Fragment;
            }
            return(name);
        }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the OwlRestriction class with the given Uri and TypeNode
 /// </summary>
 /// <param name="nodeUri">A string representing the Uri of this Resource</param>
 /// <param name="typeNode">The OwlNode object to attach to the edge specifying the type. This is usually a node with ID owl:Restriction.</param>
 /// <exception cref="ArgumentNullException">typeNode is a null reference</exception>
 public OwlRestriction(string nodeUri, OwlNode typeNode)
 {
     if (typeNode == null)
     {
         throw(new ArgumentNullException());
     }
     ID        = nodeUri;
     _typeEdge = new OwlEdge(OwlNamespaceCollection.RdfNamespace + "type");
     _typeEdge.AttachChildNode(typeNode);
     AttachChildEdge(_typeEdge);
 }
Esempio n. 8
0
        /// <summary>
        /// Adds a node to the Graph
        /// </summary>
        /// <param name="nodeUri">A string representing the URI of the new node.</param>
        /// <exception cref="UriFormatException">The specified nodeUri is not a well formed URI.</exception>
        /// <returns>An object that implements the IOwlNode interface. This is a reference to the new node added.
        /// This method checks the graph to determine whether the node with the specified URI exists.
        /// If it does then a reference to the existing node is returned. If it does not exist then a new node is created, added
        /// to the graph and returned.</returns>
        public IOwlNode AddNode(string nodeUri)
        {
            IOwlNode node = _nodes[nodeUri];

            if (node == null)
            {
                node            = new OwlNode(nodeUri);
                _nodes[nodeUri] = node;
            }
            return(node);
        }
Esempio n. 9
0
        /// <summary>
        /// Determines whether the specified node is a member of this collection.
        /// </summary>
        /// <param name="node">An object that implements the IOwlNode interface.</param>
        /// <returns>True if a node with the same ID was found in the collection.</returns>
        public bool Contains(IOwlNode node)
        {
            if (node == null)
            {
                return(false);
            }
            OwlNode rNode = (OwlNode)_nodes[node.ID];

            if (rNode != null)
            {
                return(rNode == node);
            }
            return(false);
        }
Esempio n. 10
0
        /// <summary>
        /// This method extracts the localName of the node
        /// </summary>
        /// <param name="node">The node from which we want to retrieve the local ID</param>
        /// <returns>The local name of the node if it has one, or the full uri otherwise</returns>
        private string GetNodeID(OwlNode node)
        {
            Uri    uri  = new Uri(node.ID);
            string name = uri.ToString();

            if (name.StartsWith(_baseUri))
            {
                name = uri.Fragment;
                if (name.Length > 0)
                {
                    name = uri.Fragment.Substring(1, uri.Fragment.Length - 1);
                }
            }
            return(name);
        }
Esempio n. 11
0
        private void AddNameAttribute(XmlElement element, OwlNode node)
        {
            XmlAttribute nameAttribute;

            if (_visited.Contains(node))
            {
                nameAttribute       = _owlDocument.CreateAttribute("rdf", "about", OwlNamespaceCollection.RdfNamespace);
                nameAttribute.Value = GetNodeReference(node);
            }
            else
            {
                nameAttribute       = _owlDocument.CreateAttribute("rdf", "ID", OwlNamespaceCollection.RdfNamespace);
                nameAttribute.Value = GetNodeID(node);
            }
            element.Attributes.Append(nameAttribute);
        }
Esempio n. 12
0
        /// <summary>
        /// The general implementation of a regular OwlNode. A node is only of type OwlNode in some special cases.
        /// </summary>
        /// <param name="node">The actual node to visit</param>
        /// <param name="parent">The parent object of the node</param>
        public override void Visit(OwlNode node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;

            if (parentElement != null)
            {
                // Here we will only visit the blank node, because these are
                // the only ones we need. The others are the standard nodes
                // representing datatypes or owl, rdf, rdfs predefined nodes.
                if (node.IsAnonymous())
                {
                    XmlComment comment = _owlDocument.CreateComment("Visiting a regular node: " + node.GetType());
                    parentElement.AppendChild(comment);

                    _visited.Add(node);
                }
            }
        }
Esempio n. 13
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(OwlCollection node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;

            if (parentElement != null)
            {
                // Set the datatype property on its parent
                XmlAttribute nameAttribute = _owlDocument.CreateAttribute("rdf", "parseType", OwlNamespaceCollection.RdfNamespace);
                nameAttribute.Value = "Collection";
                parentElement.Attributes.Append(nameAttribute);

                IEnumerator e = node.GetEnumerator();
                while (e.MoveNext())
                {
                    OwlNode n = (OwlNode)e.Current;
                    n.Accept(this, parent);
                }
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Adds a node to the collection.
        /// </summary>
        /// <param name="nodeID">The ID of the node to add.</param>
        /// <param name="newNode">An object that implements the IOwlNode interface. This is a reference to the node to add.</param>
        /// <exception cref="ArgumentException">A node with the specified ID already exists in the collection.</exception>
        /// <exception cref="ArgumentNullException">The specified ID is a null reference.</exception>
        public void Add(string nodeID, IOwlNode newNode)
        {
            if (newNode == null)
            {
                throw (new ArgumentNullException());
            }
            // Added:
            // Check on duplicate keys, if key is already in the dictionary,
            // then we don't to anything.
            // Why: Error coming from Hano Soma
            // Todo: Recheck this if it is correct
            OwlNode rNode = (OwlNode)_nodes[nodeID];

            if (rNode != null)
            {
                return;
            }
            // End
            _nodes.Add(nodeID, newNode);
        }
Esempio n. 15
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(OwlIndividual node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;

            if (parentElement != null)
            {
                //string qualifiedName = prefix + ":" + localName;
                OwlNode typeNode = (OwlNode)node.Type.ChildNode;
                Uri     uri      = new Uri(typeNode.ID);
                // Retrieve the local name from the uri
                string localName = uri.Fragment.Substring(1, uri.Fragment.Length - 1);
                // Get the path, up to the local name, from the uri
                string path   = uri.GetLeftPart(UriPartial.Path) + "#";
                string prefix = "";
                if (path != _baseUri)
                {
                    // Search for the prefix of this individual
                    int pos = _namespaces[path].IndexOf(':');
                    if (pos != -1)
                    {
                        prefix = _namespaces[path].Substring(++pos);
                    }
                }
                string qualifiedName = (prefix.Length != 0) ? (prefix + ":" + localName) : localName;

                XmlElement individualElement = _owlDocument.CreateElement(qualifiedName, path);

                // Add the name attribute to the node
                AddNameAttribute(individualElement, node);

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

                // Attach the node eventually to its parent
                parentElement.AppendChild(individualElement);
                _visited.Add(node);
            }
        }
 /// <summary>
 /// This method extracts the reference of the node.
 /// </summary>
 /// <param name="node">The node from which we want to retrieve the reference</param>
 /// <returns>The reference of the node if it has a short reference, or the full uri otherwise</returns>
 private string GetNodeReference(OwlNode node)
 {
     Uri uri = new Uri(node.ID);
     string name = uri.ToString();
     if(name.StartsWith(_baseUri))
     {
         name = uri.Fragment;
     }
     return name;
 }
 /// <summary>
 /// This method extracts the localName of the node
 /// </summary>
 /// <param name="node">The node from which we want to retrieve the local ID</param>
 /// <returns>The local name of the node if it has one, or the full uri otherwise</returns>
 private string GetNodeID(OwlNode node)
 {
     Uri uri = new Uri(node.ID);
     string name = uri.ToString();
     if(name.StartsWith(_baseUri))
     {
         name = uri.Fragment;
         if(name.Length > 0)
             name = uri.Fragment.Substring(1, uri.Fragment.Length-1);
     }
     return name;
 }
 private void AddNameAttribute(XmlElement element, OwlNode node)
 {
     XmlAttribute nameAttribute;
     if(node.Visited)
     {
         nameAttribute = _owlDocument.CreateAttribute("rdf", "about", OwlNamespaceCollection.RdfNamespace);
         nameAttribute.Value = GetNodeReference(node);
     }
     else
     {
         nameAttribute = _owlDocument.CreateAttribute("rdf", "ID", OwlNamespaceCollection.RdfNamespace);
         nameAttribute.Value = GetNodeID(node);
     }
     element.Attributes.Append(nameAttribute);
 }
 /// <summary>
 /// Visit all the outgoing edges of the node and add them to the parent
 /// </summary>
 /// <param name="node">The actual node of which we need to visit the edges</param>
 /// <param name="parent">The xml representative of the node</param>
 public void VisitEdges(OwlNode node, Object parent)
 {
     OwlEdgeCollection edges = (OwlEdgeCollection)node.ChildEdges;
     foreach(OwlEdge e in edges)
     {
         e.Accept(this, parent);
     }
 }
        /// <summary>
        /// The general implementation of a regular OwlNode. A node is only of type OwlNode in some special cases.
        /// </summary>
        /// <param name="node">The actual node to visit</param>
        /// <param name="parent">The parent object of the node</param>
        public override void Visit(OwlNode node, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;
            if(parentElement != null)
            {
                // Here we will only visit the blank node, because these are
                // the only ones we need. The others are the standard nodes
                // representing datatypes or owl, rdf, rdfs predefined nodes.
                if(node.IsAnonymous())
                {
                    XmlComment comment = _owlDocument.CreateComment("Visiting a regular node: " + node.GetType());
                    parentElement.AppendChild(comment);

                    node.Visited = true;
                }
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Implementation of an OwlEdge.
        /// </summary>
        /// <param name="edge">The actual edge to be visited</param>
        /// <param name="parent">The parent object (node) of the edge</param>
        public override void Visit(OwlEdge edge, Object parent)
        {
            XmlElement parentElement = parent as XmlElement;

            if (parentElement != null)
            {
                Uri uri = new Uri(edge.ID);
                // Retrieve the local name from the uri
                string localName = uri.Fragment.Substring(1, uri.Fragment.Length - 1);
                // Get the path, up to the local name, from the uri
                string path = uri.GetLeftPart(UriPartial.Path) + "#";
                string prefix;
                // Check for the namespace of the edge in order to get the correct prefix
                if (path == OwlNamespaceCollection.OwlNamespace)
                {
                    prefix = OwlNamespaceCollection.OwlNamespacePrefix;
                }
                else if (path == OwlNamespaceCollection.RdfNamespace)
                {
                    prefix = OwlNamespaceCollection.RdfNamespacePrefix;
                }
                else if (path == OwlNamespaceCollection.RdfSchemaNamespace)
                {
                    prefix = OwlNamespaceCollection.RdfSchemaNamespacePrefix;
                }
                else
                {
                    // If the namespace of the edge is something else, then look for it
                    prefix = "";
                    if (path != _baseUri)
                    {
                        // Search for the prefix of this individual
                        int pos = _namespaces[path].IndexOf(':');
                        if (pos != -1)
                        {
                            prefix = _namespaces[path].Substring(++pos);
                        }
                    }
                }

                string qualifiedName = (prefix.Length != 0) ? (prefix + ":" + localName) : localName;
                // At this point we will not generate the rdf:type edges.
                XmlElement edgeElement = _owlDocument.CreateElement(qualifiedName, path);

                // Check to see if the child node is an anonymous one or not. If it is, then further
                // process that node, otherwise just reference it by name.
                OwlNode node = (OwlNode)edge.ChildNode;
                if (node.IsAnonymous() || node.IsLiteral())
                {
                    node.Accept(this, edgeElement);
                }
                else
                {
                    // Add the name as one of its attributes
                    XmlAttribute nameAttribute = _owlDocument.CreateAttribute("rdf", "resource", OwlNamespaceCollection.RdfNamespace);
                    nameAttribute.Value = GetNodeReference(node);
                    edgeElement.Attributes.Append(nameAttribute);
                }
                parentElement.AppendChild(edgeElement);
            }
        }
        /// <summary>
        /// Parses the rdf:value, rdf:type attributes as well as any attributes not part of the OWL, RDF or XML namespace
        /// </summary>
        /// <param name="node">The XmlNode on which the attributes appear</param>
        /// <param name="rNode">The OwlNode to which the attributes must be applied</param>
        private void ParseNodeAttributes(XmlNode node, OwlNode rNode)
        {
            int count = node.Attributes.Count;
            for(int i=0;i<count;i++)
            {
                XmlAttribute attr = node.Attributes[i];
                if(!IsOwlRdfXmlProperty(attr) || (attr.Name=="rdf:type") || (attr.Name == "rdf:value"))
                {
                    if(IsUnqualifiedRdfProperty(node.Attributes[i]))
                        OnWarning("Unqualified use of rdf:"+node.Attributes[i].LocalName);

                    //create a new edge
                    string edgeUri = PrependXmlBase(attr.NamespaceURI+attr.LocalName, GetXmlBase(node));
                    OwlEdge rEdge = new OwlEdge(edgeUri);
                    OwlNode childNode = null;
                    if(attr.Name == "rdf:type")
                    {
                        childNode = (OwlNode)_owlGraph.AddNode(PrependXmlBase(attr.Value,GetXmlBase(node)));
                    }
                    else
                    {
                        childNode = (OwlLiteral)_owlGraph.AddLiteral(attr.Value,rNode.LangID,GetDatatypeUri(node));
                    }

                    rNode.AttachChildEdge(rEdge);
                    rEdge.AttachChildNode(childNode);
                    //add the new edge to the graph
                    _owlGraph.AddEdge(rEdge);
                }
            }
        }
Esempio n. 23
0
 /// <summary>
 /// Initializes a new instance of the OwlEdge class. Sets the ID, ChildNode and ParentNode properties to null
 /// </summary>
 public OwlEdge()
 {
     _edgeID     = "";
     _childNode  = null;
     _parentNode = null;
 }
Esempio n. 24
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(OwlNode node, Object parent);
Esempio n. 25
0
 /// <summary>
 /// Adds a node to the Graph
 /// </summary>
 /// <param name="nodeUri">A string representing the URI of the new node.</param>
 /// <exception cref="UriFormatException">The specified nodeUri is not a well formed URI.</exception>
 /// <returns>An object that implements the IOwlNode interface. This is a reference to the new node added.
 /// This method checks the graph to determine whether the node with the specified URI exists. 
 /// If it does then a reference to the existing node is returned. If it does not exist then a new node is created, added 
 /// to the graph and returned.</returns>
 public IOwlNode AddNode(string nodeUri)
 {
     IOwlNode node = _nodes[nodeUri];
     if(node == null)
     {
         node = new OwlNode(nodeUri);
         _nodes[nodeUri] = node;
     }
     return node;
 }
Esempio n. 26
0
 /// <summary>
 /// Initializes a new instance of the OwlEdge class. Sets the ID, ChildNode and ParentNode properties to null
 /// </summary>
 public OwlEdge()
 {
     _edgeID = "";
     _childNode = null;
     _parentNode = null;
 }
        /// <summary>
        /// Parses the OWL syntax on an edge.
        /// </summary>
        /// <param name="node">The XML Node representing the OWL edge</param>
        /// <param name="rEdge">The edge</param>
        /// <param name="parentNode">The parent OWL node</param>
        /// <returns>True if the edge was given an ID and attached to the parent node</returns>
        private bool ParseEdgeSyntax(XmlNode node, OwlEdge rEdge, OwlNode parentNode)
        {
            //first get the NameSpace URI, NameSpace prefix and the LocalName for the node
            String nameSpaceURI = node.NamespaceURI;
            String nameSpacePrefix = node.Prefix;
            String localName = node.LocalName;
            if(IsNonSyntacticElement(node))
            {
                rEdge.ID = nameSpaceURI + localName;

                if(rEdge.ID == (OwlNamespaceCollection.RdfNamespace + "type"))
                {
                    OwlNode typeNode;
                    if(rEdge.ChildNode.ID == (OwlNamespaceCollection.OwlNamespace + "DatatypeProperty"))
                    {
                        typeNode = (OwlNode)_owlGraph.AddNode(OwlNamespaceCollection.OwlNamespace+"DatatypeProperty");
                        OwlDatatypeProperty newNode = new OwlDatatypeProperty(parentNode.ID,typeNode);
                        _owlGraph.AddEdge(newNode.Type);
                        MoveEdges(parentNode, newNode);
                        _owlGraph.Nodes.Remove(parentNode);
                        _owlGraph.AddNode(newNode);
                        rEdge.AttachParentNode(newNode);
                        return true;
                    }
                    if(rEdge.ChildNode.ID == (OwlNamespaceCollection.OwlNamespace + "ObjectProperty"))
                    {
                        typeNode = (OwlNode)_owlGraph.AddNode(OwlNamespaceCollection.OwlNamespace+"ObjectProperty");
                        OwlObjectProperty newNode = new OwlObjectProperty(parentNode.ID,typeNode);
                        _owlGraph.AddEdge(newNode.Type);
                        MoveEdges(parentNode, newNode);
                        _owlGraph.Nodes.Remove(parentNode);
                        _owlGraph.AddNode(newNode);
                        rEdge.AttachParentNode(newNode);
                        return true;
                    }

                }

                rEdge.AttachParentNode(parentNode);
                return true;
            }

            if(IsSyntacticElement(node))
            {
                OnError("Cannot use " + node.Name + " as a property element");
                return false;
            }

            // It is an instance of a property
            rEdge.ID = nameSpaceURI + localName;
            rEdge.AttachParentNode(parentNode);
            return true;

            //			OnWarning("Unknown property element "+ node.Name);
            //			return false;
        }
Esempio n. 28
0
 /// <summary>
 /// Initializes a new instance of the OwlEdge class with the given URI
 /// </summary>
 /// <param name="edgeUri">A string representing the Uri of this edge. The ChildNode and ParentNode properties are set to null</param>
 /// <exception cref="UriFormatException">The specified edgeUri was not a well formed URI</exception>
 public OwlEdge(string edgeUri)
 {
     Uri u = new Uri(edgeUri);
     _edgeID = edgeUri;
     _childNode = null;
     _parentNode = null;
 }
 /// <summary>
 /// Moves all the edges associated with the source node to the destination node
 /// </summary>
 /// <param name="srcNode">The node from which the edges are to be moved.</param>
 /// <param name="destNode">The node to which the edges are to be moved</param>
 /// <remarks>This method moves all the edges from the src node to the dest node. 
 /// The src node is not removed from the graph. </remarks>
 private void MoveEdges(OwlNode srcNode, OwlNode destNode)
 {
     try
     {
         foreach(IOwlEdge parentEdge in srcNode.ParentEdges)
         {
             parentEdge.AttachChildNode(destNode);
         }
         foreach(IOwlEdge childEdge in srcNode.ChildEdges)
         {
             childEdge.AttachParentNode(destNode);
         }
     }
     catch
     {
         // sometimes an error is thrown saying that the collection is being modified
         // during the transfer. If this happens, just redo the transfer
         MoveEdges(srcNode, destNode);
     }
 }
 /// <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(OwlNode node, Object parent);