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

Java VirtuosoRepository类代码示例

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

本文整理汇总了Java中virtuoso.sesame2.driver.VirtuosoRepository的典型用法代码示例。如果您正苦于以下问题:Java VirtuosoRepository类的具体用法?Java VirtuosoRepository怎么用?Java VirtuosoRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VirtuosoRepository类属于virtuoso.sesame2.driver包,在下文中一共展示了VirtuosoRepository类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSail

import virtuoso.sesame2.driver.VirtuosoRepository; //导入依赖的package包/类
@Override
public synchronized Sail getSail() throws SailException {
	if (repository == null) {
		try {
			virtuoso = new VirtuosoRepository("jdbc:virtuoso://localhost:1111", "dba", "dba", true);
			repository = new RepositorySail(virtuoso);
			
			// Needed for inferencing...
			URL schema = Thread.currentThread().getContextClassLoader().getResource("/org/waag/ah/rdf/schema/artsholland.rdf");
			RepositoryConnection connection = virtuoso.getConnection();
			connection.add(schema, null, RDFFormat.RDFXML);
			virtuoso.createRuleSet("artsholland", "http://purl.org/artsholland/1.0/");
			connection.close();
			
		} catch (Exception e) {
			throw new SailException(e);
		}
	}
	return repository;
}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:21,代码来源:Virtuoso.java


示例2: VirtuosoRepositoryManager

import virtuoso.sesame2.driver.VirtuosoRepository; //导入依赖的package包/类
public VirtuosoRepositoryManager(String repositoryUrl, String port, String username, String password) throws RepositoryConnectionException{
    logger.debug("Connecting to Virtuoso["+repositoryUrl+","+port+","+username+","+password+"]");
    if(repositoryUrl.startsWith(Resources.defaultUrlPrefix)){
            repositoryUrl=repositoryUrl.replace(Resources.defaultUrlPrefix, "");
        }
    if(repositoryUrl.endsWith("/")){
        repositoryUrl=repositoryUrl.substring(0, repositoryUrl.length()-1); 
    }
    this.repo=new VirtuosoRepository(Resources.defaultVirtuosoJdbcUrlPrefix+repositoryUrl+":"+port, username, password);
    /*Connect to check that everything is allright */
    try{
        RepositoryConnection repoConn=this.repo.getConnection();
        repoConn.close();
    }catch(RepositoryException ex){
        throw new RepositoryConnectionException("An error occured while initializing the connection to the repository",ex);
    }
}
 
开发者ID:isl,项目名称:LifeWatch_Greece,代码行数:18,代码来源:VirtuosoRepositoryManager.java


示例3: createVirtuosoRepository

import virtuoso.sesame2.driver.VirtuosoRepository; //导入依赖的package包/类
private Repository createVirtuosoRepository(String name, OutputParamReader paramReader) throws LDFusionToolException {
    String host = paramReader.getRequiredStringValue(ConfigParameters.DATA_SOURCE_VIRTUOSO_HOST);
    String port = paramReader.getRequiredStringValue(ConfigParameters.DATA_SOURCE_VIRTUOSO_PORT);
    String username = paramReader.getStringValue(ConfigParameters.DATA_SOURCE_VIRTUOSO_USERNAME);
    String password = paramReader.getStringValue(ConfigParameters.DATA_SOURCE_VIRTUOSO_PASSWORD);

    String connectionString = LDFusionToolUtils.getVirtuosoConnectionString(host, port);
    Repository repository = new VirtuosoRepository(connectionString, username, password);
    try {
        repository.initialize();
    } catch (RepositoryException e) {
        throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.REPOSITORY_INIT_VIRTUOSO,
                "Error when initializing repository for " + name, e);
    }

    LOG.debug("Initialized Virtuoso repository {}", name);
    return repository;
}
 
开发者ID:mifeet,项目名称:LD-FusionTool,代码行数:19,代码来源:RepositoryFactory.java


示例4: main

