@Override
 public UpdateContainer doIt(Workspace workspace) throws CommandException {
   UpdateContainer uc = new UpdateContainer();
   SuperSelection sel = this.getSuperSelection(workspace);
   for (int i = 0; i < updates.length(); i++) {
     String update = updates.getString(i);
     switch (update) {
       case "headers":
         uc.add(new WorksheetHeadersUpdate(worksheetId));
         break;
       case "list":
         uc.add(new WorksheetListUpdate());
         break;
       case "data":
         uc.add(new WorksheetDataUpdate(worksheetId, sel));
         break;
       case "alignment":
         {
           Alignment alignment =
               AlignmentManager.Instance()
                   .getAlignmentOrCreateIt(
                       workspace.getId(), worksheetId, workspace.getOntologyManager());
           uc.add(new AlignmentSVGVisualizationUpdate(worksheetId, alignment));
           break;
         }
       case "semanticTypes":
         {
           Alignment alignment =
               AlignmentManager.Instance()
                   .getAlignmentOrCreateIt(
                       workspace.getId(), worksheetId, workspace.getOntologyManager());
           uc.add(
               new SemanticTypesUpdate(
                   workspace.getWorksheet(worksheetId), worksheetId, alignment));
           break;
         }
       case "regenerate":
         uc.add(new RegenerateWorksheetUpdate(worksheetId));
         break;
       case "all":
         uc = WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, sel);
         break;
       case "cleaning":
         uc.add(new WorksheetCleaningUpdate(worksheetId, false, sel));
         break;
     }
   }
   return uc;
 }
  private void generateRDFFromWorksheet(
      Worksheet wk,
      Workspace workspace,
      KR2RMLMapping mapping,
      List<KR2RMLRDFWriter> writers,
      String baseURI)
      throws IOException, JSONException, KarmaException {
    // 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
    KR2RMLWorksheetRDFGenerator rdfGen =
        new KR2RMLWorksheetRDFGenerator(
            wk,
            workspace.getFactory(),
            workspace.getOntologyManager(),
            writers,
            false,
            mapping,
            errorReport,
            selection);

    // Generate the rdf
    rdfGen.generateRDF(false);
  }
  @Override
  public UpdateContainer doIt(VWorkspace vWorkspace) throws CommandException {
    Worksheet worksheet = vWorkspace.getViewFactory().getVWorksheet(vWorksheetId).getWorksheet();

    Workspace ws = vWorkspace.getWorkspace();
    if (worksheet.getSemanticTypes().getListOfTypes().size() == 0) {
      SemanticTypeUtil.populateSemanticTypesUsingCRF(
          worksheet,
          ws.getTagsContainer().getTag(TagName.Outlier),
          ws.getCrfModelHandler(),
          ws.getOntologyManager());
    }

    WorksheetGeospatialContent geo = new WorksheetGeospatialContent(worksheet);
    // Send an error update if no geospatial data found!
    if (geo.hasNoGeospatialData()) {
      return new UpdateContainer(new ErrorUpdate("No geospatial data found in the worksheet!"));
    }

    try {
      final File file = geo.publishKML();
      // Transfer the file to a public server
      final boolean transfer = transferFileToPublicServer(file);
      if (!transfer) {
        logger.error(
            "Published KML file could not be moved to a public server to display on Google Maps!");
      }

      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(), "PublishKMLUpdate");
                outputObject.put(JsonKeys.fileName.name(), publicKMLAddress + file.getName());
                outputObject.put(JsonKeys.transferSuccessful.name(), transfer);
                outputObject.put(JsonKeys.localFileName.name(), "KML/" + file.getName());
                pw.println(outputObject.toString(4));
              } catch (JSONException e) {
                logger.error("Error occured while generating JSON!");
              }
            }
          });
    } catch (FileNotFoundException e) {
      logger.error("KML File not found!", e);
      return new UpdateContainer(new ErrorUpdate("Error occurred while publishing KML layer!"));
    }
  }
  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    final OntologyManager ontMgr = workspace.getOntologyManager();
    Set<LabeledLink> properties = new HashSet<>();

    logger.debug(
        "GetPropertiesCommand:"
            + propertiesRange
            + ":"
            + classURI
            + ","
            + domainURI
            + ", "
            + rangeURI);

    if (propertiesRange == INTERNAL_PROP_RANGE.allObjectProperties) {
      HashMap<String, Label> linkList = ontMgr.getObjectProperties();
      if (linkList != null) {
        for (Label label : linkList.values()) {
          properties.add(new DataPropertyLink(label.getUri(), label));
        }
      }
    } else if (propertiesRange == INTERNAL_PROP_RANGE.allDataProperties) {
      HashMap<String, Label> linkList = ontMgr.getDataProperties();
      for (Label label : linkList.values()) {
        properties.add(new DataPropertyLink(label.getUri(), label));
      }
    } else if (propertiesRange == INTERNAL_PROP_RANGE.propertiesWithDomainRange) {
      Map<String, Label> linkList =
          ontMgr.getObjectPropertiesByDomainRange(domainURI, rangeURI, true);
      for (Label label : linkList.values()) {
        properties.add(new DataPropertyLink(label.getUri(), label));
      }
    } else if (propertiesRange == INTERNAL_PROP_RANGE.dataPropertiesForClass) {
      Map<String, Label> linkList = ontMgr.getDataPropertiesByDomain(classURI, true);
      for (Label label : linkList.values()) {
        properties.add(new DataPropertyLink(label.getUri(), label));
      }
    } else if (propertiesRange == INTERNAL_PROP_RANGE.existingProperties) {
      Alignment alignment =
          AlignmentManager.Instance()
              .getAlignmentOrCreateIt(workspace.getId(), worksheetId, ontMgr);
      Set<String> steinerTreeNodeIds = new HashSet<String>();
      if (alignment != null && !alignment.isEmpty()) {
        DirectedWeightedMultigraph<Node, LabeledLink> steinerTree = alignment.getSteinerTree();
        for (Node node : steinerTree.vertexSet()) {
          if (node.getType() == NodeType.InternalNode) {
            steinerTreeNodeIds.add(node.getId());
          }
        }

        List<LabeledLink> specializedLinks = new ArrayList<LabeledLink>();
        Set<LabeledLink> temp = null;
        temp = alignment.getLinksByType(LinkType.DataPropertyLink);
        if (temp != null) specializedLinks.addAll(temp);
        for (LabeledLink link : steinerTree.edgeSet())
          if (link instanceof ObjectPropertyLink) specializedLinks.add(link);

        // Store the data property links for specialized edge link options
        properties.addAll(specializedLinks);
      }
    }

    logger.debug("Got back " + properties.size() + " results");
    final Set<LabeledLink> finalProperties = properties;

    UpdateContainer upd =
        new UpdateContainer(
            new AbstractUpdate() {
              @Override
              public void generateJson(String prefix, PrintWriter pw, VWorkspace vWorkspace) {
                JSONObject obj = new JSONObject();
                JSONArray resultArray = new JSONArray();

                try {
                  obj.put(JsonKeys.updateType.name(), "PropertyList");

                  for (LabeledLink link : finalProperties) {
                    Label linkLabel = link.getLabel();
                    String edgeLabelStr = linkLabel.getDisplayName();
                    JSONObject edgeObj = new JSONObject();
                    if (linkLabel.getUri() != null
                        && linkLabel.getNs() != null
                        && linkLabel.getUri().equalsIgnoreCase(linkLabel.getNs())) {
                      edgeLabelStr = linkLabel.getUri();
                    }

                    edgeObj.put(JsonKeys.label.name(), edgeLabelStr);
                    edgeObj.put(JsonKeys.uri.name(), linkLabel.getUri());
                    edgeObj.put(JsonKeys.id.name(), link.getId());
                    resultArray.put(edgeObj);
                  }

                  obj.put(JsonKeys.properties.name(), resultArray);
                  pw.println(obj.toString());
                } catch (Exception e) {
                  logger.error("Exception:", e);
                  e.printStackTrace();
                }
              }
            });
    return upd;
  }