• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RepositoryConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnalysisRegistry类代码示例发布时间:2022-05-23
下一篇:
Java XMLSchemaInternalizationLogic类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap