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

fr.lirmm.boreal.util.converter.PredicateConverter Maven / Gradle / Ivy

There is a newer version: 1.6.3
Show newest version
package fr.lirmm.boreal.util.converter;

import fr.boreal.model.logicalElements.api.Predicate;
import fr.boreal.model.logicalElements.factory.impl.SameObjectPredicateFactory;
import fr.lirmm.graphik.integraal.core.factory.DefaultPredicateFactory;

/**
 * Converts Predicate to and from Graal's Predicate
 * 
 * This is used for compatibility with Graal 1.3 version.
 * 
 * @author Florent Tornil
 *
 */
public class PredicateConverter {
	
	/**
	 * Converts the given Predicate into a Graal Predicate
	 * @param p the predicate to convert
	 * @return the converted predicate
	 */
	public static fr.lirmm.graphik.integraal.api.core.Predicate convert(Predicate p) {
		return DefaultPredicateFactory.instance().create(p.getLabel(), p.getArity());
	}
	
	/**
	 * Converts the given Predicate into a Graal Predicate
	 * @param p the predicate to convert
	 * @return the converted predicate
	 */
	public static fr.lirmm.graphik.graal.api.core.Predicate convert2(Predicate p) {
		
		return fr.lirmm.graphik.integraal.core.factory.DefaultPredicateFactory.instance().create2(p.getLabel(), p.getArity());
	}
	
	/**
	 * Converts the given Graal Predicate into a Predicate
	 * @param p the predicate to convert
	 * @return the converted predicate
	 */
	public static Predicate reverse(fr.lirmm.graphik.integraal.api.core.Predicate p) {
		return SameObjectPredicateFactory.instance().createOrGetPredicate(p.getIdentifier().toString(), p.getArity());
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy