All Downloads are FREE. Search and download functionalities are using the official Maven repository.

astra.reasoner.unifier.PredicateUnifier Maven / Gradle / Ivy

There is a newer version: 1.4.2
Show newest version
package astra.reasoner.unifier;

import java.util.Map;

import astra.core.Agent;
import astra.formula.Formula;
import astra.formula.Predicate;
import astra.reasoner.FormulaUnifier;
import astra.reasoner.Unifier;
import astra.term.Term;

public class PredicateUnifier implements FormulaUnifier  {

	@Override
	public boolean isApplicable(Formula source, Formula target) {
		return (source instanceof Predicate) && (target instanceof Predicate);
	}

	@Override
	public Map unify(Formula source, Formula target, Map bindings, Agent agent) {
		Predicate s = (Predicate) source;
		Predicate t = (Predicate) target;

		if (s.id() == t.id() && s.size() == t.size()) {
			return Unifier.unify(s.terms(), t.terms(), bindings, agent);
		}
		return null;
	}
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy