Exemple #1
0
    public HSPPredicate GroundToConstant(Dictionary <string, string> subst)
    {
        List <HSPTerm> args = new List <HSPTerm>();

        foreach (HSPTerm arg in _args)
        {
            if (subst.ContainsKey(arg.GetValue()))
            {
                string value = subst[arg.GetValue()];

                if (arg.IsTyped())
                {
                    string  type   = subst[arg.GetTermType()];
                    HSPTerm _const = arg.constant(type, value);
                    args.Add(_const);
                }
                else
                {
                    HSPTerm _const = arg.constant(null, value);
                    args.Add(_const);
                }
            }
        }
        return(new HSPPredicate(_name, args));
    }
Exemple #2
0
    private List <HSPTerm> ParseParameters(JsonNode node)
    {
        List <HSPTerm> items = new List <HSPTerm>();

        foreach (var obj in node.Members)
        {
            foreach (var param in obj.Value.Members)
            {
                HSPTerm item = new HSPTerm(obj.Key, param.Key, null);
                items.Add(item);
            }
        }

        return(items);
    }
Exemple #3
0
    public List <HSPTerm> DeriveArgs(IDictionary <string, JsonNode> nodes)
    {
        List <HSPTerm> args = new List <HSPTerm>();

        foreach (var item in nodes)
        {
            if (item.Value.Members.Count > 0)
            {
                foreach (var member in item.Value.Members)
                {
                    HSPTerm newarg = new HSPTerm(null, member.Key, item.Key);
                    args.Add(newarg);
                }
            }
            else
            {
                HSPTerm newarg = new HSPTerm(null, null, item.Key);
                args.Add(newarg);
            }
        }
        return(args);
    }
Exemple #4
0
    public List <HSPTerm> DeriveArgs(IDictionary <string, JsonNode> nodes)
    {
        List <HSPTerm> args = new List <HSPTerm>();

        foreach (var item in nodes)
        {
            /*if (item.Value.Members.Count > 0) {
             *  foreach (var member in item.Value.Members) {
             *      HSPTerm newarg = new HSPTerm(item.Key, member.Key, null);
             *      args.Add(newarg);
             *  }
             * }
             * else {
             *  HSPTerm newarg = new HSPTerm(item.Key, null, null);
             *  args.Add(newarg);
             * }*/

            HSPTerm newarg = new HSPTerm(item.Key, null, null);
            args.Add(newarg);
        }
        return(args);
    }
Exemple #5
0
 public bool isEqualTo(HSPTerm other)
 {
     return(true);
 }