示例#1
0
        public object Visit(CogniPy.CNL.DL.Subsumption e)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(e.C.accept(this));
            sb.Append("⊑");
            sb.Append(Modality(e.modality));
            sb.Append(e.D.accept(this));
            return(sb.ToString());
        }
示例#2
0
 public virtual object Visit(CogniPy.CNL.DL.Subsumption e)
 {
     e.C.accept(this);
     e.D.accept(this);
     return(e);
 }
示例#3
0
        public override object Visit(CogniPy.CNL.DL.Subsumption e)
        {
            modality = e.modality;
            //string a, b;
            //if (e.C is Ontorion.CNL.DL.Atomic && (e.C as Ontorion.CNL.DL.Atomic).id.Equals(leftSide.id))
            if (e.C is CogniPy.CNL.DL.Atomic)
            {
                concept = (e.C as CogniPy.CNL.DL.Atomic).id;
                if (e.D is CogniPy.CNL.DL.Atomic)
                {
                    CogniPy.CNL.DL.Atomic atom = e.D as CogniPy.CNL.DL.Atomic;
                    relation       = "be";
                    relatedConcept = atom.id;
                }
                else if (e.D is CogniPy.CNL.DL.Restriction)
                {
                    string restriction          = ((e.D as CogniPy.CNL.DL.Restriction).R as CogniPy.CNL.DL.Atomic).id;
                    CogniPy.CNL.DL.IAccept node = null;
                    if (e.D is CogniPy.CNL.DL.OnlyRestriction)
                    {
                        node = (e.D as CogniPy.CNL.DL.OnlyRestriction).C;
                    }
                    else if (e.D is CogniPy.CNL.DL.SomeRestriction)
                    {
                        node = (e.D as CogniPy.CNL.DL.SomeRestriction).C;
                    }
                    else if (e.D is CogniPy.CNL.DL.OnlyValueRestriction)
                    {
                        node = (e.D as CogniPy.CNL.DL.OnlyValueRestriction).B;
                    }
                    else if (e.D is CogniPy.CNL.DL.SomeValueRestriction)
                    {
                        node = (e.D as CogniPy.CNL.DL.SomeValueRestriction).B;
                    }
                    else if (e.D is CogniPy.CNL.DL.NumberRestriction)
                    {
                        //string str = tools.GetENDLFromAst(e.D);
                        node = (e.D as CogniPy.CNL.DL.NumberRestriction).C;
                    }
                    else if (e.D is CogniPy.CNL.DL.NumberValueRestriction)
                    {
                        node = (e.D as CogniPy.CNL.DL.NumberValueRestriction).B;
                    }

                    relation = restriction;
                    string restrVal = tools.GetENDLFromAst(node, false, ns2pfx);
                    relatedConcept = restrVal.Replace("is ", "");
                }
                else
                {
                    relation       = null;
                    relatedConcept = tools.GetENDLFromAst(e.D, false, ns2pfx);
                }

                //var instSet = new List<Ontorion.CNL.DL.Instance>();
                //instSet.Add(new Ontorion.CNL.DL.NamedInstance(null) { name = "_Tom" });
                //a = tools.GetENDLFromAst(new Ontorion.CNL.DL.Subsumption(null) { C = new Ontorion.CNL.DL.InstanceSet(null) { Instances = instSet }, D = e.D });
                //a = tools.GetENDLFromAst(e.D);
                //string[] spl = a.Split(' ');
                //modalities[e.modality].Add(new KeyValuePair<string, string>(spl[1], string.Join(" ", spl, 2, spl.Length - 2)));
            }
            return(base.Visit(e));
        }