///////////////////////////////// INTERMEDIATE NODE // ///////////////////////////////////////////////// private ISkolemPart generateSkolemFunctionForIntermediateNode( SkolemFunctionGenerator generator, MappingTask mappingTask) { StringBuilder functionName = new StringBuilder(); functionName.append("SK_"); functionName.append(SpicyEngineUtility.removeRootLabel(generator.getName())); return generateAppendWithFunctionName(functionName.toString(), generator, mappingTask); }
private ISkolemPart generatePartForPaths(List<VariablePathExpression> paths) { ISkolemPart append = new AppendSkolemPart(false, "", "", "-", "-"); List<String> pathStrings = new ArrayList<String>(); for (VariablePathExpression path : paths) { pathStrings.add(SpicyEngineUtility.removeRootLabel(path.getAbsolutePath()).toString()); } Collections.sort(pathStrings); for (String pathString : pathStrings) { append.addChild(new StringSkolemPart(pathString)); } return append; }
private ISkolemPart generateAppendsForSubGenerator( SkolemFunctionGenerator generator, MappingTask mappingTask) { ISkolemPart append = new AppendSkolemPart(mappingTask.getConfig().useSortInSkolems(), "(", ")", ", "); for (GeneratorWithPath subGeneratorWithPath : generator.getSubGenerators()) { VariablePathExpression subGeneratorPath = subGeneratorWithPath.getTargetPath(); IValueGenerator subGenerator = subGeneratorWithPath.getGenerator(); ISkolemPart appendForGenerator = new AppendSkolemPart(false, "", "", ": "); StringSkolemPart stringPart = new StringSkolemPart( SpicyEngineUtility.removeRootLabel(subGeneratorPath.getAbsolutePath())); SubGeneratorSkolemPart generatorPart = new SubGeneratorSkolemPart(subGenerator); appendForGenerator.addChild(stringPart); appendForGenerator.addChild(generatorPart); append.addChild(appendForGenerator); } return append; }
private ISkolemPart generatePartForAlias( SetAlias variable, List<GeneratorWithPath> subGenerators, MappingTask mappingTask) { if (logger.isDebugEnabled()) logger.debug("Generating part for set alias: " + variable + "\nGenerators: " + subGenerators); ISkolemPart generatorsAppend = new AppendSkolemPart(mappingTask.getConfig().useSortInSkolems(), "[", "]", ", "); for (GeneratorWithPath subGeneratorWithPath : subGenerators) { IValueGenerator subGenerator = subGeneratorWithPath.getGenerator(); PathExpression absolutePath = subGeneratorWithPath.getTargetPath().getAbsolutePath(); ISkolemPart appendForSubGenerator = new AppendSkolemPart(false, "", "", ": "); appendForSubGenerator.addChild( new StringSkolemPart(SpicyEngineUtility.removeRootLabel(absolutePath))); appendForSubGenerator.addChild(new SubGeneratorSkolemPart(subGenerator)); generatorsAppend.addChild(appendForSubGenerator); } if (logger.isDebugEnabled()) logger.debug("Final result: " + generatorsAppend); return generatorsAppend; }