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

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

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

Worksheet.getMetadataContainer介绍

暂无

代码示例

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

public boolean containService() {
  if (this.getMetadataContainer() == null) {
    return false;
  }
  if (this.getMetadataContainer().getService() == null) {
    return false;
  }
  return true;
}

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

public boolean containSource() {
  if (this.getMetadataContainer() == null) {
    return false;
  }
  if (this.getMetadataContainer().getSource() == null) {
    return false;
  }
  return true;
}

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

public void generateJson(String prefix, PrintWriter pw,
    VWorkspace vWorkspace) {
  VWorksheet vWorksheet =  vWorkspace.getViewFactory().getVWorksheetByWorksheetId(worksheetId);
  workspace = vWorkspace.getWorkspace();
  try {
    JSONObject response = new JSONObject();
    response.put(JsonKeys.worksheetId.name(), worksheetId);
    response.put(AbstractUpdate.GenericJsonKeys.updateType.name(), 
        this.getClass().getSimpleName());
    
    Worksheet wk = vWorksheet.getWorksheet();
    ColumnMetadata colMeta = wk.getMetadataContainer().getColumnMetadata();
    List<VHNode> viewHeaders = vWorksheet.getHeaderViewNodes();
    
    JSONArray columns = getColumnsJsonArray(viewHeaders, colMeta);
    response.put(JsonKeys.columns.name(), columns);
    
    pw.println(response.toString());
  } catch (JSONException e) {
    e.printStackTrace();
  }
}

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

public void removeWorksheet(String id, CommandHistory history) {
  if(worksheets.containsKey(id)) {
    Worksheet worksheet = worksheets.get(id);
    removeHTableRecursive(worksheet.getHeaders());
    removeDataTableRecursive(worksheet.getDataTable());
    worksheet.getMetadataContainer().setColumnMetadata(null);
    worksheet.setMetadataContainer(null);
    history.removeCommands(id);
    worksheets.remove(id);
  }
}

代码示例来源: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(), "SetWorksheetProperties");
    outputObject.put(JsonKeys.worksheetId.name(), worksheetId);
    WorksheetProperties props = worksheet.getMetadataContainer().getWorksheetProperties();
    if (props.getPropertyValue(Property.baseURI) != null)
      outputObject.put(JsonKeys.baseURI.name(), props.getPropertyValue(Property.baseURI));
    if (props.getPropertyValue(Property.prefix) != null)
      outputObject.put(JsonKeys.prefix.name(), props.getPropertyValue(Property.prefix));
    if (props.getPropertyValue(Property.graphLabel) != null && !props.getPropertyValue(Property.graphLabel).trim().isEmpty()) 
      outputObject.put(JsonKeys.graphLabel.name(), props.getPropertyValue(Property.graphLabel));
    if (props.getPropertyValue(Property.GithubURL) != null && !props.getPropertyValue(Property.GithubURL).trim().isEmpty())
      outputObject.put(JsonKeys.GithubURL.name(), props.getPropertyValue(Property.GithubURL));
    
    pw.println(outputObject.toString());
  } catch (JSONException e) {
    e.printStackTrace();
    logger.error("Error occured while generating JSON!");
  }
}

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

@Override
public UpdateContainer doIt(Workspace workspace) throws CommandException {
  ApplyHistoryFromR2RMLModelCommandFactory factory = new ApplyHistoryFromR2RMLModelCommandFactory();
  try {
    String context = (modelContext != null && !modelContext.isEmpty()? (modelContext + "/") : "");
    URL url = new URL(baseUrl + context + modelURL + "?modelRepository=" + modelRepository);
    File file = new File("tmp.ttl");	
    FileUtils.copyURLToFile(url, file);
    Command cmd = factory.createCommandFromFile(model, worksheetId, file, workspace, override);
    UpdateContainer uc = cmd.doIt(workspace);
    workspace.getWorksheet(worksheetId).getMetadataContainer().getWorksheetProperties().setPropertyValue(Property.modelUrl, modelURL);
    workspace.getWorksheet(worksheetId).getMetadataContainer().getWorksheetProperties().setPropertyValue(Property.modelContext, modelContext);
    workspace.getWorksheet(worksheetId).getMetadataContainer().getWorksheetProperties().setPropertyValue(Property.modelRepository, modelRepository);
    file.delete();
    return uc;
  }catch(Exception e) {
    String msg = "Error occured while applying history!";
    logger.error(msg, e);
    return new UpdateContainer(new ErrorUpdate(msg));
  }
  
}

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

