public List <Literal> Add(string src) { var sexps = Sexp.FromSrc("(" + src + ")").Children; // wrapped var observations = new List <Literal>(); foreach (Sexp s in sexps) { if (this.IsDefiniteClause(s)) { this.Axioms.Add(new DefiniteClause(s)); } else if (this.IsConjunction(s)) { for (int i = 1; i < s.Children.Count; i++) { observations.Add(new Literal(s.Children[i])); } } else if (this.IsLiteral(s)) { observations.Add(new Literal(s)); } else { throw new Exception($"Unrecognizable logic expression: {s.Repr()}"); } } this.ComputeIndexByConsequent(); return(observations); }
public Term(String src) { var temp = new Term(Sexp.FromSrc(src)); this.Type = temp.Type; this.Text = temp.Text; }
public Literal(string src) { var temp = new Literal(Sexp.FromSrc(src)); this.Predicate = temp.Predicate; this.Terms = temp.Terms; this.IsEtceteraLiteral = temp.IsEtceteraLiteral; this.LnProbability = temp.LnProbability; }