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

org.molgenis.data.mapper.service.AlgorithmService Maven / Gradle / Ivy

The newest version!
package org.molgenis.data.mapper.service;

import org.molgenis.data.Entity;
import org.molgenis.data.mapper.mapping.model.AttributeMapping;
import org.molgenis.data.mapper.mapping.model.EntityMapping;
import org.molgenis.data.mapper.service.impl.AlgorithmEvaluation;
import org.molgenis.data.meta.model.Attribute;
import org.molgenis.data.meta.model.EntityType;

import java.util.Collection;
import java.util.List;

public interface AlgorithmService
{
	/**
	 * Applies an algorithm to the given attribute of given source entities.
	 *
	 * @param targetAttribute
	 * @param algorithm
	 * @param sourceEntities
	 * @return algorithm evaluation for each source entity
	 */
	Iterable applyAlgorithm(Attribute targetAttribute, String algorithm,
			Iterable sourceEntities);

	/**
	 * Applies an {@link AttributeMapping} to a source {@link Entity}
	 *
	 * @param attributeMapping {@link AttributeMapping} to apply
	 * @param sourceEntity     {@link Entity} to apply the mapping to
	 * @return Object containing the mapped value
	 */
	Object apply(AttributeMapping attributeMapping, Entity sourceEntity, EntityType sourceEntityType);

	/**
	 * Retrieves the names of the source attributes in an algorithm
	 *
	 * @param algorithmScript String with the algorithm script
	 * @return Collection of source attribute name Strings
	 */
	Collection getSourceAttributeNames(String algorithmScript);

	/**
	 * Creates an attribute mapping after the semantic search service finds one
	 *
	 * @param sourceEntityType
	 * @param targetEntityType
	 * @param mapping
	 * @param targetAttribute
	 */
	void autoGenerateAlgorithm(EntityType sourceEntityType, EntityType targetEntityType, EntityMapping mapping,
			Attribute targetAttribute);

	/**
	 * Generates the algorithm based on the given targetAttribute and sourceAttribute
	 *
	 * @param targetAttribute
	 * @param targetEntityType
	 * @param sourceAttributes
	 * @param sourceEntityType
	 * @return the generate algorithm
	 */
	String generateAlgorithm(Attribute targetAttribute, EntityType targetEntityType, List sourceAttributes,
			EntityType sourceEntityType);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy