public override IOwlIndividual Create(Shape shape)
        {
            IOwlIndividual individual = new OwlIndividual(
                ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, ToolKit.FlowElementNaming(shape)),
                (OwlNode)base._graph.Nodes[ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, "sequenceFlow")]);

            individual = base.BuildProperty(shape, individual);

            return individual;
        }
Пример #2
0
        public override IOwlIndividual Create(Shape shape)
        {
            IOwlIndividual individual = new OwlIndividual(
                ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, ToolKit.StringShift(shape.Text)),
                (OwlNode)base._graph.Nodes[ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, "task")]);

            individual = base.BuildProperty(shape, individual);

            return individual;
        }
        public override IOwlIndividual Create(Shape shape)
        {
            IOwlIndividual individual = new OwlIndividual(
                ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, ToolKit.StringShift(shape.Text)),
                (OwlNode)base._graph.Nodes[ToolKit.GetFullName(Constant.BPMN_TARGET_NAMESPACE, "gateway")]);

            individual = this.CalculateGatewayDirection(shape, individual);
            individual = this.BuildFlowRelationship(shape, individual);
            individual = this.BuildProperty(shape, individual);

            return individual;
        }
Пример #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 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);
            }
        }
Пример #5
0
        /// <summary>
        /// Adds an OWL Individual to the graph</summary>
        /// <param name="nodeUri">The Uri of the resource.</param>
        /// <param name="typeUri">The Uri of the type.</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 OwlIndividual AddIndividualToGraph(string nodeUri, string typeUri)
        {
            //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 OwlIndividual))
                return (OwlIndividual)node;
            OwlNode typeNode = (OwlNode)_owlGraph[typeUri];
            if(typeNode == null)
                typeNode = (OwlNode)_owlGraph.AddNode(typeUri);

            if(node == null)
            {
                node = new OwlIndividual(nodeUri,typeNode);
                _owlGraph.AddEdge(((OwlIndividual)node).Type);
                _owlGraph.AddNode(node);
                return (OwlIndividual)node;
            }
            OwlIndividual newNode = new OwlIndividual(nodeUri,typeNode);
            _owlGraph.AddEdge(newNode.Type);
            MoveEdges(node, newNode);
            _owlGraph.Nodes.Remove(node);
            _owlGraph.AddNode(newNode);
            return newNode;
        }
Пример #6
0
        public void test5(string file)
        {
            IOwlParser parser = new OwlXmlParser();
            IOwlGraph graph = parser.ParseOwl(file);

            string baseUri = "http://www.owl-ontologies.com/travel.owl#";
            OwlClass hotelNode = (OwlClass)graph.Nodes["http://www.owl-ontologies.com/travel.owl#LuxuryHotel"];

            OwlIndividual newHotel = new OwlIndividual(baseUri + "PellensPalace", hotelNode);
            graph.Nodes.Add(newHotel);

            IOwlGenerator generator = new OwlXmlGenerator();
            generator.GenerateOwl(graph, @"c:\travelnew.owl");
        }
        /// <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(!node.Visited)
                    VisitEdges(node, individualElement);

                // Attach the node eventually to its parent
                parentElement.AppendChild(individualElement);
                node.Visited = true;
            }
        }
Пример #8
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(OwlIndividual node, Object parent);
Пример #9
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(OwlIndividual node, Object parent);