}
// 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();
StringBuffer query = new StringBuffer("prefix rr: <http://www.w3.org/ns/r2rml#> prefix km-dev: <http://isi.edu/integration/karma/dev#> ");