worksheet.getMetadataContainer().getWorksheetProperties().setPropertyValue(Property.graphName, graphName);
}
// 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();