import virtuoso.sesame2.driver.VirtuosoRepository; //导入依赖的package包/类
public static void main(String[] args) {

		String[] sa = new String[4];
		sa[0] = VIRTUOSO_INSTANCE;
		sa[1] = VIRTUOSO_PORT + "";
		sa[2] = VIRTUOSO_USERNAME;
		sa[3] = VIRTUOSO_PASSWORD;
		for (int i = 0; i < sa.length && i < args.length; i++) {
			sa[i] = args[i];
		}
		Repository repository = new VirtuosoRepository("jdbc:virtuoso://" + sa[0] + ":" + 
				sa[1]+ "/charset=UTF-8/log_enable=2", sa[2], sa[3]);

		//		extractObjectProperties(repository, "http://europeana.eu", Params.LOD_OBJECT_PROPERIES_FILE);
		//		extractDataProperties(repository, "http://europeana.eu", Params.LOD_DATA_PROPERIES_FILE);

		//		extractObjectProperties(repository, "http://amsterdammuseum.nl", Params.LOD_OBJECT_PROPERIES_FILE);
		//		extractDataProperties(repository, "http://amsterdammuseum.nl", Params.LOD_DATA_PROPERIES_FILE);

		List<String> graphIRIs = new ArrayList<String>();
		graphIRIs.add("http://musicbrainz.org");
		graphIRIs.add("http://dbtune.org/jamendo");
		graphIRIs.add("http://dbtune.org/magnatune");
		graphIRIs.add("http://dbtune.org/bbc/peel");
		graphIRIs.add("http://dbtune.org/bbc/playcount");
		extractDataProperties(repository, graphIRIs, Params.LOD_DATA_PROPERIES_FILE);
		extractObjectProperties(repository, graphIRIs, Params.LOD_OBJECT_PROPERIES_FILE);

	}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:30,代码来源:VirtuosoConnector.java


示例5: createStore

import virtuoso.sesame2.driver.VirtuosoRepository; //导入依赖的package包/类
/**
 * Create the store provided by this SailProvider
 *
 * @return a new instance of the store
 */
@Override
public NotifyingSail createStore() {
    final String host = configurationService.getStringConfiguration("virtuoso.host", "localhost");
    final int port = configurationService.getIntConfiguration("virtuoso.port", 1111);
    final String user = configurationService.getStringConfiguration("virtuoso.user", "dba");
    final String pass = configurationService.getStringConfiguration("virtuoso.pass", "dba");
    final String connString = "jdbc:virtuoso://"+host+":"+port;
    
    log.info("Initializing Backend: Virtuoso Store, over " + connString + "...");
    VirtuosoRepository repository = new VirtuosoRepository(connString, user, pass);
    return new NotifyingSailWrapper(repository);
}
 
开发者ID:wikier,项目名称:marmotta-virtuoso,代码行数:18,代码来源:VirtuosoStoreProvider.java


示例6: configureInternal

import virtuoso.sesame2.driver.VirtuosoRepository; //导入依赖的package包/类
@Override
protected void configureInternal(VirtuosoExtractorConfig config) throws ConfigurationException {
    String connectionString = "jdbc:virtuoso://" + config.getHost() + ':' + config.getPort();
    repository = new VirtuosoRepository(connectionString, config.getUserName(), config.getPassword(), true);
    ValueFactory valueFactory = repository.getValueFactory();
    if (config.getGraph() != null)
        graph = valueFactory.createURI(config.getGraph());
    if (config.getSubject() != null)
        subject = valueFactory.createURI(config.getSubject());
    if (config.getPredicate() != null)
        predicate = valueFactory.createURI(config.getPredicate());
}
 
开发者ID:nvdk,项目名称:ods-lodms-plugins,代码行数:13,代码来源:VirtuosoExtractor.java


示例7: ValueLoader

import virtuoso.sesame2.driver.VirtuosoRepository; //导入依赖的package包/类
public ValueLoader(String host, String port, String user, String pwd) {
    String connectionString = "jdbc:virtuoso://" + host + ':' + port;
    repository = new VirtuosoRepository(connectionString, user, pwd, true);
    try {
        RepositoryConnection con = repository.getConnection();
        con.close();
    } catch (RepositoryException e) {
        throw new IllegalArgumentException(e.getMessage(),e);
    }
}
 
开发者ID:nvdk,项目名称:ods-lodms-plugins,代码行数:11,代码来源:ValueLoader.java


示例8: VirtuosoTripleStore

