Examples of ErrorUpdate


Examples of edu.isi.karma.controller.update.ErrorUpdate

      findNewHNodeIdAndHNodeAsDerived(workspace, selectedPath);
      // create edit multiple cells command
      createAndExecuteMultiCellCmd(workspace, selectedPath, rvco);
    } catch (Exception e) {
      logger.error("Unable to complete processing of cleaning command", e);
      c.add(new ErrorUpdate(
          "Unable to complete processing of cleaning command"));
      // TODO do we need to clean up?
    }

    if (selectedPath != null) {
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

     
      return c;
      //return null;
    } catch (Exception e) {
      e.printStackTrace();
      return new UpdateContainer(new ErrorUpdate("Error in Generating Values!"));
    }
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

   
    List<String> requestURLStrings = new ArrayList<String>();
    List<Row> rows = wk.getDataTable().getRows(0, wk.getDataTable().getNumRows(), selection);
    if (rows == null || rows.size() == 0) {
      logger.error("Data table does not have any row.");
      return new UpdateContainer(new ErrorUpdate("Data table does not have any row."))
    }
   
    List<String> requestIds = new ArrayList<String>();
    for (int i = 0; i < rows.size(); i++) {
      requestIds.add(rows.get(i).getId());
      requestURLStrings.add(rows.get(i).getNode(hNodeId).getValue().asString());
    }

    InvocationManager invocatioManager;
    try {
      invocatioManager = new InvocationManager(getUrlColumnName(wk), requestIds, requestURLStrings, encoding);
      logger.info("Requesting data with includeURL=" + false + ",includeInput=" + true + ",includeOutput=" + true);
     
      // This generate a flat table of the json results
      Table serviceTable = invocatioManager.getServiceData(false, true, true);
      ServiceTableUtil.populateWorksheet(serviceTable, wk, workspace.getFactory(), selection);
     
      // FIXME
//      String json = invocatioManager.getServiceJson(true);
      invocatioManager.getServiceJson(true);
//      new JsonImport(json, wk, ws.getFactory());
//      logger.debug(json);


     
      WebService service = invocatioManager.getInitialServiceModel(null);
      MetadataContainer metaData = wk.getMetadataContainer();
      if (metaData == null) {
        metaData = new MetadataContainer();
        wk.setMetadataContainer(metaData);
      }
      metaData.setService(service);
      logger.info("Service added to the Worksheet.");

    } catch (MalformedURLException e) {
      logger.error("Malformed service request URL.");
      return new UpdateContainer(new ErrorUpdate("Malformed service request URL."));
    } catch (KarmaException e) {
      logger.error(e.getMessage());
      return new UpdateContainer(new ErrorUpdate(e.getMessage()));
    }
   
    // Create new vWorksheet using the new header order
    List<HNodePath> columnPaths = new ArrayList<HNodePath>();
    for (HNode node : wk.getHeaders().getSortedHNodes()) {
      HNodePath path = new HNodePath(node);
      columnPaths.add(path);
    }

   
    alignment = AlignmentManager.Instance().getAlignmentOrCreateIt(workspace.getId(), wk.getId(), ontMgr);
    AlignmentManager.Instance().addAlignmentToMap(alignmentId, alignment);
    UpdateContainer c = new UpdateContainer();
    try {
      // Add the visualization update
      c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(workspace)));
      c.add(new SemanticTypesUpdate(wk, worksheetId, alignment));
      c.add(new AlignmentSVGVisualizationUpdate(worksheetId, alignment));
    } catch (Exception e) {
      logger.error("Error occured while populating the worksheet with service data!", e);
      return new UpdateContainer(new ErrorUpdate(
          "Error occured while populating the worksheet with service data!"));
    }

    return c;
   
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

      c.add(new AlignmentSVGVisualizationUpdate(worksheetId, alignment));
      c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(workspace)));
      c.add(new SemanticTypesUpdate(wk, worksheetId, alignment));
    } catch (Exception e) {
      logger.error("Error occured while populating the worksheet with service data!", e);
      return new UpdateContainer(new ErrorUpdate(
          "Error occured while populating the worksheet with service data!"));
    }
   
//    workspace.getFactory().replaceWorksheet(worksheetId, worksheetBeforeInvocation);
//    c.add(new ReplaceWorksheetUpdate(worksheetId, worksheetBeforeInvocation));
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

      WorksheetCommandHistoryExecutor histExecutor = new WorksheetCommandHistoryExecutor(worksheetId, workspace);
      histExecutor.executeAllCommands(historyJSON);
    } catch (Exception e) {
      String msg = "Error occured while applying history!";
      logger.error(msg, e);
      return new UpdateContainer(new ErrorUpdate(msg));
    }
   
    // Add worksheet updates that could have resulted out of the transformation commands
    UpdateContainer c = WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, SuperSelectionManager.DEFAULT_SELECTION);
    c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

    UpdateContainer c = new UpdateContainer();
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    OntologyManager ontologyManager = workspace.getOntologyManager();
    if(ontologyManager.isEmpty())
      return new UpdateContainer(new ErrorUpdate("No ontology loaded."));
   
    worksheetName = worksheet.getTitle();
   
    String alignmentId = AlignmentManager.Instance().constructAlignmentId(workspace.getId(), worksheetId);
    Alignment alignment = AlignmentManager.Instance().getAlignmentOrCreateIt(workspace.getId(), worksheetId, ontologyManager);
    if (alignment == null) {
      logger.info("Alignment is NULL for " + worksheetId);
      return new UpdateContainer(new ErrorUpdate(
          "Alignment is NULL for " + worksheetId));
    }

    if (initialAlignment == null)
    {
      initialAlignment = alignment.getAlignmentClone();

      initialGraph = (DirectedWeightedMultigraph<Node, DefaultLink>)alignment.getGraph().clone();
     
      List<HNode> orderedNodeIds = new ArrayList<HNode>();
      worksheet.getHeaders().getSortedLeafHNodes(orderedNodeIds);
      if (orderedNodeIds != null) {
        for (int i = 0; i < orderedNodeIds.size(); i++)
        {
          String hNodeId = orderedNodeIds.get(i).getId();
          ColumnNode cn = alignment.getColumnNodeByHNodeId(hNodeId);
         
          if (!cn.hasUserType())
          {
            worksheet.getSemanticTypes().unassignColumnSemanticType(hNodeId);
            List<SemanticType> suggestedSemanticTypes =
                new SemanticTypeUtil().getColumnSemanticSuggestions(workspace, worksheet, cn, 4, selection);
            cn.setSuggestedSemanticTypes(suggestedSemanticTypes);
          }
        }
      }
    } else {
    // Replace the current alignment with the old alignment
      alignment = initialAlignment;
      alignment.setGraph(initialGraph);
      if(!this.isExecutedInBatch())
        alignment.align();
      AlignmentManager.Instance().addAlignmentToMap(alignmentId, alignment);
    }

    steinerNodes = alignment.computeSteinerNodes();
    ModelLearner modelLearner = null;
    if (ModelingConfiguration.isLearnAlignmentEnabled())
      modelLearner = new ModelLearner(alignment.getGraphBuilder(), steinerNodes);
    else
      modelLearner = new ModelLearner(ontologyManager, alignment.getLinksByStatus(LinkStatus.ForcedByUser), steinerNodes);

//    logger.info(GraphUtil.defaultGraphToString(ModelLearningGraph.getInstance(ontologyManager, ModelLearningGraphType.Compact).getGraphBuilder().getGraph()));

    SemanticModel model = modelLearner.getModel();
    if (model == null) {
      logger.error("could not learn any model for this source!");
      return new UpdateContainer(new ErrorUpdate(
          "Error occured while generating a semantic model for the source."));
    }
   
//    logger.info(GraphUtil.labeledGraphToString(model.getGraph()));
   
    List<SemanticType> semanticTypes = new LinkedList<SemanticType>();
    alignment.updateAlignment(model, semanticTypes);
