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

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


  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    // TODO Auto-generated method stub
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    HNodePath selectedPath = null;
    List<HNodePath> columnPaths = worksheet.getHeaders().getAllPaths();
    for (HNodePath path : columnPaths) {
      if (path.getLeaf().getId().equals(hNodeId)) {
        selectedPath = path;
View Full Code Here


  @Override
  public UpdateContainer doIt(final Workspace workspace) throws CommandException {
    logger.info("Get Semantic Suggestions: " + worksheetId + "," + hNodeId);
    UpdateContainer uc = new UpdateContainer();
    final SuperSelection selection = getSuperSelection(workspace);
    uc.add(new AbstractUpdate() {

      @Override
      public void generateJson(String prefix, PrintWriter pw,
          VWorkspace vWorkspace) {
View Full Code Here

  protected void generateTransformedValues(Workspace workspace,
      Worksheet worksheet, RepFactory f, HNode hNode,
      JSONArray transformedRows, JSONArray errorValues, Integer limit)
          throws JSONException, IOException {

    SuperSelection selection = getSuperSelection(worksheet);
    String trimmedTransformationCode = transformationCode.trim();
    // Pedro: somehow we are getting empty statements, and these are causing
    // exceptions.
    if (trimmedTransformationCode.isEmpty()) {
      trimmedTransformationCode = "return \"\"";
      logger.info("Empty PyTransform statement in "
          + hNode.getColumnName());
    }
    String transformMethodStmt = PythonTransformationHelper
        .getPythonTransformMethodDefinitionState(worksheet,
            trimmedTransformationCode);


    logger.debug("Executing PyTransform\n" + transformMethodStmt);

    // Prepare the Python interpreter
    PythonInterpreter interpreter = new PythonInterpreter();

    PythonRepository repo = PythonRepository.getInstance();
    repo.initializeInterperter(interpreter);
    repo.importUserScripts(interpreter);
   
    repo.compileAndAddToRepositoryAndExec(interpreter, transformMethodStmt);

    Collection<Node> nodes = new ArrayList<Node>(Math.max(1000, worksheet
        .getDataTable().getNumRows()));
    worksheet.getDataTable().collectNodes(hNode.getHNodePath(f), nodes, selection);

    Map<String, String> rowToValueMap = new HashMap<String, String>();

    int counter = 0;
    long starttime = System.currentTimeMillis();
    // Go through all nodes collected for the column with given hNodeId

    interpreter.set("workspaceid", workspace.getId());
    interpreter.set("command", this);
    interpreter.set("selectionName", selection.getName());
    PyCode py = repo.getTransformCode();

    int numRowsWithErrors = 0;

    for (Node node : nodes) {
View Full Code Here

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    Worksheet wk = workspace.getWorksheet(worksheetId);
    wk.clearSessionData();
    SuperSelection selection = getSuperSelection(wk);
    String Msg = String.format("begin, Time,%d, Worksheet,%s",
        System.currentTimeMillis(), worksheetId);
    logger.info(Msg);
    // Get the HNode
    HashMap<String, HashMap<String, String>> rows = new HashMap<String, HashMap<String, String>>();
View Full Code Here

    return ndid;
  }

  private void populateRowsWithDefaultValues(Worksheet worksheet, RepFactory factory, JSONArray array, HTable htable) {
    SuperSelection selection = getSuperSelection(worksheet);
    HNodePath selectedPath = null;
    List<HNodePath> columnPaths = worksheet.getHeaders().getAllPaths();
    for (HNodePath path : columnPaths) {
      if (path.contains(factory.getHNode(newHNodeId))) { 
        if (path.getLeaf().getId().compareTo(newHNodeId) != 0) {
View Full Code Here

    return flag;
  }

  private boolean addValues(Node node, String value, RepFactory factory, Table table) {
    Worksheet worksheet = factory.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    boolean flag = true;
    if (table != null) {
      for (Row r : table.getRows(0, table.getNumRows(), selection)) {
        Node n = r.getNeighbor(node.getHNodeId());
        if (n.getValue() != null && n.getValue().asString().compareTo(value) == 0) {
View Full Code Here

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {

    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    RepFactory factory = workspace.getFactory();
    TripleStoreUtil util = new TripleStoreUtil();
    HashMap<String, List<String>> result = null;
    nodeUri = nodeUri.trim();
    Map<String, Label> parents = workspace.getOntologyManager().getSuperClasses(nodeUri, true);
View Full Code Here

    //save the preferences
    savePreferences(workspace);
    boolean storeOldHistory = ModelingConfiguration.isStoreOldHistoryEnabled();
    System.out.println("storeOldHistory: " + storeOldHistory);
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    CommandHistory history = workspace.getCommandHistory();
    List<Command> oldCommands = history.getCommandsFromWorksheetId(worksheetId);
    if (storeOldHistory) {     
      JSONArray oldCommandsArray = new JSONArray();
      for (Command refined : oldCommands)
View Full Code Here

  }

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    HNodePath selectedPath = null;
    List<HNodePath> columnPaths = worksheet.getHeaders().getAllPaths();
    for (HNodePath path : columnPaths) {
      if (path.getLeaf().getId().equals(hNodeId)) {
        selectedPath = path;
View Full Code Here

    return  "transform(nodeid)";
  }

  public static boolean hasSelectedRows(Table nestedTable, RepFactory factory, String selectionName) {
    Worksheet worksheet = factory.getWorksheet(nestedTable.getWorksheetId());
    SuperSelection sel = worksheet.getSuperSelectionManager().getSuperSelection(selectionName);
    for (Row r : nestedTable.getRows(0, nestedTable.getNumRows(), SuperSelectionManager.DEFAULT_SELECTION)) {
      if (sel.isSelected(r))
        return true;
    }
    return false;
  }
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.