private void addSourceType(Worksheet worksheet) {
  String sourceType = worksheet.getMetadataContainer().getWorksheetProperties().getPropertyValue(Property.sourceType);
  r2rmlMapping.setSourceType(SourceTypes.valueOf(sourceType));
}

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

public void replaceWorksheet(String id, Worksheet worksheet) {
  Worksheet oldWorksheet = worksheets.get(id);
  if (oldWorksheet != null) {
    removeHTableRecursive(oldWorksheet.getHeaders());
    removeDataTableRecursive(oldWorksheet.getDataTable());
    oldWorksheet.getMetadataContainer().setColumnMetadata(null);
    oldWorksheet.setMetadataContainer(null);
    worksheets.put(id, worksheet);
    hTables.put(worksheet.getHeaders().getId(), worksheet.getHeaders());
  }
}

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

@Override
public Worksheet generateWorksheet() throws JSONException, IOException, KarmaException, ClassNotFoundException {
  jsonImport.generateWorksheet();
  getWorksheet().getMetadataContainer().getWorksheetProperties().setPropertyValue(Property.sourceType, SourceTypes.XML.toString());
  if (jsonFile != null)
    jsonFile.delete();
  return jsonImport.getWorksheet();
}

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

.name());
Worksheet worksheet = workspace.getWorksheet(worksheetId);
String rdfPrefix =  worksheet.getMetadataContainer().getWorksheetProperties().getPropertyValue(Property.prefix);
String rdfNamespace = worksheet.getMetadataContainer().getWorksheetProperties().getPropertyValue(Property.baseURI);
String selectionName = request.getParameter(Arguments.selectionName.name());
PublishRDFCommand comm = new PublishRDFCommand(getNewId(workspace),

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

public HNode addHNode(HTable headers, String key, DataStructure dataStructure, RepFactory factory, Worksheet worksheet) {
  if (headers == null)
    return null;
  HNode hn = headers.getHNodeFromColumnName(key);
  if (hn == null && isVisible(headers, key, factory)) {
    hn = headers.addHNode(key, HNodeType.Regular, worksheet, factory);
    Worksheet ws = worksheet;
    ws.getMetadataContainer().getColumnMetadata().addColumnDataStructure(hn.getId(), dataStructure);
  }
  return hn;
}

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

public JSONArray getTableLayout(VWorkspace vWorkspace) {
  VWorksheet vWorksheet = vWorkspace.getViewFactory()
      .getVWorksheetByWorksheetId(worksheetId);
  Worksheet wk = vWorksheet.getWorksheet();
  ColumnMetadata colMeta = wk.getMetadataContainer().getColumnMetadata();
  List<VHNode> viewHeaders = vWorksheet.getHeaderViewNodes();
    
  return getColumnsJsonArray(viewHeaders, colMeta);
}

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

worksheet.getMetadataContainer().getColumnMetadata().addColumnPythonTransformation(newHNodeId, this.transformationCode);
worksheet.getMetadataContainer().getColumnMetadata().addPreviousCommandId(newHNodeId, this.id);
worksheet.getMetadataContainer().getColumnMetadata().addColumnDerivedFrom(newHNodeId, hNodeId);

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

private Worksheet groupByTopLevel(Worksheet oldws, Workspace workspace, List<String> hnodeIDs, List<HNode> keyhnodes, List<HNode> valuehnodes, RepFactory factory) {
  SuperSelection selection = getSuperSelection(oldws);
  Worksheet newws = factory.createWorksheet("GroupBy: " + oldws.getTitle(), workspace, oldws.getEncoding());
  newws.getMetadataContainer().getWorksheetProperties().setPropertyValue(Property.sourceType, oldws.getMetadataContainer().getWorksheetProperties().getPropertyValue(Property.sourceType));
  HTable newht =  newws.getHeaders();
  ArrayList<Row> rows = oldws.getDataTable().getRows(0, oldws.getDataTable().getNumRows(), selection);

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

private TemplateTermSet expandColumnTemplateTermForPyTransforms(
    String hNodeId, ColumnTemplateTerm cnTerm) {
  TemplateTermSet tts = null;
  String pythonCommand = worksheet.getMetadataContainer().getColumnMetadata().getColumnPython(hNodeId);
  List<PythonTransformationToken> tokens = PythonTransformationAsURITokenizer.tokenize(pythonCommand);
  PythonTransformationAsURIValidator validator = new PythonTransformationAsURIValidator();
  if(validator.validate(tokens))
  {
    tts = this.transformationToTemplateTermSet.translate(tokens, hNodeId);
  }
  else
  {
    tts = new TemplateTermSet();
    tts.addTemplateTermToSet(cnTerm);
  }
  return tts;
}

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

@Override
public UpdateContainer undoIt(Workspace workspace) {
  inputColumns.clear();
  outputColumns.clear();
  RepFactory factory = workspace.getFactory();
  Worksheet worksheet = workspace.getWorksheet(worksheetId);
  SuperSelection superSel = getSuperSelection(worksheet);
  HNode hNode = workspace.getFactory().getHNode(hNodeId);
  Selection currentSel = superSel.getSelection(hNode.getHTableId());
  if (previousSelection != null) {
    superSel.addSelection(previousSelection);
    outputColumns.addAll(previousSelection.getInputColumns());
  }
  if (currentSel != null) {
    worksheet.getSelectionManager().removeSelection(currentSel);
    superSel.removeSelection(currentSel);
  }
  worksheet.getMetadataContainer().getColumnMetadata().removeSelectionPythonCode(factory.getHTable(factory.getHNode(hNodeId).getHTableId()).getId());
  WorksheetUpdateFactory.detectSelectionStatusChange(worksheetId, workspace, this);
  UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, superSel, workspace.getContextId());    
  uc.add(new WorksheetSuperSelectionListUpdate(worksheetId));
  return uc;
}

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

@Override
public Command createCommand(JSONArray inputJson, String model, Workspace workspace)
    throws JSONException, KarmaException {
  String worksheetId = HistoryJsonUtil.getStringValue(Arguments.worksheetId.name(), inputJson);
  String hNodeId = HistoryJsonUtil.getStringValue(Arguments.hNodeId.name(), inputJson);
  this.normalizeSelectionId(worksheetId, inputJson, workspace);
  String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson);
  Worksheet worksheet = workspace.getWorksheet(worksheetId);
  if (worksheet == null) {
    throw new KarmaException("Worksheet not found");
  }
  String transformCode = worksheet.getMetadataContainer().getColumnMetadata().getColumnPython(hNodeId);
  if (transformCode == null) {
    throw new KarmaException("Transform code is null");
  }
  RepeatPythonTransformationCommand cmd = new RepeatPythonTransformationCommand(
      getNewId(workspace), model, worksheetId, 
      hNodeId, transformCode, selectionName);
  cmd.setInputParameterJson(inputJson.toString());
  return cmd;
}

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

