VIVO-383 don't list every file graph at startup.

Also, use shorter, relative paths when listing RDF files loaded.
This commit is contained in:
j2blake 2013-10-23 09:51:20 -04:00
parent 271c1e9063
commit 876f1d65db
2 changed files with 13 additions and 4 deletions

View file

@ -174,7 +174,7 @@ public class FileGraphSetup implements ServletContextListener {
if ( !model.isEmpty() ) {
baseModel.addSubModel(model);
log.info("Attached file graph as " + type + " submodel " + p.getFileName());
log.debug("Attached file graph as " + type + " submodel " + p.getFileName());
}
modelChanged = modelChanged | updateGraphInDB(dataset, model, type, p);

View file

@ -87,14 +87,23 @@ public class RDFFilesLoader {
OntModel model) {
OntModel everytimeModel = ModelFactory
.createOntologyModel(OntModelSpec.OWL_MEM);
Set<Path> paths = getPaths(locateHomeDirectory(ctx), RDF, modelPath,
EVERY_TIME);
String home = locateHomeDirectory(ctx);
Set<Path> paths = getPaths(home, RDF, modelPath, EVERY_TIME);
for (Path p : paths) {
log.info("Loading " + relativePath(p, home));
readOntologyFileIntoModel(p, everytimeModel);
}
model.addSubModel(everytimeModel);
}
private static Path relativePath(Path p, String home) {
try {
return Paths.get(home).relativize(p);
} catch (Exception e) {
return p;
}
}
/**
* Create a model from all the RDF files in the specified directory.
*/
@ -148,7 +157,7 @@ public class RDFFilesLoader {
private static void readOntologyFileIntoModel(Path p, Model model) {
String format = getRdfFormat(p);
log.info("Loading "+ p);
log.debug("Loading "+ p);
try (InputStream stream = new FileInputStream(p.toFile())) {
model.read(stream, null, format);
log.debug("...successful");