private FormulaVariable findUniversalVariableForTargetPath( VariablePathExpression attributePath, List<FormulaVariable> universalFormulaVariables) { for (FormulaVariable formulaVariable : universalFormulaVariables) { if (SpicyEngineUtility.containsPathWithSameVariableId( formulaVariable.getTargetOccurrencePaths(), attributePath)) { return formulaVariable; } } return null; }
private FormulaVariable findExistentialVariable( VariablePathExpression attributePath, List<FormulaVariable> existentialFormulaVariables) { for (FormulaVariable formulaVariable : existentialFormulaVariables) { if (SpicyEngineUtility.containsPathWithSameVariableId( formulaVariable.getTargetOccurrencePaths(), attributePath)) { return formulaVariable; } } throw new IllegalArgumentException( "Unable to find variable for path " + attributePath + " in " + SpicyEngineUtility.printVariableList(existentialFormulaVariables)); }
private String findGeneratorForVariable( FormulaVariable variable, FORule rule, MappingTask mappingTask) { List<FormulaVariable> universalVariables = rule.getUniversalFormulaVariablesInTarget(mappingTask); TGDGeneratorsMap generatorsMap = rule.getGenerators(mappingTask); for (VariablePathExpression targetPath : variable.getTargetOccurrencePaths()) { IValueGenerator generator = generatorsMap.getGeneratorForLeaf( targetPath, mappingTask.getTargetProxy().getIntermediateSchema()); if (generator != null && generator instanceof SkolemFunctionGenerator) { SkolemFunctionGenerator skolemGenerator = (SkolemFunctionGenerator) generator; return skolemGenerator.toStringWithVariableArguments(universalVariables); } } return NullValueGenerator.getInstance().toString(); // throw new IllegalArgumentException("Unable to find generator for variable: " + // variable.toLongString() + "\nin rule: " + rule + "\n" + // SpicyEngineUtility.printVariableList(rule.getExistentialFormulaVariables(mappingTask)) + // "\nGenerators: " + generatorsMap); }