当前位置: 首页>>代码示例>>Java>>正文


Java Repository.initialize方法代码示例

本文整理汇总了Java中org.openrdf.repository.Repository.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java Repository.initialize方法的具体用法?Java Repository.initialize怎么用?Java Repository.initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.repository.Repository的用法示例。


在下文中一共展示了Repository.initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
	Repository fromrepo = new SailRepository( new MemoryStore() );
	Repository torepo = new SailRepository( new MemoryStore() );

	fromrepo.initialize();
	torepo.initialize();

	from = fromrepo.getConnection();
	to = torepo.getConnection();

	from.add( new StatementImpl( RDFS.DOMAIN, RDFS.LABEL,
			new LiteralImpl( "test" ) ) );
	from.add( new StatementImpl( RDFS.DOMAIN, RDFS.LABEL,
			new LiteralImpl( "test2" ) ) );
	from.setNamespace( OWL.PREFIX, OWL.NAMESPACE );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:18,代码来源:RepositoryCopierTest.java

示例2: testUpdateDate2

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testUpdateDate2() throws Exception {
	Repository repo = new SailRepository( new MemoryStore() );
	repo.initialize();
	RepositoryConnection rc = repo.getConnection();
	
	URI base = Utility.getUniqueUri();
	Date now = new Date();
	rc.add( new StatementImpl( base, MetadataConstants.DCT_MODIFIED,
			rc.getValueFactory().createLiteral( now ) ) );

	AbstractSesameEngine.updateLastModifiedDate( rc, null );

	List<Statement> stmts = Iterations.asList( eng.getRawConnection().
			getStatements( eng.getBaseUri(), MetadataConstants.DCT_MODIFIED,
					null, false ) );
	Literal val = Literal.class.cast( stmts.get( 0 ).getObject() );
	Date upd = getDate( val.calendarValue() );

	rc.close();
	repo.shutDown();

	// the 100 is to remove the ms, which aren't always the same because
	// they're not stored in the RDF
	assertEquals( now.getTime(), upd.getTime(), 100 );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:27,代码来源:InMemorySesameEngineTest.java

示例3: testAddStatement

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Ignore
@Test
public void testAddStatement() throws Exception {
    SailRepositoryFactory f = new SailRepositoryFactory();
    Repository r = f.getRepository(getConfig());
    r.initialize();
    RepositoryConnection rc = r.getConnection();

    ValueFactory vf = rc.getValueFactory();
    Statement s = vf.createStatement(vf.createURI("u:a"), vf.createURI("u:b"), vf.createURI("u:c"));

    assertFalse(rc.hasStatement(s, false));

    rc.add(s);

    Assert.assertTrue(rc.hasStatement(s, false));
    rc.close();
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:19,代码来源:RyaAccumuloSailFactoryTest.java

示例4: testGetRepository

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testGetRepository() throws Exception {
    MarkLogicRepositoryConfig config = new MarkLogicRepositoryConfig();
    config.setHost(host);
    config.setPort(port);
    config.setUser(adminUser);
    config.setPassword(adminPassword);
    config.setAuth("DIGEST");

    RepositoryFactory factory = new MarkLogicRepositoryFactory();
    Assert.assertEquals("marklogic:MarkLogicRepository", factory.getRepositoryType());

    Repository repo = factory.getRepository(config);
    repo.initialize();
    Assert.assertTrue(repo.getConnection() instanceof MarkLogicRepositoryConnection);

    Repository otherrepo = factory.getRepository(config);
    otherrepo.initialize();
    RepositoryConnection oconn = otherrepo.getConnection();
    Assert.assertTrue(oconn instanceof MarkLogicRepositoryConnection);
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:22,代码来源:MarkLogicRepositoryFactoryTest.java

示例5: createRc

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Override
protected void createRc( Properties props ) throws RepositoryException {
	String url = props.getProperty( REPOSITORY_KEY );
	insightsloc = props.getProperty( INSIGHTS_KEY );

	boolean remote = Boolean.parseBoolean( props.getProperty( REMOTE_KEY,
			Boolean.FALSE.toString() ) );
	if ( remote ) {
		setProperty( Constants.SMSS_LOCATION, url );
	}

	Repository repo = getRawRepository( url );
	repo.initialize();
	data = repo.getConnection();
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:16,代码来源:SesameEngine.java

示例6: createRc

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Override
protected final void createRc( Properties p ) {
	if ( null != rc ) {
		// we've already have our rc created, so there's nothing to do here
		return;
	}

	Security.getSecurity().associateUser( this, new LocalUserImpl() );

	MemoryStore memstore = ( p.containsKey( MEMSTORE_DIR )
			? new MemoryStore( new File( p.getProperty( MEMSTORE_DIR ) ) )
			: new MemoryStore() );

	if ( p.containsKey( SYNC_DELAY ) ) {
		memstore.setSyncDelay( Long.parseLong( p.getProperty( SYNC_DELAY ) ) );
	}

	Sail sail = ( p.containsKey( INFER )
			? new ForwardChainingRDFSInferencer( memstore )
			: memstore );

	Repository repo = new SailRepository( sail );

	try {
		repo.initialize();
		rc = repo.getConnection();
	}
	catch ( Exception e ) {
		try {
			repo.shutDown();
		}
		catch ( Exception ex ) {
			log.error( ex, ex );
		}
	}

	setRepositoryConnection( rc, true );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:39,代码来源:InMemorySesameEngine.java

示例7: testCreateFromRepository

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testCreateFromRepository() throws Exception {
	Repository repo = new SailRepository( new MemoryStore() );
	repo.initialize();
	RepositoryConnection rc = repo.getConnection();
	rc.add( SRCFILE, null, RDFFormat.TURTLE );
	rc.commit();
	rc.close();

	InsightManager imi = InsightManagerImpl.createFromRepository( repo );
	repo.shutDown();

	assertEquals( 1, imi.getPerspectives().size() );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:15,代码来源:InsightManagerImplTest.java

示例8: createRepository

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
private ObjectRepository createRepository() throws Exception {
	Sail sail = new MemoryStore();
	sail = new AuditingSail(sail);
	Repository repo = new OptimisticRepository(sail);
	repo.initialize();
	ObjectRepositoryFactory factory = new ObjectRepositoryFactory();
	return factory.createRepository(config, repo);
}
 
开发者ID:mowjoothfm,项目名称:persistenturls,代码行数:9,代码来源:MirrorPURLTest.java

示例9: main

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
public static void main(String[] args) throws OpenRDFException, IOException {
	
	final Repository repo = createRepository();
	
	registerCustomFunction(repo);
		
	try{
		repo.initialize();
		
		/*
		 * Load data from resources 
		 * src/main/resources/data.n3
		 */

		Utils.loadDataFromResources(repo, "data.n3", "");
										
		final TupleQueryResult result = Utils.executeSelectQuery(repo, QUERY, QueryLanguage.SPARQL);
		
		try {
			while(result.hasNext()){
				
				BindingSet bs = result.next();
				log.info(bs);
				
			}
		} finally {
			result.close();
		}
	} finally {
		repo.shutDown();
	}
}
 
开发者ID:blazegraph,项目名称:blazegraph-samples,代码行数:33,代码来源:SampleBlazegraphCustomFunctionEmbedded.java

示例10: testRDFSPlusInversesInferencer

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testRDFSPlusInversesInferencer() throws RepositoryException {
	// create a Sail stack
	Sail sail = new MemoryStore();
	sail = new ForwardChainingRDFSPlusInverseInferencer(sail);

	// create a Repository
	Repository repository = new SailRepository(sail);
	try {
		repository.initialize();
	} catch (RepositoryException e) {
		throw new RuntimeException(e);
	}

	URI a = new URIImpl("urn:test:a");
	URI b = new URIImpl("urn:test:b");
	URI c = new URIImpl("urn:test:c");
	URI d = new URIImpl("urn:test:d");
	URI nrlInverse = ForwardChainingRDFSPlusInverseInferencerConnection.NRL_InverseProperty;

	repository.getConnection().add(a, b, c, new Resource[0]);

	Assert.assertFalse(repository.getConnection().hasStatement(c, d, a,
			true, new Resource[0]));

	repository.getConnection().add(b, nrlInverse, d, new Resource[0]);

	Assert.assertTrue(repository.getConnection().hasStatement(c, d, a,
			true, new Resource[0]));

}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:32,代码来源:TestRDFSInverseInferencer.java

示例11: negativeTestRepo2

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void negativeTestRepo2()
        throws Exception {

    Repository rep = new MarkLogicRepository(host, port, user, password, "DIGEST");
    rep.initialize();
    rep.shutDown();

    // should throw error as we shutdown repo
    exception.expect(RepositoryException.class);
    exception.expectMessage("MarkLogicRepository not initialized.");
    @SuppressWarnings("unused")
    RepositoryConnection conn = rep.getConnection();
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:15,代码来源:MarkLogicRepositoryTest.java

示例12: testRepo

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testRepo()
        throws Exception {

    Repository rep = new MarkLogicRepository(host, port, user, password, "DIGEST");
    rep.initialize();
    rep.shutDown();

    rep.initialize();
    Assert.assertTrue(rep.getDataDir() == null);
    Assert.assertTrue(rep.isWritable());
    Assert.assertTrue(rep.getValueFactory() instanceof ValueFactoryImpl);
    Assert.assertTrue(rep.getConnection() instanceof MarkLogicRepositoryConnection);
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:15,代码来源:MarkLogicRepositoryTest.java

示例13: TestRepoWithJavaAPIClientDatabaseClient

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void TestRepoWithJavaAPIClientDatabaseClient()
        throws Exception {
    DatabaseClient databaseClient = DatabaseClientFactory.newClient(host, port, user, password, DatabaseClientFactory.Authentication.valueOf("DIGEST"));
    Repository rep = new MarkLogicRepository(databaseClient);
    rep.initialize();
    Assert.assertTrue(rep instanceof Repository);
    RepositoryConnection conn = rep.getConnection();
    Assert.assertTrue(conn instanceof RepositoryConnection);
    conn.close();
    rep.shutDown();
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:13,代码来源:MarkLogicRepositoryTest.java

示例14: testRemoveAll

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Override
@Test
public void testRemoveAll() throws Exception {
	Repository repo = new SailRepository(new MemoryStore());
	repo.initialize();
	RepositoryModelSet modelSet = new RepositoryModelSet(repo);
	modelSet.open();
	URI context1 = new URIImpl("uri:context1");
	URI context2 = new URIImpl("uri:context2");
	modelSet.addStatement(context1, new URIImpl("uri:r1"), new URIImpl(
			"uri:p1"), new URIImpl("uri:r2"));
	modelSet.addStatement(context1, new URIImpl("uri:r1"), new URIImpl(
			"uri:p1"), new URIImpl("uri:r3"));
	modelSet.addStatement(context2, new URIImpl("uri:r4"), new URIImpl(
			"uri:p2"), new URIImpl("uri:r5"));
	modelSet.addStatement(context2, new URIImpl("uri:r4"), new URIImpl(
			"uri:p2"), new URIImpl("uri:r6"));
	Model model1 = modelSet.getModel(context1);
	model1.open();
	Model model2 = modelSet.getModel(context2);
	model2.open();
	assertEquals(4, modelSet.size());
	assertEquals(2, model1.size());
	assertEquals(2, model2.size());

	model2.removeAll();

	assertEquals(2, modelSet.size());
	assertEquals(2, model1.size());
	assertEquals(0, model2.size());
	model1.close();
	model2.close();
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:34,代码来源:RepositoryModelTest.java

示例15: testNestedConnections

import org.openrdf.repository.Repository; //导入方法依赖的package包/类
@Test
public void testNestedConnections()
        throws OpenRDFException {

    MarkLogicRepositoryConfig config = new MarkLogicRepositoryConfig();
    config.setHost(host);
    config.setPort(port);
    config.setUser(user);
    config.setPassword(password);
    config.setAuth("DIGEST");

    MarkLogicRepositoryFactory FACTORY = new MarkLogicRepositoryFactory();

    ValueFactory vf = conn.getValueFactory();
    URI tommy = vf.createURI("http://marklogicsparql.com/id#4444");
    URI lname = vf.createURI("http://marklogicsparql.com/addressbook#lastName");
    Literal tommylname = vf.createLiteral("Ramone");
    Statement stmt = vf.createStatement(tommy, lname, tommylname);

    conn.add(stmt);

    conn.begin();

    Repository repo2 = FACTORY.getRepository(config);
    repo2.initialize();
    RepositoryConnection conn2 = repo2.getConnection();

    conn2.begin();
    Assert.assertEquals("The size of repository must be zero", 1, conn.size());
    conn2.commit();

    conn2.close();
    repo2.shutDown();

    conn.commit();

}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:38,代码来源:MarkLogicRepositoryConnectionTest.java


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