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();
}
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();
}
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());
}
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;
}
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.");
}
}
Aggregations