@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)); } }
@Override public UpdateContainer doIt(Workspace workspace) throws CommandException { Worksheet worksheet = workspace.getWorksheet(worksheetId); SuperSelection currentSel = getSuperSelection(worksheet); List<SelectionWithPriority> selections = new ArrayList<>(); for (Selection sel : currentSel.getAllSelection()) { HTable ht = workspace.getFactory().getHTable(sel.getHTableId()); selections.add(new SelectionWithPriority(sel, hTableDepth(ht, workspace.getFactory()))); } Collections.sort(selections); for (SelectionWithPriority s : selections) { Selection sel = s.sel; JSONArray inputJSON = new JSONArray(); HTable ht = workspace.getFactory().getHTable(sel.getHTableId()); Iterator<String> itr = ht.getHNodeIds().iterator(); inputJSON.put(CommandInputJSONUtil.createJsonObject("worksheetId", worksheetId, ParameterType.worksheetId)); inputJSON.put(CommandInputJSONUtil.createJsonObject("hNodeId", itr.next(), ParameterType.hNodeId)); inputJSON.put(CommandInputJSONUtil.createJsonObject("selectionName", currentSel.getName(), ParameterType.other)); try { Command c = new RefreshSelectionCommandFactory().createCommand(inputJSON, model, workspace); c.doIt(workspace); } catch (Exception e) { logger.error("Exception happened", e); } } UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, currentSel, workspace.getContextId()); uc.add(new HistoryUpdate(workspace.getCommandHistory())); return uc; }
if (consolidatorName.equals("PyTransformConsolidator")) { Command runCommand = (Command)consolidatedCommand.getLeft(); effects.append(runCommand.doIt(workspace)); effects.append(command.doIt(workspace)); effects.append(command.doIt(workspace)); effects.append(command.doIt(workspace)); effects.append(command.doIt(workspace));
false, semanticTypesArray, false, "", "", selection.getName()); appliedCommands.push(sstCommand); sstCommand.doIt(workspace); if(!resultClass.get(i).trim().isEmpty()) changeInternalNodeLinksCommand.doIt(workspace); appliedCommands.push(changeInternalNodeLinksCommand); Command setMetaDataCommand = smpcf.createCommand(model, workspace, nestedHNodeId, worksheetId, "isUriOfClass", targetUri, targetId, false, "", "", selection.getName()); setMetaDataCommand.doIt(workspace); appliedCommands.push(setMetaDataCommand);
cmd.doIt(workspace); outputColumns.addAll(cmd.getOutputColumns()); WorksheetUpdateFactory.detectSelectionStatusChange(worksheetId, workspace, this);
splitCommaCommand = new SplitByCommaCommand(workspace.getFactory().getNewId("C"), model, worksheetId, hNodeId, delimiter, selectionId); return splitCommaCommand.doIt(workspace);