Search in sources :

Example 1 with LuceneSail

use of org.eclipse.rdf4j.sail.lucene.LuceneSail in project inception by inception-project.

the class NoReificationTest method setUp.

@BeforeEach
public void setUp() {
    kb = new KnowledgeBase();
    kb.setDefaultLanguage("en");
    kb.setType(RepositoryType.LOCAL);
    kb.setFullTextSearchIri(null);
    kb.setMaxResults(1000);
    initRdfsMapping();
    // Local in-memory store - this should be used for most tests because we can
    // a) rely on its availability
    // b) import custom test data
    LuceneSail lucenesail = new LuceneSail();
    lucenesail.setParameter(LuceneSail.LUCENE_RAMDIR_KEY, "true");
    lucenesail.setBaseSail(new MemoryStore());
    rdf4jLocalRepo = new SailRepository(lucenesail);
    rdf4jLocalRepo.init();
    sut = new NoReification();
}
Also used : MemoryStore(org.eclipse.rdf4j.sail.memory.MemoryStore) KnowledgeBase(de.tudarmstadt.ukp.inception.kb.model.KnowledgeBase) SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) LuceneSail(org.eclipse.rdf4j.sail.lucene.LuceneSail) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with LuceneSail

use of org.eclipse.rdf4j.sail.lucene.LuceneSail in project inception by inception-project.

the class WikiDataReificationTest method setUp.

@BeforeEach
public void setUp() {
    kb = new KnowledgeBase();
    kb.setDefaultLanguage("en");
    kb.setType(RepositoryType.LOCAL);
    kb.setFullTextSearchIri(null);
    kb.setMaxResults(1000);
    kb.setClassIri("http://www.wikidata.org/entity/Q35120");
    kb.setSubclassIri("http://www.wikidata.org/prop/direct/P279");
    kb.setTypeIri("http://www.wikidata.org/prop/direct/P31");
    kb.setLabelIri("http://www.w3.org/2000/01/rdf-schema#label");
    kb.setPropertyTypeIri("http://www.wikidata.org/entity/Q18616576");
    kb.setDescriptionIri("http://schema.org/description");
    kb.setPropertyLabelIri("http://www.w3.org/2000/01/rdf-schema#label");
    kb.setPropertyDescriptionIri("http://www.w3.org/2000/01/rdf-schema#comment");
    kb.setSubPropertyIri("http://www.wikidata.org/prop/direct/P1647");
    // Local in-memory store - this should be used for most tests because we can
    // a) rely on its availability
    // b) import custom test data
    LuceneSail lucenesail = new LuceneSail();
    lucenesail.setParameter(LuceneSail.LUCENE_RAMDIR_KEY, "true");
    lucenesail.setBaseSail(new MemoryStore());
    rdf4jLocalRepo = new SailRepository(lucenesail);
    rdf4jLocalRepo.init();
    sut = new WikiDataReification();
}
Also used : MemoryStore(org.eclipse.rdf4j.sail.memory.MemoryStore) KnowledgeBase(de.tudarmstadt.ukp.inception.kb.model.KnowledgeBase) SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) LuceneSail(org.eclipse.rdf4j.sail.lucene.LuceneSail) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with LuceneSail

use of org.eclipse.rdf4j.sail.lucene.LuceneSail in project jopa by kbss-cvut.

the class StorageConnectorTest method initializationLoadsRepositoryConfigurationFromFileAndCreatesNativeRepo.

@Test
void initializationLoadsRepositoryConfigurationFromFileAndCreatesNativeRepo() throws Exception {
    final Path serverDir = Files.createTempDirectory("sesame-config-test");
    this.repositoryFolder = serverDir.toFile();
    final String physicalUri = Paths.get(serverDir.toAbsolutePath().toString(), File.separator + "repositories" + File.separator + "native-lucene").toUri().toString();
    final DriverConfiguration conf = TestUtils.createDriverConfig(physicalUri);
    conf.setProperty(SesameConfigParam.REPOSITORY_CONFIG, "classpath:repo-configs/native-lucene.ttl");
    this.connector = new StorageConnector(conf);
    final Repository repo = connector.unwrap(Repository.class);
    assertTrue(repo instanceof SailRepository);
    assertTrue(((SailRepository) repo).getSail() instanceof LuceneSail);
    final File repoDir = new File(URI.create(physicalUri));
    assertTrue(repoDir.exists());
}
Also used : Path(java.nio.file.Path) Repository(org.eclipse.rdf4j.repository.Repository) SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) DriverConfiguration(cz.cvut.kbss.ontodriver.config.DriverConfiguration) LuceneSail(org.eclipse.rdf4j.sail.lucene.LuceneSail) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 4 with LuceneSail

use of org.eclipse.rdf4j.sail.lucene.LuceneSail 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 5 with LuceneSail

use of org.eclipse.rdf4j.sail.lucene.LuceneSail in project inception by inception-project.

the class KnowledgeBaseServiceImpl method rebuildFullTextIndex.

@Override
public void rebuildFullTextIndex(KnowledgeBase aKB) throws Exception {
    if (!RepositoryType.LOCAL.equals(aKB.getType())) {
        throw new IllegalArgumentException("Reindexing is only supported on local KBs");
    }
    boolean reindexSupported = false;
    // Handle re-indexing of local repos that use a Lucene FTS
    if (repoManager.getRepository(aKB.getRepositoryId()) instanceof SailRepository) {
        SailRepository sailRepo = (SailRepository) repoManager.getRepository(aKB.getRepositoryId());
        if (sailRepo.getSail() instanceof LuceneSail) {
            reindexSupported = true;
            LuceneSail luceneSail = (LuceneSail) (sailRepo.getSail());
            try (RepositoryConnection conn = getConnection(aKB)) {
                luceneSail.reindex();
                conn.commit();
            }
        }
    }
    if (!reindexSupported) {
        throw new IllegalArgumentException(aKB + "] does not support rebuilding its full text index.");
    }
}
Also used : RepositoryConnection(org.eclipse.rdf4j.repository.RepositoryConnection) SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) LuceneSail(org.eclipse.rdf4j.sail.lucene.LuceneSail)

Aggregations

SailRepository (org.eclipse.rdf4j.repository.sail.SailRepository)6 LuceneSail (org.eclipse.rdf4j.sail.lucene.LuceneSail)6 KnowledgeBase (de.tudarmstadt.ukp.inception.kb.model.KnowledgeBase)3 MemoryStore (org.eclipse.rdf4j.sail.memory.MemoryStore)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 File (java.io.File)2 IntelligentGraphConfig (com.inova8.intelligentgraph.sail.IntelligentGraphConfig)1 IntelligentGraphFactory (com.inova8.intelligentgraph.sail.IntelligentGraphFactory)1 IntelligentGraphSail (com.inova8.intelligentgraph.sail.IntelligentGraphSail)1 DriverConfiguration (cz.cvut.kbss.ontodriver.config.DriverConfiguration)1 Path (java.nio.file.Path)1 Repository (org.eclipse.rdf4j.repository.Repository)1 RepositoryConnection (org.eclipse.rdf4j.repository.RepositoryConnection)1 Sail (org.eclipse.rdf4j.sail.Sail)1 NativeStore (org.eclipse.rdf4j.sail.nativerdf.NativeStore)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Test (org.junit.jupiter.api.Test)1