@Override
public UpdateContainer doIt(Workspace workspace) throws CommandException {
  final ServletContextParameterMap contextParameters = ContextParametersRegistry.getInstance().getContextParameters(workspace.getContextId());
  Worksheet worksheet = workspace.getWorksheet(worksheetId);
  JSONArray transformedRows = new JSONArray();
  JSONArray errorValues = new JSONArray();
  PythonRepository repo = PythonRepositoryRegistry.getInstance().getPythonRepository(contextParameters.getParameterValue(ContextParameter.USER_PYTHON_SCRIPTS_DIRECTORY));
  repo.resetLibrary();
  boolean isError = false;
  try {
    generateTransformedValues(workspace, 
        worksheet, workspace.getFactory(), workspace.getFactory().getHNode(hNodeId), transformedRows, errorValues, null);
    if (errorValues.length() > 0) {
      isError = true;
    }
    JSONArray multiCellEditInput = getMultiCellValueEditInputJSON(transformedRows, hNodeId);
    MultipleValueEditColumnCommandFactory mfc = new MultipleValueEditColumnCommandFactory();
    MultipleValueEditColumnCommand mvecc =  (MultipleValueEditColumnCommand) mfc.createCommand(multiCellEditInput, model, workspace);
    mvecc.doIt(workspace);
  }catch(Exception e) {
    isError = true;
  }
  worksheet.getMetadataContainer().getColumnMetadata().addColumnOnError(hNodeId, isError);
  UpdateContainer c = new UpdateContainer();
  c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(worksheet), workspace.getContextId()));        
  c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
  return c;
}

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

worksheet.getMetadataContainer().getColumnMetadata().addSelectionPythonCode(hTable.getId(), this.pythonCode);

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

public void addWorksheetProperties(Worksheet worksheet, Resource mappingRes) throws RepositoryException {
  WorksheetProperties props = worksheet.getMetadataContainer().getWorksheetProperties();
  if (props == null) {
    return;

相关文章