Search in sources :

Example 6 with NativeStore

use of org.eclipse.rdf4j.sail.nativerdf.NativeStore in project com.inova8.intelligentgraph by peterjohnlawrence.

the class GeoFactValueTest method setUpBeforeClass.

/**
 * Sets the up before class.
 *
 * @throws Exception the exception
 */
@BeforeAll
static void setUpBeforeClass() throws Exception {
    File dataDir = new File("src/test/resources/datadir/olgap/");
    FileUtils.deleteDirectory(dataDir);
    org.eclipse.rdf4j.repository.Repository workingRep = new SailRepository(new NativeStore(dataDir));
    String dataFilename = "src/test/resources/calc2graph.data.ttl";
    InputStream dataInput = new FileInputStream(dataFilename);
    Model dataModel = Rio.parse(dataInput, "", RDFFormat.TURTLE);
    conn = workingRep.getConnection();
    conn.add(dataModel.getStatements(null, null, null));
    String modelFilename = "src/test/resources/calc2graph.def.ttl";
    InputStream modelInput = new FileInputStream(modelFilename);
    Model modelModel = Rio.parse(modelInput, "", RDFFormat.TURTLE);
    conn = workingRep.getConnection();
    conn.add(modelModel.getStatements(null, null, null));
// String plantFilename = "src/test/resources/Plant.2d.def.ttl";
// InputStream plantInput = new FileInputStream(plantFilename);
// Model plantModel = Rio.parse(plantInput, "", RDFFormat.TURTLE);
// conn = workingRep.getConnection();
// conn.add(plantModel.getStatements(null, null, null));
}
Also used : SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Model(org.eclipse.rdf4j.model.Model) NativeStore(org.eclipse.rdf4j.sail.nativerdf.NativeStore) File(java.io.File) FileInputStream(java.io.FileInputStream) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 7 with NativeStore

use of org.eclipse.rdf4j.sail.nativerdf.NativeStore in project com.inova8.intelligentgraph by peterjohnlawrence.

the class FactDebugTest method setUpBeforeClass.

/**
 * Sets the up before class.
 *
 * @throws Exception the exception
 */
@BeforeAll
static void setUpBeforeClass() throws Exception {
    File dataDir = new File("src/test/resources/datadir/olgap/");
    FileUtils.deleteDirectory(dataDir);
    org.eclipse.rdf4j.repository.Repository workingRep = new SailRepository(new NativeStore(dataDir));
    String modelFilename = "src/test/resources/calc2graph.data.ttl";
    InputStream input = new FileInputStream(modelFilename);
    Model model = Rio.parse(input, "", RDFFormat.TURTLE);
    conn = workingRep.getConnection();
    conn.add(model.getStatements(null, null, null));
}
Also used : SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Model(org.eclipse.rdf4j.model.Model) NativeStore(org.eclipse.rdf4j.sail.nativerdf.NativeStore) File(java.io.File) FileInputStream(java.io.FileInputStream) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 8 with NativeStore

use of org.eclipse.rdf4j.sail.nativerdf.NativeStore in project com.inova8.intelligentgraph by peterjohnlawrence.

the class FactProvenanceTest method setUpBeforeClass.

/**
 * Sets the up before class.
 *
 * @throws Exception the exception
 */
@BeforeAll
static void setUpBeforeClass() throws Exception {
    File dataDir = new File("src/test/resources/datadir/olgap/");
    FileUtils.deleteDirectory(dataDir);
    org.eclipse.rdf4j.repository.Repository workingRep = new SailRepository(new NativeStore(dataDir));
    String modelFilename = "src/test/resources/calc2graph.data.ttl";
    InputStream input = new FileInputStream(modelFilename);
    Model model = Rio.parse(input, "", RDFFormat.TURTLE);
    conn = workingRep.getConnection();
    conn.add(model.getStatements(null, null, null));
}
Also used : SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Model(org.eclipse.rdf4j.model.Model) NativeStore(org.eclipse.rdf4j.sail.nativerdf.NativeStore) File(java.io.File) FileInputStream(java.io.FileInputStream) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 9 with NativeStore

