コード例 #1
0
ファイル: GenerateSQL.java プロジェクト: alexmemory/spicy
 private String generateFinalInsert(MappingTask mappingTask) {
   StringBuilder result = new StringBuilder();
   for (SetAlias targetVariable : mappingTask.getTargetProxy().getMappingData().getVariables()) {
     List<FORule> relevantTgds =
         findRelevantTGDs(targetVariable, mappingTask.getMappingData().getSTTgds());
     if (!relevantTgds.isEmpty()) {
       result.append(generateInsertForRelationAfterExchange(targetVariable, mappingTask));
     }
   }
   return result.toString();
 }
コード例 #2
0
ファイル: RewriteTgds.java プロジェクト: alexmemory/spicy
 private void addNegationsForCoverages(FORule tgd, FORule rule, MappingTask mappingTask) {
   CoverageMap coverageMap = mappingTask.getMappingData().getSTCoverageMap();
   List<Coverage> coverages = coverageMap.getCoverage(tgd);
   if ((coverages.isEmpty() || !mappingTask.getConfig().rewriteCoverages())) {
     return;
   }
   for (Coverage coverage : coverages) {
     NegatedComplexQuery negatedQuery = generateNegatedQueryForCoverage(coverage);
     negatedQuery.setProvenance(SpicyEngineConstants.COVERAGE + " of " + tgd.getId());
     rule.getComplexSourceQuery().addNegatedComplexQuery(negatedQuery);
   }
 }
コード例 #3
0
ファイル: RewriteTgds.java プロジェクト: alexmemory/spicy
 public List<FORule> rewriteTgds(List<FORule> originalTgds, MappingTask mappingTask) {
   if (mappingTask.isLoadedFromParser() && mappingTask.getConfig().noRewriting()) {
     return cleanLoadedTgds(originalTgds);
   }
   List<FORule> rewrittenRules = null;
   if (mappingTask.getMappingData().hasSelfJoinsInTgdConclusions()) {
     RewriteTgdsWithSelfJoins selfJoinRewriter = new RewriteTgdsWithSelfJoins();
     rewrittenRules = selfJoinRewriter.rewriteTgdsWithSelfJoins(originalTgds, mappingTask);
   } else {
     rewrittenRules = rewriteTgdsWithoutSelfJoins(originalTgds, mappingTask);
   }
   //        RenameVariables renamer = new RenameVariables();
   //        List<FORule> result = renamer.renameAliasesInRules(rewrittenRules);
   //        return result;
   return rewrittenRules;
 }
コード例 #4
0
ファイル: RewriteTgds.java プロジェクト: alexmemory/spicy
 private void addNegationsForSubsumptions(FORule tgd, FORule rule, MappingTask mappingTask) {
   if (logger.isDebugEnabled()) logger.debug("********* Adding negations for tgd: \n" + tgd);
   SubsumptionMap tgdDag = mappingTask.getMappingData().getSTSubsumptionMap();
   if (logger.isDebugEnabled()) logger.debug("********* Subsumption Map: \n" + tgdDag);
   List<Subsumption> subsumptions = tgdDag.getFathers(tgd);
   if (logger.isDebugEnabled()) logger.debug("Subsumptions: " + subsumptions);
   if (logger.isDebugEnabled()) logger.debug("Config : " + mappingTask.getConfig());
   if ((subsumptions.isEmpty() || !mappingTask.getConfig().rewriteSubsumptions())) {
     return;
   }
   for (Subsumption subsumption : subsumptions) {
     List<VariableCorrespondence> leftCorrespondences = subsumption.getLeftCorrespondences();
     List<VariableCorrespondence> rightCorrespondences = subsumption.getRightCorrespondences();
     TargetEqualities equalities = new TargetEqualities(leftCorrespondences, rightCorrespondences);
     NegatedComplexQuery negatedQuery =
         new NegatedComplexQuery(
             subsumption.getRightTgd().getComplexSourceQuery().clone(), equalities);
     negatedQuery.setProvenance(subsumption.getId());
     rule.getComplexSourceQuery().addNegatedComplexQuery(negatedQuery);
   }
 }
コード例 #5
0
 @Override
 public void performAction() {
   Scenario scenario = (Scenario) modello.getBean(Costanti.CURRENT_SCENARIO);
   MappingTask mappingTask = scenario.getMappingTask();
   if (mappingTask.getValueCorrespondences().size() == 0
       && mappingTask.getMappingData().getSTTgds().isEmpty()) {
     NotifyDescriptor nd =
         new NotifyDescriptor.Message(
             NbBundle.getMessage(Costanti.class, Costanti.EMPTY_CORRESPONDENCES),
             DialogDescriptor.WARNING_MESSAGE);
     DialogDisplayer.getDefault().notify(nd);
     return;
   }
   try {
     openTransformationWindows();
     openInstanceWindows();
     enableActions();
   } catch (Exception ex) {
     DialogDisplayer.getDefault()
         .notify(new NotifyDescriptor.Message(ex.getMessage(), DialogDescriptor.ERROR_MESSAGE));
   }
 }