boolean hasWorkspaceCookieId = false;
String hasPrefId = request.getParameter(Arguments.hasPreferenceId.name());
if(hasPrefId != null && hasPrefId.equals("true"))
hasWorkspaceCookieId = true;
Workspace workspace = null;
VWorkspace vwsp = null;
/* If set, pick the right preferences and CRF Model file */
if(hasWorkspaceCookieId) {
String cachedWorkspaceId = request.getParameter(Arguments.workspacePreferencesId.name());
workspace = WorkspaceManager.getInstance().createWorkspaceWithPreferencesId(cachedWorkspaceId);
vwsp = new VWorkspace(workspace, cachedWorkspaceId);
} else {
workspace = WorkspaceManager.getInstance().createWorkspace();
vwsp = new VWorkspace(workspace);
}
workspace.setMetadataManager(metadataManager);
WorkspaceRegistry.getInstance().register(new ExecutionController(workspace));
VWorkspaceRegistry.getInstance().registerVWorkspace(workspace.getId(), vwsp);
logger.info("Start Metadata Setup");
try {
metadataManager.register(new SemanticTypeModelMetadata(workspace), updateContainer);
metadataManager.register(new OntologyMetadata(workspace), updateContainer);
metadataManager.register(new JSONModelsMetadata(workspace), updateContainer);
metadataManager.register(new PythonTransformationMetadata(workspace), updateContainer);
metadataManager.register(new GraphVizMetadata(workspace), updateContainer);
metadataManager.register(new ModelLearnerMetadata(workspace), updateContainer);
metadataManager.register(new R2RMLMetadata(workspace), updateContainer);
metadataManager.register(new R2RMLPublishedMetadata(workspace), updateContainer);
metadataManager.register(new RDFMetadata(workspace), updateContainer);
metadataManager.register(new CSVMetadata(workspace), updateContainer);
metadataManager.register(new JSONMetadata(workspace), updateContainer);
metadataManager.register(new ReportMetadata(workspace), updateContainer);
metadataManager.register(new AvroMetadata(workspace), updateContainer);
} catch (KarmaException e) {
logger.error("Unable to complete Karma set up: ", e);
}
CommandHistory.setIsHistoryEnabled(true);
CommandHistory.setHistorySaver(workspace.getId(), new R2RMLAlignmentFileSaver(workspace));
// Initialize the Outlier tag
Tag outlierTag = new Tag(TagName.Outlier, Color.Red);
workspace.getTagsContainer().addTag(outlierTag);
// Put all created worksheet models in the view.
updateContainer.add(new WorksheetListUpdate());
for (Worksheet w : vwsp.getWorkspace().getWorksheets()) {
updateContainer.append(WorksheetUpdateFactory.createWorksheetHierarchicalUpdates(w.getId(), SuperSelectionManager.DEFAULT_SELECTION));
}
updateContainer.add(new AbstractUpdate() {