/** * @param modelLocation The directory with the Jena TDB model. Will be created * if not existent. * @return * @throws IllegalArgumentException if <code>null</code> is parsed; * if the parsed {@link File} exists but is not a directory; if the parsed * File does NOT exists AND can not be created. */ public static DatasetGraphTDB initTDBDataset(File modelLocation) { if(modelLocation == null){ throw new IllegalArgumentException("The parsed Jena TDB directory" + "MUST NOT be NULL!"); } if(modelLocation.exists() && !modelLocation.isDirectory()){ throw new IllegalArgumentException("The configured RDF model directory "+ modelLocation+"exists but is not a Directory"); } else if(!modelLocation.exists()){ if(!modelLocation.mkdirs()){ throw new IllegalArgumentException("Unable to create the configured RDF model directory "+ modelLocation+"!"); } } Location location = new Location(modelLocation.getAbsolutePath()); //TODO: change this to support transactions // TDBMaker.createDatasetGraphTransaction(location); // if we need transaction support! return TDBMaker.createDatasetGraphTDB(location); }
/** * @param modelLocation The directory with the Jena TDB model. Will be created * if not existent. * @return * @throws IllegalArgumentException if <code>null</code> is parsed; * if the parsed {@link File} exists but is not a directory; if the parsed * File does NOT exists AND can not be created. */ public static DatasetGraphTDB initTDBDataset(File modelLocation) { if(modelLocation == null){ throw new IllegalArgumentException("The parsed Jena TDB directory" + "MUST NOT be NULL!"); } if(modelLocation.exists() && !modelLocation.isDirectory()){ throw new IllegalArgumentException("The configured RDF model directory "+ modelLocation+"exists but is not a Directory"); } else if(!modelLocation.exists()){ if(!modelLocation.mkdirs()){ throw new IllegalArgumentException("Unable to create the configured RDF model directory "+ modelLocation+"!"); } } Location location = new Location(modelLocation.getAbsolutePath()); //TODO: change this to support transactions // TDBMaker.createDatasetGraphTransaction(location); // if we need transaction support! return TDBMaker.createDatasetGraphTDB(location); }