예제 #1
0
 private FormulaVariable findUniversalVariableForTargetPath(
     VariablePathExpression attributePath, List<FormulaVariable> universalFormulaVariables) {
   for (FormulaVariable formulaVariable : universalFormulaVariables) {
     if (SpicyEngineUtility.containsPathWithSameVariableId(
         formulaVariable.getTargetOccurrencePaths(), attributePath)) {
       return formulaVariable;
     }
   }
   return null;
 }
예제 #2
0
 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));
 }
예제 #3
0
 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);
 }