Beispiel #1
0
        public string getOntologyByCategory(string id)
        {
            var ontologyHelper = new OntologyHelper();
            var ontologyJson   = ontologyHelper.getOntology(id);

            return(ontologyJson);
        }
Beispiel #2
0
        public void Initialize(IAppBuilder app)
        {
            var ontologyHelper = new OntologyHelper();
            var defaultOntology = ConfigurationManager.AppSettings["DefaultOntology"];
            var s = ontologyHelper.getOntology("defaultOntology");
            

        }
Beispiel #3
0
        public ActionResult Index()
        {
            ViewBag.Message = "CUAHSI Hydrologic Data Services";

            if (Session["sessionGuid"] == null)
            {
                string sessionguid = Guid.NewGuid().ToString();
                Session["sessionGuid"]  = sessionguid;
                ViewBag.ThisSessionGuid = sessionguid;
            }
            else
            {
                ViewBag.ThisSessionGuid = Session["sessionGuid"].ToString();
            }

            var ontologyHelper = new OntologyHelper();

            return(View());
        }
Beispiel #4
0
        public DangerousSituation GenerateDangerousSituation(SafeSituation safeSituation)
        {
            var dangerousSituation = new DangerousSituation();
            var nodes = safeSituation
                        .GetNodes()
                        .Where(x =>
                               x.FromRelations.Any(y => y.Name == Relations.Affects || y.Name == Relations.APartOf) ||
                               x.ToRelations.Any(y => y.Name == Relations.Affects || y.Name == Relations.APartOf)
                               )
                        .ToNodeCollection();

            if (nodes.Count > 0)
            {
                var node     = nodes.GetRandom();
                var relation = node.FromRelations
                               .Union(node.ToRelations)
                               .Where(x => x.Name == Relations.Affects || x.Name == Relations.APartOf)
                               .ToRelationCollection()
                               .GetRandom();
                var dangerousNode = OntologyHelper.GetDangerousNode(relation);
                if (dangerousNode.ToRelations.Any(x => x.Name == Relations.Agent))
                {
                    dangerousSituation.Agent = dangerousNode;
                }

                if (dangerousNode.ToRelations.Any(x => x.Name == Relations.Action))
                {
                    dangerousSituation.Action = dangerousNode;
                }

                if (dangerousNode.ToRelations.Any(x => x.Name == Relations.Object))
                {
                    dangerousSituation.Object = dangerousNode;
                }

                if (dangerousNode.ToRelations.Any(x => x.Name == Relations.Locative))
                {
                    dangerousSituation.Locative = dangerousNode;
                }
            }
            return(GenerateSituation(dangerousSituation, Nodes.DangerousSituation).ToDangerousSituation());
        }