use of org.eclipse.rdf4j.sail.nativerdf.NativeStore in project com.inova8.intelligentgraph by peterjohnlawrence.

the class Query method createNativeLuceneIntelligentGraphRepository.

/**
 * Creates the native lucene 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 createNativeLuceneIntelligentGraphRepository(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);
    // IntelligentGraphSail intelligentGraphSail = new IntelligentGraphSail();
    LuceneSail lucenesail = new LuceneSail();
    lucenesail.setParameter(LuceneSail.LUCENE_RAMDIR_KEY, "true");
    Sail baseSail = new NativeStore(dataDir);
    lucenesail.setBaseSail(baseSail);
    intelligentGraphSail.setBaseSail(lucenesail);
    org.eclipse.rdf4j.repository.Repository workingRep = new SailRepository(intelligentGraphSail);
    return workingRep;
}
Also used : SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) LuceneSail(org.eclipse.rdf4j.sail.lucene.LuceneSail) Sail(org.eclipse.rdf4j.sail.Sail) IntelligentGraphSail(com.inova8.intelligentgraph.sail.IntelligentGraphSail) LuceneSail(org.eclipse.rdf4j.sail.lucene.LuceneSail) NativeStore(org.eclipse.rdf4j.sail.nativerdf.NativeStore) IntelligentGraphFactory(com.inova8.intelligentgraph.sail.IntelligentGraphFactory) IntelligentGraphSail(com.inova8.intelligentgraph.sail.IntelligentGraphSail) File(java.io.File) IntelligentGraphConfig(com.inova8.intelligentgraph.sail.IntelligentGraphConfig)

Example 10 with NativeStore

use of org.eclipse.rdf4j.sail.nativerdf.NativeStore in project com.inova8.intelligentgraph by peterjohnlawrence.

the class Query method createNativeRepository.

/**
 * Creates the native 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 createNativeRepository(String dir) throws IOException, SailConfigException {
    File dataDir = new File(dir);
    FileUtils.deleteDirectory(dataDir);
    Sail baseSail = new NativeStore(dataDir);
    org.eclipse.rdf4j.repository.Repository workingRep = new SailRepository(baseSail);
    return workingRep;
}
Also used : SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) LuceneSail(org.eclipse.rdf4j.sail.lucene.LuceneSail) Sail(org.eclipse.rdf4j.sail.Sail) IntelligentGraphSail(com.inova8.intelligentgraph.sail.IntelligentGraphSail) NativeStore(org.eclipse.rdf4j.sail.nativerdf.NativeStore) File(java.io.File)

Aggregations

SailRepository (org.eclipse.rdf4j.repository.sail.SailRepository)14 NativeStore (org.eclipse.rdf4j.sail.nativerdf.NativeStore)14 File (java.io.File)13 InputStream (java.io.InputStream)9 FileInputStream (java.io.FileInputStream)7 Model (org.eclipse.rdf4j.model.Model)7 BeforeAll (org.junit.jupiter.api.BeforeAll)7 Sail (org.eclipse.rdf4j.sail.Sail)4 IntelligentGraphSail (com.inova8.intelligentgraph.sail.IntelligentGraphSail)3 RepositoryConnection (org.eclipse.rdf4j.repository.RepositoryConnection)3 LuceneSail (org.eclipse.rdf4j.sail.lucene.LuceneSail)3 IntelligentGraphConfig (com.inova8.intelligentgraph.sail.IntelligentGraphConfig)2 IntelligentGraphFactory (com.inova8.intelligentgraph.sail.IntelligentGraphFactory)2 URL (java.net.URL)2 BindingSet (org.eclipse.rdf4j.query.BindingSet)2 Repository (org.eclipse.rdf4j.repository.Repository)2 Test (org.junit.Test)2 CoreseModel (fr.inria.corese.rdf4j.CoreseModel)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1