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

org.molgenis.semanticmapper.service.AlgorithmService Maven / Gradle / Ivy

package org.molgenis.semanticmapper.service;

import java.util.Collection;
import java.util.List;
import org.molgenis.data.Entity;
import org.molgenis.data.meta.model.Attribute;
import org.molgenis.data.meta.model.EntityType;
import org.molgenis.semanticmapper.mapping.model.AttributeMapping;
import org.molgenis.semanticmapper.mapping.model.EntityMapping;
import org.molgenis.semanticmapper.service.impl.AlgorithmEvaluation;

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

  /**
   * 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,
      int depth);

  /**
   * 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 */
  void autoGenerateAlgorithm(
      EntityType sourceEntityType, EntityType targetEntityType, EntityMapping mapping);

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

  /**
   * Copies all algorithms from a source entity type to a target entity type. Sets the algorithm
   * state of each attribute mapping copy to 'discuss'.
   */
  void copyAlgorithms(EntityMapping sourceEntityMapping, EntityMapping targetEntityMapping);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy