Package edu.isi.karma.controller.update

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


          pw.println("}");
        }
      });
    } catch (Exception e) {
      UpdateContainer uc = new UpdateContainer();
      uc.add(new TrivialErrorUpdate("Error importing Ontology "
          + getFile().getName()));
      return uc;
    }
  }
View Full Code Here


    if(!modelFile.exists())
    {
      try {
        modelFile.createNewFile();
      } catch (IOException e) {
        uc.add(new TrivialErrorUpdate("Unable to create CRF Model file at " + modelFile.getAbsolutePath()));
        return;
      }
    }
    boolean result = workspace.getSemanticTypeModelHandler().readModelFromFile(modelFile.getAbsolutePath());
    if (!result)
View Full Code Here

          try {
            String encoding = EncodingDetector.detect(ontology);
            ontologyManager.doImport(ontology, encoding);
          } catch (Exception t) {
            logger.error ("Error loading ontology: " + ontology.getAbsolutePath(), t);
            uc.add(new TrivialErrorUpdate("Error loading ontology: " + ontology.getAbsolutePath()));
          }
        } else {
          logger.error ("the file: " + ontology.getAbsolutePath() + " does not have proper format: xml/rdf/n3/ttl/owl");
          uc.add(new TrivialErrorUpdate("Error loading ontology: " + ontology.getAbsolutePath() + ". The file does not have proper format: xml/rdf/n3/ttl/owl"));
        }
      }
      // update the cache at the end when all files are added to the model
      ontologyManager.updateCache();
    } else {
View Full Code Here

              comm.setExecutedInBatch(false);
            } catch(Exception e) {
              logger.error("Error executing command: "+ commandName + ". Please notify this error");
              Util.logException(logger, e);
              //make these InfoUpdates so that the UI can still process the rest of the model
              return new UpdateContainer(new TrivialErrorUpdate("Error executing command " + commandName + " from history"));
            }
          }
          else {
            logger.error("Error occured while creating command (Could not create Command object): "
                + commObject.get(HistoryArguments.commandName.name()));
            return new UpdateContainer(new TrivialErrorUpdate("Error executing command " + commandName + " from history"));
          }
        } catch (UnsupportedOperationException ignored) {

        }
      }

      return uc;
    } catch(Exception e) {
      logger.error("Error executing command: "+ commandName + ".", e);
      //make these InfoUpdates so that the UI can still process the rest of the model
      return new UpdateContainer(new TrivialErrorUpdate("Error executing command " + commandName + " from history"));
    }
   
   
  }
View Full Code Here

      if(HistoryJsonUtil.getParameterType(inpP) == ParameterType.hNodeId) {
        JSONArray hNodeJSONRep = new JSONArray(inpP.get(ClientJsonKeys.value.name()).toString());
        for (int j=0; j<hNodeJSONRep.length(); j++) {
          JSONObject cNameObj = (JSONObject) hNodeJSONRep.get(j);
          if(hTable == null) {
            AbstractUpdate update = new TrivialErrorUpdate("null HTable while normalizing JSON input for the command " + commandName);
            if (uc == null)
              uc = new UpdateContainer(update);
            else
              uc.add(update);
            continue;
          }
          String nameObjColumnName = cNameObj.getString("columnName");
          logger.debug("Column being normalized: "+ nameObjColumnName);
          HNode node = hTable.getHNodeFromColumnName(nameObjColumnName);
          if(node == null) { //Because add column can happen even if the column after which it is to be added is not present
            AbstractUpdate update = new TrivialErrorUpdate(nameObjColumnName + " does not exist, using empty values");
            if (uc == null)
              uc = new UpdateContainer(update);
            else
              uc.add(update);
            if (addIfNonExist) {
              node = hTable.addHNode(nameObjColumnName, HNodeType.Regular, workspace.getWorksheet(worksheetId), workspace.getFactory());   
            }
            else {
              continue;
            }
          }

          if (j == hNodeJSONRep.length()-1) {    // Found!
            if(node != null)
              inpP.put(ClientJsonKeys.value.name(), node.getId());
            else {
              //Get the id of the last node in the table
              ArrayList<String> allNodeIds = hTable.getOrderedNodeIds();
              //TODO check for allNodeIds.size == 0
              String lastNodeId = allNodeIds.get(allNodeIds.size()-1);
              inpP.put(ClientJsonKeys.value.name(), lastNodeId);
            }
            hTable = workspace.
                getWorksheet(worksheetId).getHeaders();
          } else if(node != null) {
            hTable = node.getNestedTable();
            if (hTable == null && addIfNonExist) {
              hTable = node.addNestedTable("NestedTable", workspace.getWorksheet(worksheetId), workspace.getFactory());
            }
          }
        }
      } else if(HistoryJsonUtil.getParameterType(inpP) == ParameterType.worksheetId) {
        inpP.put(ClientJsonKeys.value.name(), worksheetId);
      } else if (HistoryJsonUtil.getParameterType(inpP) == ParameterType.hNodeIdList) {
        JSONArray hNodes = new JSONArray(inpP.get(ClientJsonKeys.value.name()).toString());
        for (int k = 0; k < hNodes.length(); k++) {
          JSONObject hnodeJSON = hNodes.getJSONObject(k);
          JSONArray hNodeJSONRep = new JSONArray(hnodeJSON.get(ClientJsonKeys.value.name()).toString());
          for (int j=0; j<hNodeJSONRep.length(); j++) {
            JSONObject cNameObj = (JSONObject) hNodeJSONRep.get(j);
            if(hTable == null) {
              AbstractUpdate update = new TrivialErrorUpdate("null HTable while normalizing JSON input for the command " + commandName);
              if (uc == null)
                uc = new UpdateContainer(update);
              else
                uc.add(update);
              continue;
            }
            String nameObjColumnName = cNameObj.getString("columnName");
            logger.debug("Column being normalized: "+ nameObjColumnName);
            HNode node = hTable.getHNodeFromColumnName(nameObjColumnName);
            if(node == null) { //Because add column can happen even if the column after which it is to be added is not present
              AbstractUpdate update = new TrivialErrorUpdate(nameObjColumnName + " does not exist, using empty values");
              if (uc == null)
                uc = new UpdateContainer(update);
              else
                uc.add(update);
              if (addIfNonExist) {
View Full Code Here

TOP

Related Classes of edu.isi.karma.controller.update.TrivialErrorUpdate

Copyright © 2018 www.massapicom. 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.