use of org.eclipse.rdf4j.sail.Sail in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Query method createMemoryIntelligentGraphRepository.
/**
* Creates the memory intelligent graph repository.
*
* @param dir the dir
* @return the org.eclipse.rdf 4 j.repository. repository
* @throws IOException Signals that an I/O exception has occurred.
* @throws SailConfigException the sail config exception
*/
public static org.eclipse.rdf4j.repository.Repository createMemoryIntelligentGraphRepository(String dir) throws IOException, SailConfigException {
File dataDir = new File(dir);
FileUtils.deleteDirectory(dataDir);
IntelligentGraphConfig intelligentGraphConfig = new IntelligentGraphConfig();
IntelligentGraphFactory intelligentGraphFactory = new IntelligentGraphFactory();
IntelligentGraphSail intelligentGraphSail = (IntelligentGraphSail) intelligentGraphFactory.getSail(intelligentGraphConfig);
Sail baseSail = new MemoryStore();
intelligentGraphSail.setBaseSail(baseSail);
org.eclipse.rdf4j.repository.Repository workingRep = new SailRepository(intelligentGraphSail);
return workingRep;
}
use of org.eclipse.rdf4j.sail.Sail in project commons-rdf by apache.
the class NativeStoreGraphTest method createRepository.
public void createRepository() throws IOException {
final Sail sail = new NativeStore(tempDir.newFolder());
repository = new SailRepository(sail);
repository.initialize();
}
use of org.eclipse.rdf4j.sail.Sail in project commons-rdf by apache.
the class RDF4J method createDataset.
/**
* {@inheritDoc}
* <p>
* <strong>Note:</strong> Some operations on the {@link RDF4JDataset}
* requires the use of try-with-resources to close underlying
* {@link RepositoryConnection}s, including {@link RDF4JDataset#iterate()},
* {@link RDF4JDataset#stream()} and {@link RDF4JDataset#getGraphNames()}.
*/
@Override
public RDF4JDataset createDataset() {
final Sail sail = new MemoryStore();
final Repository repository = new SailRepository(sail);
return RDF4J.createRepositoryDatasetImpl(repository, true, false);
}
Aggregations