edu.isi.karma.rep.Worksheet.getId()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中edu.isi.karma.rep.Worksheet.getId()方法的一些代码示例,展示了Worksheet.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Worksheet.getId()方法的具体详情如下:
包路径:edu.isi.karma.rep.Worksheet
类名称:Worksheet
方法名:getId

Worksheet.getId介绍

暂无

代码示例

代码示例来源:origin: usc-isi-i2/Web-Karma

public String getWorksheetId() {
  return worksheet.getId();
}

代码示例来源:origin: usc-isi-i2/Web-Karma

public boolean equals(Object o) {
  if (o instanceof ReplaceWorksheetUpdate) {
    ReplaceWorksheetUpdate t = (ReplaceWorksheetUpdate)o;
    return t.worksheetBeforeInvocation.getId().equals(worksheetBeforeInvocation.getId()) && t.worksheetId.equals(worksheetId);
  }
  return false;
}

代码示例来源:origin: usc-isi-i2/Web-Karma

void addWorksheet(Worksheet worksheet) {
  worksheets.put(worksheet.getId(), worksheet);
}

代码示例来源:origin: usc-isi-i2/Web-Karma

public void addWorksheets(Collection<Worksheet> worksheets, VWorkspace vWorkspace) {
  List<VWorksheet> newWorksheets = new LinkedList<>();
  for (Worksheet w : worksheets) {
    if (null == getVWorksheetByWorksheetId(w.getId())) {
      newWorksheets
          .add(createVWorksheetWithDefaultPreferences(vWorkspace, w));
    }
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

protected void applyHistoryToWorksheet(Workspace workspace, Worksheet worksheet,
    KR2RMLMapping mapping) throws JSONException {
  WorksheetCommandHistoryExecutor wchr = new WorksheetCommandHistoryExecutor(worksheet.getId(), workspace);
  try
  {
    List<CommandTag> tags = new ArrayList<>();
    tags.add(CommandTag.Selection);
    tags.add(CommandTag.Transformation);
    
    List<CommandTag> ignoreTags = new ArrayList<>();
    ignoreTags.add(CommandTag.IgnoreInBatch);
    wchr.executeCommandsByTags(tags, 
        ignoreTags,
        new JSONArray(mapping.getWorksheetHistoryString()));
  }
  catch (CommandException | KarmaException e)
  {
    logger.error("Unable to execute column transformations", e);
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
  public void generateJson(String prefix, PrintWriter pw,	VWorkspace vWorkspace) {
    JSONObject outputObject = new JSONObject();
    try {
      outputObject.put(JsonKeys.updateType.name(),
          "PublishPresetUpdate");
      outputObject.put(JsonKeys.fileUrl.name(), 
          contextParameters.getParameterValue(ContextParameter.JSON_PUBLISH_RELATIVE_DIR) + jsonFileName);
      outputObject.put(JsonKeys.worksheetId.name(),
          wsht.getId());
      pw.println(outputObject.toString(4));
    } catch (JSONException e) {
      logger.error("Error occured while generating JSON!");
    }
  }
});

代码示例来源:origin: usc-isi-i2/Web-Karma

protected UpdateContainer savePreset(Workspace workspace, final Worksheet wsht) throws FileNotFoundException {
  final ServletContextParameterMap contextParameters = ContextParametersRegistry.getInstance().getContextParameters(workspace.getContextId());
  final String jsonFileName = workspace.getCommandPreferencesId() + wsht.getId() + "-" + 
      wsht.getTitle().replaceAll("\\.", "_") +  "-preset"+".json"; 
  final String jsonFileLocalPath = contextParameters.getParameterValue(ContextParameter.JSON_PUBLISH_DIR) +  
      jsonFileName;
  PrintWriter printWriter = new PrintWriter(jsonFileLocalPath);
  printWriter.println(new JSONArray(columnsJson).toString(4));
  printWriter.close();
  return new UpdateContainer(new AbstractUpdate() {
    @Override
    public void generateJson(String prefix, PrintWriter pw,	VWorkspace vWorkspace) {
      JSONObject outputObject = new JSONObject();
      try {
        outputObject.put(JsonKeys.updateType.name(),
            "PublishPresetUpdate");
        outputObject.put(JsonKeys.fileUrl.name(), 
            contextParameters.getParameterValue(ContextParameter.JSON_PUBLISH_RELATIVE_DIR) + jsonFileName);
        outputObject.put(JsonKeys.worksheetId.name(),
            wsht.getId());
        pw.println(outputObject.toString(4));
      } catch (JSONException e) {
        logger.error("Error occured while generating JSON!");
      }
    }
  });
}

代码示例来源:origin: usc-isi-i2/Web-Karma

Worksheet wsht = impCSV.generateWorksheet();
uc = new UpdateContainer();
uc.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION, workspace.getContextId()));
new File(fileName).delete();

