Package edu.isi.karma.controller.command.selection

Examples of edu.isi.karma.controller.command.selection.SuperSelection


    }
  }

  private void glueTopLevel(Worksheet oldws, Workspace workspace, List<HNode> hnodes, RepFactory factory) {
    HTable parentHT = oldws.getHeaders();
    SuperSelection selection = getSuperSelection(oldws);
    HNode newNode = parentHT.addHNode(parentHT.getNewColumnName("Glue"), HNodeType.Transformation, oldws, factory);
    newhNodeId = newNode.getId();
    outputColumns.add(newhNodeId);
    HTable newht = newNode.addNestedTable(newNode.getColumnName(), oldws, factory);
    List<HNode> childHNodes = new ArrayList<HNode>();
View Full Code Here


    }
    return c;
  }

  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);
    HTable oldht =  oldws.getHeaders();
View Full Code Here

    newWorksheetId = newws.getId();
    return newws;
  }

  private void groupByNestedTable(Worksheet oldws, Workspace workspace, HTable ht, List<String> hnodeIDs, List<HNode> keyhnodes, List<HNode> valuehnodes, RepFactory factory) {
    SuperSelection selection = getSuperSelection(oldws);
    HTable parentHT = ht.getParentHNode().getHTable(factory);
    List<Table> parentTables = new ArrayList<Table>();
    CloneTableUtils.getDatatable(oldws.getDataTable(), parentHT,parentTables, selection);
    ArrayList<Row> parentRows = new ArrayList<Row>();
    for (Table tmp : parentTables) {
View Full Code Here

    // Generate RDF for the remaining rows
    // Gets all the errors generated during the RDF generation
    ErrorReport errorReport = new ErrorReport();
   
    this.applyHistoryToWorksheet(workspace, wk, mapping);
    SuperSelection selection = SuperSelectionManager.DEFAULT_SELECTION;
    if (selectionName != null && !selectionName.trim().isEmpty())
      selection = wk.getSuperSelectionManager().getSuperSelection(selectionName);
    if (selection == null)
      return;
    // RDF generation object initialization
View Full Code Here

      return new UpdateContainer(new ErrorUpdate(
          "Please align the worksheet before generating RDF!"));
    }
       
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    // Generate the KR2RML data structures for the RDF generation
    final ErrorReport errorReport = new ErrorReport();
    KR2RMLMappingGenerator mappingGen = null;
   
    try{
View Full Code Here

  }

  @Override
  public UpdateContainer doIt(Workspace workspace) {
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    String worksheetName = worksheet.getTitle();
    try {

      // preparing model file name
      final String modelFileName = workspace.getCommandPreferencesId() + worksheetId + "-" +
          worksheetName +  "-model.ttl";
      final String modelFileLocalPath = ServletContextParameterMap.getParameterValue(
          ContextParameter.R2RML_PUBLISH_DIR) + modelFileName;
     
      File f = new File(modelFileLocalPath);
     
      // preparing the graphUri where the model is published in the triple store
      String graphName = worksheet.getMetadataContainer().getWorksheetProperties().getPropertyValue(Property.graphName);
      if(graphName == null || graphName.isEmpty()) {
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy-kkmmssS");
        String ts = sdf.format(Calendar.getInstance().getTime());
        graphName = "http://localhost/"+workspace.getCommandPreferencesId() + "/" + worksheetId + "/model/" + ts;
        worksheet.getMetadataContainer().getWorksheetProperties().setPropertyValue(Property.graphName, graphName);
      }
     
      // If the model is not published, publish it!
      if(!f.exists() || !f.isFile()) {
        GenerateR2RMLModelCommandFactory factory = new GenerateR2RMLModelCommandFactory();
        GenerateR2RMLModelCommand cmd = (GenerateR2RMLModelCommand)factory.createCommand(workspace, worksheetId, TripleStoreUtil.defaultModelsRepoUrl, graphName, selection.getName());
        cmd.doIt(workspace);
      } else {
        // if the model was published 30 min ago, publish it again, just to be sure
        long diff = Calendar.getInstance().getTimeInMillis() - f.lastModified();
        if((diff / 1000L / 60L) > 30) {
          f.delete();
          GenerateR2RMLModelCommandFactory factory = new GenerateR2RMLModelCommandFactory();
          GenerateR2RMLModelCommand cmd = (GenerateR2RMLModelCommand)factory.createCommand(workspace, worksheetId, TripleStoreUtil.defaultModelsRepoUrl, graphName, selection.getName());
          cmd.doIt(workspace);
        }
      }
     
//      TripleStoreUtil tUtil = new TripleStoreUtil();
View Full Code Here

  protected void normalizeSelectionId(String worksheetId, JSONArray inputJson, Workspace workspace) {
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson);
    if (worksheet == null)
      return;
    SuperSelection sel = worksheet.getSuperSelectionManager().getSuperSelection(selectionName);
    JSONObject obj = CommandInputJSONUtil.getJSONObjectWithName(selectionName, inputJson);
    if (obj != null)
      obj.put("value", sel.getName());
    else
      CommandInputJSONUtil.createJsonObject(Arguments.selectionName.name(), sel.getName(), ParameterType.other);
  }
View Full Code Here

TOP

Related Classes of edu.isi.karma.controller.command.selection.SuperSelection

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.