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); }
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); } } }
public void AddRelation(KnowledgeRelation relation, string source) { AddRelation(relation, new HashSet <string> { source }); }
private bool ExistsInternal(KnowledgeRelation relation) { KnowledgeRelation existing; return(_model.Relations.TryGetValue(relation.ToString(), out existing)); }