//    Set<ColumnNode> alignmentColumnNodes = alignment.getSourceColumnNodes();
//    if (alignmentColumnNodes != null) {
//      for (ColumnNode cn : alignmentColumnNodes) {
//        worksheet.getSemanticTypes().unassignColumnSemanticType(cn.getHNodeId());
//      }
//    }
//    if (semanticTypes != null) {
//      for (SemanticType st : semanticTypes)
//        worksheet.getSemanticTypes().addType(st);
//    }
   
    try {
      // Save the semantic types in the input parameter JSON
      saveSemanticTypesInformation(worksheet, workspace, worksheet.getSemanticTypes().getListOfTypes());
     
      // Add the visualization update
      c.add(new SemanticTypesUpdate(worksheet, worksheetId, alignment));
      c.add(new AlignmentSVGVisualizationUpdate(
          worksheetId, alignment));

    } catch (Exception e) {
      logger.error("Error occured while generating the model Reason:.", e);
      return new UpdateContainer(new ErrorUpdate(
          "Error occured while generating the model for the source."));
    }
    c.add(new TagsUpdate());
   
    return c;
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

   
    UpdateContainer c = new UpdateContainer();
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    OntologyManager ontologyManager = workspace.getOntologyManager();
    if(ontologyManager.isEmpty())
      return new UpdateContainer(new ErrorUpdate("No ontology loaded."));
   
    String alignmentId = AlignmentManager.Instance().constructAlignmentId(workspace.getId(), worksheetId);
    Alignment alignment = AlignmentManager.Instance().getAlignment(alignmentId);
    if (alignment == null) {
      logger.info("Alignment is NULL for " + worksheetId);
      return new UpdateContainer(new ErrorUpdate(
          "Please align the worksheet before generating R2RML Model!"));
    }

//    Set<ColumnNode> alignmentColumnNodes = alignment.getSourceColumnNodes();
//    if (alignmentColumnNodes != null) {
//      for (ColumnNode cn : alignmentColumnNodes) {
//        if (!cn.hasUserType())
//          worksheet.getSemanticTypes().unassignColumnSemanticType(cn.getHNodeId());
//      }
//    }

    alignment = initialAlignment;
    alignment.setGraph(initialGraph);
    if(!this.isExecutedInBatch())
      alignment.align();
    AlignmentManager.Instance().addAlignmentToMap(alignmentId, alignment);
   

    try {
      // Save the semantic types in the input parameter JSON
      saveSemanticTypesInformation(worksheet, workspace, worksheet.getSemanticTypes().getListOfTypes());
     
      // Add the visualization update
      c.add(new SemanticTypesUpdate(worksheet, worksheetId, alignment));
      c.add(new AlignmentSVGVisualizationUpdate(
          worksheetId, alignment));
    } catch (Exception e) {
      logger.error("Error occured while generating the model Reason:.", e);
      return new UpdateContainer(new ErrorUpdate(
          "Error occured while generating the model for the source."));
    }
    c.add(new TagsUpdate());
   
    return c;
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

            c.add(new WorksheetListUpdate());
            c.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION));
            return c;
        } catch (Exception e) {
            logger.error("Error occured while creating worksheet from web-service: " + serviceUrl);
            return new UpdateContainer(new ErrorUpdate("Error creating worksheet from web-service"));
        }
    }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

          pw.print(array.toString());
        }
      });
    } catch (Exception e) {
      logger.error("Error occurred while fetching graphs!", e);
      return new UpdateContainer(new ErrorUpdate("Error occurred while fetching graphs!"));
    }
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

      return c;
    } catch (Exception e) {
      WorksheetUpdateFactory.detectSelectionStatusChange(worksheetId, workspace, this);
      logger.error("Error in UnfoldCommand" + e.toString());
      Util.logException(logger, e);
      return new UpdateContainer(new ErrorUpdate(e.getMessage()));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.