import virtuoso.sesame2.driver.VirtuosoRepository; //导入依赖的package包/类
/**
 * Creates a new instance based the supplied complete set of configuration properties.
 * 
 * @param fileSystem
 *            the file system where to store the marker file
 * @param host
 *            the name / IP address of the host where virtuoso is running; if null defaults to
 *            localhost
 * @param port
 *            the port Virtuoso is listening to; if null defaults to 1111
 * @param username
 *            the username to login into Virtuoso; if null defaults to dba
 * @param password
 *            the password to login into Virtuoso; if null default to dba
 * @param pooling
 *            true if connection pooling should be used (impact on performances is
 *            negligible); if null defaults to false
 * @param batchSize
 *            the number of added/removed triples to buffer on the client before sending them
 *            to Virtuoso as a single chunk; if null defaults to 5000
 * @param fetchSize
 *            the number of results (solutions, triples, ...) to fetch from Virtuoso in a
 *            single operation when query results are iterated; if null defaults to 200
 * @param markerFilename
 *            the name of the marker file created to signal Virtuoso is being used in a
 *            non-transactional mode; if null defaults to virtuoso.bulk.transaction
 */
public VirtuosoTripleStore(final FileSystem fileSystem, @Nullable final String host,
        @Nullable final Integer port, @Nullable final String username,
        @Nullable final String password, @Nullable final Boolean pooling,
        @Nullable final Integer batchSize, @Nullable final Integer fetchSize,
        @Nullable final String markerFilename) {

    // Apply default values
    final String actualMarkerFilename = MoreObjects.firstNonNull(markerFilename,
            DEFAULT_MARKER_FILENAME);
    final String actualHost = MoreObjects.firstNonNull(host, DEFAULT_HOST);
    final int actualPort = MoreObjects.firstNonNull(port, DEFAULT_PORT);
    final String actualUsername = MoreObjects.firstNonNull(username, DEFAULT_USERNAME);
    final String actualPassword = MoreObjects.firstNonNull(password, DEFAULT_PASSWORD);
    final boolean actualPooling = MoreObjects.firstNonNull(pooling, DEFAULT_POOLING);
    final int actualBatchSize = MoreObjects.firstNonNull(batchSize, DEFAULT_BATCH_SIZE);
    final int actualFetchSize = MoreObjects.firstNonNull(fetchSize, DEFAULT_FETCH_SIZE);

    // Check parameters
    Preconditions.checkArgument(actualPort > 0 && actualPort < 65536);
    Preconditions.checkArgument(actualBatchSize > 0);
    Preconditions.checkArgument(actualFetchSize > 0);

    // Instantiate the VirtuosoRepository
    if (actualPooling) {
        // Pooling (see http://docs.openlinksw.com/virtuoso/VirtuosoDriverJDBC.html, section
        // 7.4.4.2) doesn't seem to affect performances. We keep this implementation: perhaps
        // things may change with future versions of Virtuoso.
        final VirtuosoConnectionPoolDataSource source = new VirtuosoConnectionPoolDataSource();
        source.setServerName(actualHost);
        source.setPortNumber(actualPort);
        source.setUser(actualUsername);
        source.setPassword(actualPassword);
        this.virtuoso = new VirtuosoRepository((ConnectionPoolDataSource) source,
                "sesame:nil", true);
    } else {
        final String url = String.format("jdbc:virtuoso://%s:%d", actualHost, actualPort);
        this.virtuoso = new VirtuosoRepository(url, actualUsername, actualPassword,
                "sesame:nil", true);
    }

    // Further configure the VirtuosoRepository
    this.virtuoso.setBatchSize(actualBatchSize);
    this.virtuoso.setFetchSize(actualFetchSize);

    // Setup marker variables
    this.fileSystem = Preconditions.checkNotNull(fileSystem);
    this.markerPath = new Path(actualMarkerFilename).makeQualified(fileSystem);

    // Log relevant information
    LOGGER.info("VirtuosoTripleStore URL: {}", actualHost + ":" + actualPort);
    LOGGER.info("VirtuosoTripleStore marker: {}", this.markerPath);
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:80,代码来源:VirtuosoTripleStore.java


示例9: getVirtuoso

import virtuoso.sesame2.driver.VirtuosoRepository; //导入依赖的package包/类
VirtuosoRepository getVirtuoso() {
    return this.virtuoso;
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:4,代码来源:VirtuosoTripleStore.java



注:本文中的virtuoso.sesame2.driver.VirtuosoRepository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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