本文整理汇总了Java中org.openrdf.repository.config.RepositoryConfig类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryConfig类的具体用法?Java RepositoryConfig怎么用?Java RepositoryConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryConfig类属于org.openrdf.repository.config包,在下文中一共展示了RepositoryConfig类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getRepositoryInstance
import org.openrdf.repository.config.RepositoryConfig; //导入依赖的package包/类
/**
* Returns a (un-initialized) Repository instance that has been configured
* based on the supplied configuration data.
*
* @param configuration The repository configuration data.
* @return The created (but un-initialized) repository.
* @throws ConfigurationException If no repository could be created due to
* invalid or incomplete configuration data.
*/
private Repository getRepositoryInstance(Graph configuration) throws ConfigurationException {
RepositoryConfig repoConfig = null;
try {
// read configuration
repoConfig = RepositoryConfig.create(configuration, null);
repoConfig.validate();
RepositoryImplConfig repoImplConfig = repoConfig.getRepositoryImplConfig();
// initialize repository factory
RepositoryRegistry registry = RepositoryRegistry.getInstance();
RepositoryFactory factory = registry.get(repoImplConfig.getType());
if (factory == null) {
throw new ConfigurationException("Unsupported repository type: "
+ repoImplConfig.getType()
+ " in repository definition (id:" + repoConfig.getID()
+ ", title:" + repoConfig.getTitle() + ")");
}
// create repository
return factory.getRepository(repoImplConfig);
} catch (RepositoryConfigException e) {
String reason = "error creating repository";
if (repoConfig != null)
reason += " (id:" + repoConfig.getID() + ", title:" + repoConfig.getTitle() + ")";
throw new ConfigurationException(reason + ": " + e.getMessage());
}
}
开发者ID:goerlitz,项目名称:rdffederator,代码行数:40,代码来源:SPLENDID.java
示例2: testGetRepositoryConfig
import org.openrdf.repository.config.RepositoryConfig; //导入依赖的package包/类
/**
* Test method for
* {@link org.openrdf.repository.manager.RepositoryManager#getRepositoryConfig(java.lang.String)}
* .
*
* @throws Exception
*/
@Test
public void testGetRepositoryConfig() throws Exception
{
RepositoryConfig repositoryConfig = testRepositoryManager.getRepositoryConfig("SYSTEM");
assertNotNull(repositoryConfig);
Model exportGraph = new LinkedHashModel();
repositoryConfig.export(exportGraph);
assertEquals(23, exportGraph.size());
Rio.write(exportGraph, System.out, RDFFormat.NQUADS);
assertEquals(5, exportGraph.filter(null, StardogRepositoryConfig.NAMESPACE_NAME_URI, null).size());
assertEquals(5, exportGraph.filter(null, StardogRepositoryConfig.NAMESPACE_PREFIX_URI, null).size());
Resource topNode = GraphUtil.getUniqueSubject(exportGraph, RDF.TYPE, RepositoryConfigSchema.REPOSITORY);
System.out.println(topNode);
RepositoryConfig imported = new RepositoryConfig();
imported.parse(exportGraph, topNode);
// StardogRepositoryConfig test = new StardogRepositoryConfig();
// test.parse(exportGraph, topNode);
Model secondExport = new LinkedHashModel();
imported.export(secondExport);
assertEquals(23, secondExport.size());
System.out.println("Round-tripped configuration...");
Rio.write(secondExport, System.out, RDFFormat.NQUADS);
// Test round-tripping of the configuration
assertTrue(ModelUtil.equals(exportGraph, secondExport));
}
开发者ID:ansell,项目名称:sesame-stardog-manager,代码行数:44,代码来源:StardogRepositoryManagerTest.java
示例3: testCreateFromTemplateName
import org.openrdf.repository.config.RepositoryConfig; //导入依赖的package包/类
@Test
public void testCreateFromTemplateName() throws Exception {
LocalRepositoryManager repoman = new LocalRepositoryManager(Files.createTempDir());
repoman.initialize();
try(InputStream templateStream = RepositoryConfig.class.getResourceAsStream("RyaAccumuloSail.ttl")) {
String template = IOUtils.toString(templateStream);
final ConfigTemplate configTemplate = new ConfigTemplate(template);
final Map<String, String> valueMap = ImmutableMap.<String, String> builder()
.put("Repository ID", "RyaAccumuloSail")
.put("Repository title", "RyaAccumuloSail Store")
.put("Rya Accumulo user", "root")
.put("Rya Accumulo password", "")
.put("Rya Accumulo instance", "dev")
.put("Rya Accumulo zookeepers", "zoo1,zoo2,zoo3")
.put("Rya Accumulo is mock", "true")
.build();
final String configString = configTemplate.render(valueMap);
// final Repository systemRepo = this.state.getManager().getSystemRepository();
final Graph graph = new LinkedHashModel();
final RDFParser rdfParser = Rio.createParser(RDFFormat.TURTLE);
rdfParser.setRDFHandler(new StatementCollector(graph));
rdfParser.parse(new StringReader(configString), RepositoryConfigSchema.NAMESPACE);
final Resource repositoryNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE,
RepositoryConfigSchema.REPOSITORY);
final RepositoryConfig repConfig = RepositoryConfig.create(graph, repositoryNode);
repConfig.validate();
repoman.addRepositoryConfig(repConfig);
Repository r = repoman.getRepository("RyaAccumuloSail");
r.initialize();
}
}
开发者ID:apache,项目名称:incubator-rya,代码行数:43,代码来源:RyaAccumuloSailFactoryTest.java
示例4: createRepository
import org.openrdf.repository.config.RepositoryConfig; //导入依赖的package包/类
/** Create the repository within Sesame.
* @param taskInfo The TaskInfo object describing the entire task.
* @param results HashMap representing the result of the task.
* @return True, iff the repository creation succeeded.
*/
public final boolean createRepository(final TaskInfo taskInfo,
final HashMap<String, String> results) {
RepositoryManager manager = null;
try {
manager = RepositoryProvider.getRepositoryManager(sesameServer);
String repositoryID = ToolkitFileUtils.getSesameRepositoryId(
taskInfo);
String versionID = taskInfo.getVersion().getTitle();
String repositoryTitle = taskInfo.getVocabulary().getTitle()
+ " (Version: " + versionID + ")";
Repository repository = manager.getRepository(repositoryID);
if (repository != null) {
// Already exists.
// Possible future work: see if the vocabulary title
// has changed in the database, and if so, update
// the title in the Sesame repository.
logger.debug("Sesame createRepository: already exists; "
+ "reusing");
return true;
}
// create a configuration for the SAIL stack
SailImplConfig backendConfig;
if ("current".equals(versionID)) {
// Create an in-memory store for higher performance.
boolean persist = true;
backendConfig = new MemoryStoreConfig(persist);
} else {
// Create a native store.
boolean forceSync = true;
NativeStoreConfig nativeConfig = new NativeStoreConfig();
nativeConfig.setForceSync(forceSync);
backendConfig = nativeConfig;
}
// Stack an inferencer config on top of our backend-config.
backendConfig =
new ForwardChainingRDFSInferencerConfig(backendConfig);
// Create a configuration for the repository implementation.
RepositoryImplConfig repositoryTypeSpec =
new SailRepositoryConfig(backendConfig);
RepositoryConfig repConfig =
new RepositoryConfig(repositoryID, repositoryTitle,
repositoryTypeSpec);
manager.addRepositoryConfig(repConfig);
return true;
} catch (RepositoryConfigException | RepositoryException e) {
results.put(TaskStatus.EXCEPTION,
"Exception in Sesame createRepository()");
logger.error("Exception in Sesame createRepository()", e);
}
return false;
}
开发者ID:au-research,项目名称:ANDS-Vocabs-Toolkit,代码行数:64,代码来源:SesameImporterProvider.java
注:本文中的org.openrdf.repository.config.RepositoryConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论