Esempio n. 1
0
 private String findGeneratorForPath(
     VariablePathExpression setPath, FORule rule, MappingTask mappingTask) {
   List<FormulaVariable> universalVariables = rule.getUniversalFormulaVariables(mappingTask);
   TGDGeneratorsMap generatorsMap = rule.getGenerators(mappingTask);
   IValueGenerator generator = generatorsMap.getGeneratorForSetPath(setPath);
   if (generator == null) {
     return "SK_" + setPath.toString() + "()";
   }
   if (generator instanceof NullValueGenerator) {
     return NullValueGenerator.getInstance().toString();
   }
   SkolemFunctionGenerator skolemGenerator = (SkolemFunctionGenerator) generator;
   return skolemGenerator.toStringWithVariableArguments(universalVariables);
 }
Esempio n. 2
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);
 }