Beispiel #1
0
 public override object Visit(DLAnnotationAxiom e)
 {
     e.annotName = applyFullUri(e.annotName);
     if (e.subjKind != ARS.EntityKind.Statement.ToString())
     {
         e.subject = applyFullUri(e.subject);
     }
     return(base.Visit(e));
 }
Beispiel #2
0
        public object Visit(DLAnnotationAxiom a)
        {
            signature.Add(Tuple.Create(EntityKind.Annotation, a.annotName));
            CogniPy.ARS.EntityKind result = CogniPy.CNL.AnnotationManager.ParseSubjectKind(a.subjKind);
            if (result != EntityKind.Statement)
            {
                signature.Add(Tuple.Create(result, a.subject));
            }
            // in case the annotation is a statement, the subject is not added to the signature. We could do this but we would need to parse the statement and it could be time consuming.
            // TODO [Annotations on Statements] is it needed to add to the signature the entities that are inside the statement?

            string val = a.value;

            // if the subject is null we are probably dealing with a non-standard rdf --> return null
            if (System.String.IsNullOrWhiteSpace(a.subject) || System.String.IsNullOrWhiteSpace(a.subjKind))
            {
                return(null);
            }
            string subj = a.subject.Trim();

            if (result == EntityKind.Statement)
            {
                // !! at this point the statement subject is expected NOT inside quotes!! If it is inside quotes, somewhere it was incorrectly constructed.
                subj = "\"" + subj.Replace("\"", "''") + "\"";
            }


            string kind      = a.subjKind.Trim();
            string annotName = a.annotName.Trim();
            string lang      = "";

            if (!System.String.IsNullOrWhiteSpace(a.language))
            {
                lang = a.language.Trim();
            }

            if (!System.String.IsNullOrWhiteSpace(val))
            {
                if (!val.StartsWith("'"))
                {
                    val = "'" + val;
                }
                if (!val.EndsWith("'"))
                {
                    val += "'";
                }
            }
            else
            {
                val += "''";
            }

            var retur = "# " + subj + " " + kind + " " + annotName + " " + lang + " " + val;

            return(retur);
        }
Beispiel #3
0
 public virtual object Visit(DLAnnotationAxiom e)
 {
     return(e);
 }
 public override object Visit(DLAnnotationAxiom e)
 {
     e.annotName = removeDefaultPfx(e.annotName);
     e.subject   = removeDefaultPfx(e.subject);
     return(base.Visit(e));
 }
Beispiel #5
0
 public object Visit(DLAnnotationAxiom a)
 {
     using (this.analizeCase.set(LocalityKind.Bottom))
         using (this.currentKind.set(CNL.DL.Serializer.entName(ParseSubjectKind(a.subjKind))))
             return(ATOM(a.subject));
 }