-
Notifications
You must be signed in to change notification settings - Fork 3
User_Guide
Andrea Gazzarini edited this page Aug 25, 2014
·
4 revisions
The StorageLayerFactory uses the ServiceLoader [1] strategy for detecting an available binding module. So that means if you want to use Cassandra just put in your classpath
- jena-nosql-framework-XYZ.jar
- jena-nosql-binding-cassandra--XYZ.jar
Where XYZ is the version.
NOTE: At the moment It's up to you to define all required jars in the classpath; later, there will be a Maven helper for doing that job; it will create a specific distribution for each kind of supported storage.
final String datafileURI = new File("datafile path").toURI().toString();
Dataset dataset;
StorageLayerFactory factory;
try {
// 1. Load the appropriate factory
factory = StorageLayerFactory.getFactory();
// 2. Create a dataset
dataset = DatasetFactory.create(factory.getDatasetGraph());
// 3. Load and create a model
final Model model = dataset
.getDefaultModel()
.read(datafileURI, "http://example.org", "TTL");
// 4. Do whatever you want with the model...
} finally {
// 5. Make sure resources are released on exit
dataset.close();
factory.getClientShutdownHook().close();
}
[1] http://docs.oracle.com/javase/tutorial/ext/basics/spi.html