Search in sources :

Example 6 with DefaultTransformationReporter

use of eu.esdihumboldt.hale.common.align.transformation.report.impl.DefaultTransformationReporter in project hale by halestudio.

the class TransformationTreeContentProvider method createInstanceTree.

/**
 * Create a transformation tree based on a source instance.
 *
 * @param instance the source instance
 * @param typeCell the type cell
 * @param alignment the alignment
 * @return the transformation tree or <code>null</code>
 */
private TransformationTree createInstanceTree(Instance instance, Cell typeCell, Alignment alignment) {
    TransformationTree tree = new TransformationTreeImpl(alignment, typeCell);
    ReportLog<TransformationMessage> reporter = new DefaultTransformationReporter("Transformation tree", true);
    TransformationLog log = new CellLog(reporter, typeCell);
    // context matching
    // XXX instead through service/extension point?
    ContextMatcher matcher = new AsDeepAsPossible(null);
    matcher.findMatches(tree);
    // process and annotate the tree
    InstanceVisitor visitor = new InstanceVisitor(new FamilyInstanceImpl(instance), tree, log);
    tree.accept(visitor);
    // duplicate subtree as necessary
    DuplicationVisitor duplicationVisitor = new DuplicationVisitor(tree, log);
    tree.accept(duplicationVisitor);
    duplicationVisitor.doAugmentationTrackback();
    return tree;
}
Also used : TransformationTreeImpl(eu.esdihumboldt.hale.common.align.model.transformation.tree.impl.TransformationTreeImpl) TransformationMessage(eu.esdihumboldt.hale.common.align.transformation.report.TransformationMessage) FamilyInstanceImpl(eu.esdihumboldt.hale.common.align.transformation.function.impl.FamilyInstanceImpl) AsDeepAsPossible(eu.esdihumboldt.hale.common.align.model.transformation.tree.context.impl.matcher.AsDeepAsPossible) DefaultTransformationReporter(eu.esdihumboldt.hale.common.align.transformation.report.impl.DefaultTransformationReporter) TransformationTree(eu.esdihumboldt.hale.common.align.model.transformation.tree.TransformationTree) TransformationLog(eu.esdihumboldt.hale.common.align.transformation.report.TransformationLog) CellLog(eu.esdihumboldt.hale.common.align.transformation.report.impl.CellLog) ContextMatcher(eu.esdihumboldt.hale.common.align.model.transformation.tree.context.ContextMatcher) InstanceVisitor(eu.esdihumboldt.hale.common.align.model.transformation.tree.visitor.InstanceVisitor) DuplicationVisitor(eu.esdihumboldt.hale.common.align.model.transformation.tree.visitor.DuplicationVisitor)

Aggregations

DefaultTransformationReporter (eu.esdihumboldt.hale.common.align.transformation.report.impl.DefaultTransformationReporter)6 Cell (eu.esdihumboldt.hale.common.align.model.Cell)5 CellLog (eu.esdihumboldt.hale.common.align.transformation.report.impl.CellLog)5 ExecutionContext (eu.esdihumboldt.hale.common.align.transformation.function.ExecutionContext)4 InstanceBuilder (eu.esdihumboldt.hale.common.instance.groovy.InstanceBuilder)4 GroovyService (eu.esdihumboldt.util.groovy.sandbox.GroovyService)4 Script (groovy.lang.Script)4 Type (eu.esdihumboldt.hale.common.align.model.Type)3 FamilyInstanceImpl (eu.esdihumboldt.hale.common.align.transformation.function.impl.FamilyInstanceImpl)3 Binding (groovy.lang.Binding)3 FamilyInstance (eu.esdihumboldt.hale.common.instance.model.FamilyInstance)2 Instance (eu.esdihumboldt.hale.common.instance.model.Instance)2 DefaultInstance (eu.esdihumboldt.hale.common.instance.model.impl.DefaultInstance)2 EngineManager (eu.esdihumboldt.cst.internal.EngineManager)1 TransformationContext (eu.esdihumboldt.cst.internal.TransformationContext)1 TreePropertyTransformer (eu.esdihumboldt.cst.internal.TreePropertyTransformer)1 CountingInstanceSink (eu.esdihumboldt.cst.internal.util.CountingInstanceSink)1 TypeTransformationFactory (eu.esdihumboldt.hale.common.align.extension.transformation.TypeTransformationFactory)1 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)1 ParameterValue (eu.esdihumboldt.hale.common.align.model.ParameterValue)1