Skip to content
Andrea Gazzarini edited this page Aug 25, 2014 · 4 revisions

User Guide

Choosing the right binding

Loading data

From a file

    final String datafileURI = new File("path to your datafile").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();
    } 
    
Clone this wiki locally