Exemplo n.º 1
0
        internal EvaluationResult Evaluate(KnowledgeRelation rel)
        {
            var correctRelationNames = (from x in _model.Relations
                                        where x.Value.Target.Equals(rel.Target) &&
                                        x.Value.Relation.Equals(rel.Relation)
                                        select x).ToList();

            if (!correctRelationNames.Any())
            {
                return(EvaluationResult.NotSure);
            }

            return(correctRelationNames.Any(x => x.Value.Subject.Equals(rel.Subject))
                ? EvaluationResult.True
                : EvaluationResult.False);
        }
Exemplo n.º 2
0
 public void AddRelation(KnowledgeRelation relation, HashSet <string> sources)
 {
     if (relation == null)
     {
         return;
     }
     lock (_model.Relations)
     {
         KnowledgeRelation existing;
         _model.Relations.TryGetValue(relation.ToString(), out existing);
         if (existing == null)
         {
             _model.Relations.Add(relation.ToString(), relation);
         }
         else
         {
             existing.AddSources(sources);
         }
     }
 }
Exemplo n.º 3
0
 public void AddRelation(KnowledgeRelation relation, string source)
 {
     AddRelation(relation, new HashSet <string> {
         source
     });
 }
Exemplo n.º 4
0
        private bool ExistsInternal(KnowledgeRelation relation)
        {
            KnowledgeRelation existing;

            return(_model.Relations.TryGetValue(relation.ToString(), out existing));
        }