代码示例来源:origin: usc-isi-i2/Web-Karma

Worksheet wsht = impJson.generateWorksheet();
logger.info("Creating worksheet with json : " + wsht.getId());
uc = new UpdateContainer();
uc.add(new WorksheetListUpdate());
uc.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION, workspace.getContextId()));

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
public void generateJson(String prefix, PrintWriter pw,
    VWorkspace vWorkspace) {
  VWorksheet vWorksheet =  vWorkspace.getViewFactory().getVWorksheetByWorksheetId(worksheetId);
  
  try {
    JSONObject response = new JSONObject();
    response.put(JsonKeys.worksheetId.name(), worksheetId);
    response.put(AbstractUpdate.GenericJsonKeys.updateType.name(), 
        this.getClass().getSimpleName());
    
    Worksheet wk = vWorksheet.getWorksheet();
    List<VHNode> viewHeaders = vWorksheet.getHeaderViewNodes();
    
    JSONArray columns = getColumnsJsonArray(viewHeaders, wk.getSemanticTypes());
    response.put(JsonKeys.columns.name(), columns);
    
    pw.println(response.toString());
    if (deleteAfterGenerate) {
      vWorkspace.getWorkspace().getFactory().removeWorksheet(wk.getId(), vWorkspace.getWorkspace().getCommandHistory());
      vWorkspace.getViewFactory().removeWorksheet(wk.getId());
    }
  } catch (JSONException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

private void addWorksheetHistory(JSONArray history) {
  if(history != null) {
    r2rmlMapping.setWorksheetHistory(history);
  } else {
    String filename = CommandHistory.getHistorySaver(workspace.getId()).getHistoryFilepath(worksheet.getId());
    if(!HistoryJsonUtil.historyExists(workspace.getId(), worksheet.getId())) {
      logger.error("Worksheet history file not found! Can't write worksheet history " +
          "into R2RML model. Path:" + filename);
      return;
    }
    
    try {
      JSONArray historyArr = CommandHistory.getHistorySaver(workspace.getId()).loadHistory(filename);
      r2rmlMapping.setWorksheetHistory(historyArr);
    } catch(Exception e) {
      logger.error("Unable to read worksheet history from file: " + filename);
    }
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

pw.println("|  --- | -------- | ---|");
Alignment alignment = AlignmentManager.Instance().getAlignment(workspace.getId(), worksheet.getId());
HashSet<String> provenanceProperties = new HashSet<>();
if(alignment != null) {

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
public Worksheet generateWorksheet() throws KarmaException {
  /**
   * Get the data from the database table *
   */
  AbstractJDBCUtil dbUtil = JDBCUtilFactory.getInstance(dbType);
  // TODO Limiting the number of rows to 1000 for now to avoid all data in memory
  ArrayList<ArrayList<String>> data;
  try {
    data = dbUtil.getSQLQueryDataForLimitedRows(dbType, hostname,
        portnumber, username, password, query, dBorSIDName, 1000);
     return generateWorksheet(dbUtil, data);
  } catch (SQLException | ClassNotFoundException e) {
    //If data could not be imported, delete the empty worksheet
    Worksheet ws = getWorksheet();
    if(ws != null)
      workspace.removeWorksheet(ws.getId());
    
    throw new KarmaException("Unable to get data for the SQL Query: " + e.getMessage());
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson);
SuggestModelCommand comm = new SuggestModelCommand(getNewId(workspace), model,
    worksheet.getId(), false, selectionName);
OntologyManager ontMgr = workspace.getOntologyManager();

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
public UpdateContainer doIt(Workspace workspace) throws CommandException {
  UpdateContainer uc = new UpdateContainer();
  WorkspaceManager mgr = WorkspaceManager.getInstance();
  // Remove it from the rep factory
  mgr.removeWorkspace(workspaceId);
  
  // Remove any alignments from the AlignmentManager
  AlignmentManager.Instance().removeWorkspaceAlignments(workspace.getId());
  
  // Remove it from the workspace registry
  WorkspaceRegistry.getInstance().deregister(workspaceId);
  VWorkspaceRegistry.getInstance().deregisterVWorkspace(workspaceId);
  for (Worksheet worksheet : workspace.getWorksheets()) {
    workspace.getFactory().removeWorksheet(worksheet.getId(), workspace.getCommandHistory());
    workspace.removeWorksheet(worksheet.getId());
    uc.add(new WorksheetDeleteUpdate(worksheet.getId()));
  }
  return uc;
}

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
public UpdateContainer doIt(Workspace workspace) throws CommandException {
  //save the preferences 
  UpdateContainer c = new UpdateContainer();
  try {
    Object json = HTTPUtil.executeAndParseHTTPGetService(serviceUrl, includeInputAttributes);
    logger.debug(json.toString());
    Import imp = new JsonImport(json, worksheetName, workspace, encoding, -1);
    Worksheet wsht = imp.generateWorksheet();
    c.add(new ImportServiceCommandPreferencesUpdate(serviceUrl, worksheetName));
    c.add(new WorksheetListUpdate());
    c.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION, workspace.getContextId()));
    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"));
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

newWorksheetId = newws.getId();
return newws;

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
public UpdateContainer doIt(Workspace workspace) throws CommandException {
  UpdateContainer c = new UpdateContainer();
  try {
    Import imp = createImport(workspace);
    Worksheet wsht = imp.generateWorksheet();
    if (hasRevisionId()) {
      Worksheet revisedWorksheet = workspace.getWorksheet(getRevisionId());
      wsht.setRevisedWorksheet(revisedWorksheet);  
    }
    c.add(new WorksheetListUpdate());
    c.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION, workspace.getContextId()));
  } catch (JSONException | IOException | KarmaException | NullPointerException | ClassNotFoundException e) {
    logger.error("Error occured while generating worksheet from " + getTitle() + "!", e);
    return new UpdateContainer(new ErrorUpdate(
        "Error occured during import: " + e.getMessage()));
  }
  return c;
}

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    UpdateContainer uc = new UpdateContainer();
    try {
      Import imp = createImport(workspace);
      final Worksheet wsht = imp.generateWorksheet();
      if (hasRevisionId()) {
        Worksheet revisedWorksheet = workspace.getWorksheet(getRevisionId());
        wsht.setRevisedWorksheet(revisedWorksheet);  
      }
      uc.add(new WorksheetListUpdate());
      uc.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION, workspace.getContextId()));
      if (savePreset) {
        uc.append(savePreset(workspace, wsht));
      }
    } catch (JSONException | IOException | KarmaException | NullPointerException | ClassNotFoundException e) {
      logger.error("Error occured while generating worksheet from " + getTitle() + "!", e);
      return new UpdateContainer(new ErrorUpdate(
          "Error occured during import: " + e.getMessage()));
    }
    return uc;
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

c.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION, workspace.getContextId()));
} catch (Exception e) {
  logger.error("Error occured while importing CSV file.", e);

相关文章