use of eu.esdihumboldt.hale.io.xslt.transformations.base.AbstractTransformationTraverser in project hale by halestudio.
the class XslRetype method createPropertiesFragment.
/**
* Create a XSL fragment for populating the properties of a target instance.
*
* @param typeCell the associated type cell
* @return the XSL fragment
* @throws TransformationException if creating the fragment failed
*/
protected String createPropertiesFragment(final Cell typeCell) throws TransformationException {
final TransformationTree tree = new TransformationTreeImpl(context().getAlignment(), typeCell);
FunctionService functionService = new AlignmentFunctionService(context().getAlignment());
/*
* Create the transformation graph derived from the transformation tree
* and perform context matching.
*/
/*
* XXX proxying multi-result nodes omitted for now, see
* proxyMultiResultNodes imlementation
*/
// final TGraph graph = new TGraphImpl(tree).proxyMultiResultNodes().performContextMatching();
final TGraph graph = new TGraphImpl(tree, functionService).performContextMatching();
// TODO tree as GraphML as informative annotation into XSLT?
try {
StringWriter propsOut = new StringWriter();
try {
AbstractTransformationTraverser trav = new RetypeTraverser(context(), propsOut, typeCell);
trav.traverse(graph);
} finally {
propsOut.close();
}
return propsOut.toString();
} catch (Exception e) {
throw new TransformationException("Failed to create property transformations", e);
}
}
Aggregations