Пример #1
0
        public ActionResult browseOPCUAServer(OpcuaNodeList opcuaNodeList)
        {
            OPCUAUtility.connectToOPCUAServer(opcuaNodeList.opcuaEndpointURL);

            var mE_SEMANTIC_ANNOTATION = db.ME_SEMANTIC_ANNOTATION.ToList();

            opcuaNodeList.ontologyConcepts = mE_SEMANTIC_ANNOTATION
                                             .Select(x => new OntologyConcept()
            {
                Id = x.ID, IRI = x.IRI, Short_Name = x.SHORT_NAME
            })
                                             .ToList();
            ViewBag.OntologyConcepts = new SelectList(opcuaNodeList.ontologyConcepts, "IRI", "IRI");
            ViewBag.axiomList        = new SelectList(dictAxioms.Select(kv => new { Value = kv.Value, Text = kv.Value }), "Text", "Text");

            return(View("Index", OPCUAUtility.opcuaNodeStructure));
        }
Пример #2
0
        public ActionResult saveMethodOntology(OpcuaNodeList opcuaNodeList)
        {
            String SelectedMethodNodeId = opcuaNodeList.SelectedMethodNodeId;

            opcuaNodeList.ChildrenNodes     = OPCUAUtility.opcuaNodeStructure.ChildrenNodes;
            opcuaNodeList.MethodBrowseLinks = new List <OpcuaNodeLink>();

            int insertCount = 0;

            while (true)
            {
                OpcuaNodeLink link = opcuaNodeList.ChildrenNodes.Where(node => node.nodeID.Equals(SelectedMethodNodeId)).FirstOrDefault();
                //OpcuaNodeLink parentNode = opcuaNodeList.ChildrenNodes.Where(n => n.nodeID.Equals(sourceNode.parentNodeId)).FirstOrDefault();
                opcuaNodeList.MethodBrowseLinks.Insert(insertCount, link);

                if (String.IsNullOrWhiteSpace(link.parentNodeId))
                {
                    break;
                }

                SelectedMethodNodeId = link.parentNodeId;
                insertCount++;
            }
            opcuaNodeList.MethodBrowseLinks.Reverse();
            opcuaNodeList.ChildrenNodes = OPCUAUtility.opcuaNodeStructure.ChildrenNodes;
            String strOpcuaNodeList = new JavaScriptSerializer().Serialize(opcuaNodeList);

            RestClient.SendRequest("http://localhost:8081/ABoxOntReceiverService/webapi/myresource/getOntology", "POST", "application/json", strOpcuaNodeList);

            var mE_SEMANTIC_ANNOTATION = db.ME_SEMANTIC_ANNOTATION.ToList();

            opcuaNodeList.ontologyConcepts = mE_SEMANTIC_ANNOTATION
                                             .Select(x => new OntologyConcept()
            {
                Id = x.ID, IRI = x.IRI, Short_Name = x.SHORT_NAME
            })
                                             .ToList();
            OPCUAUtility.connectToOPCUAServer(opcuaNodeList.opcuaEndpointURL);
            ViewBag.OntologyConcepts = new SelectList(opcuaNodeList.ontologyConcepts, "IRI", "IRI");
            ViewBag.axiomList        = new SelectList(dictAxioms.Select(kv => new { Value = kv.Key, Text = kv.Value }), "Text", "Text");

            return(View("Index", OPCUAUtility.opcuaNodeStructure));
        }