當前位置: 首頁>>代碼示例>>Java>>正文


Java RepositoryConnection.export方法代碼示例

本文整理匯總了Java中org.openrdf.repository.RepositoryConnection.export方法的典型用法代碼示例。如果您正苦於以下問題:Java RepositoryConnection.export方法的具體用法?Java RepositoryConnection.export怎麽用?Java RepositoryConnection.export使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openrdf.repository.RepositoryConnection的用法示例。


在下文中一共展示了RepositoryConnection.export方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testTicket583

import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
@Test
public void testTicket583() throws Exception {
	RepositoryConnection rc = engine.getRawConnection();
	rc.add( TICKETBASE, null, RDFFormat.TURTLE );
	engine.setBuilders( UriBuilder.getBuilder( "http://example.org/ex1" ),
			UriBuilder.getBuilder( "http://foo.bar/model#" ) );

	EngineLoader el = new EngineLoader();
	el.loadToEngine( Arrays.asList( TICKET583 ), engine, false, null );
	el.release();

	if ( log.isTraceEnabled() ) {
		File tmpdir = FileUtils.getTempDirectory();
		try ( Writer w = new BufferedWriter( new FileWriter( new File( tmpdir,
				"ticket583.nt" ) ) ) ) {
			rc.export( new NTriplesWriter( w ) );
		}
	}

	compareData( rc, getExpectedGraph( TICKET583_EXP ),
			UriBuilder.getBuilder( "http://example.org/ex1" ),
			UriBuilder.getBuilder( "http://foo.bar/model#" ) );
}
 
開發者ID:Ostrich-Emulators,項目名稱:semtool,代碼行數:24,代碼來源:EngineLoaderTest.java

示例2: dumpRDF

import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
/**
 * dump RDF graph
 * 
 * @param out
 *            output stream for the serialization
 * @param outform
 *            the RDF serialization format for the dump
 * @return
 */
public void dumpRDF(OutputStream out, RDFFormat outform) {
	try {
		RepositoryConnection con = therepository.getConnection();
		try {
			RDFWriter w = Rio.createWriter(outform, out);
			con.export(w, new Resource[0]);
		} finally {
			con.close();
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:dvcama,項目名稱:resource-to-sparqlresult,代碼行數:23,代碼來源:SimpleGraph.java

示例3: merge

import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
/**
 * Copies all the data from the "from" repository to the "to" repository
 *
 * @param from the source of statements
 * @param to the destination of the statements
 * @param doData copy the data
 * @param doInsights copy the insights
 *
 * @throws RepositoryException
 */
public synchronized void merge( final IEngine from, final IEngine to,
		boolean doData, boolean doInsights ) throws RepositoryException {
	// this is a little complicated because we don't have a handle to either
	// repositoryconnection. 

	if ( doData ) {
		ModificationExecutor fromcopier = new ModificationExecutorAdapter() {

			@Override
			public void exec( final RepositoryConnection fromconn ) throws RepositoryException {

				final ModificationExecutor tocopier = new ModificationExecutorAdapter() {

					@Override
					public void exec( RepositoryConnection toconn ) throws RepositoryException {
						try {
							final RepositoryCopier copier = new RepositoryCopier( toconn );
							fromconn.export( copier );
						}
						catch ( RDFHandlerException e ) {
							log.error( e );
						}
					}
				};

				to.execute( tocopier );
			}

		};

		from.execute( fromcopier );
	}

	if ( doInsights ) {
		insightqueue.put( to,
				new InsightsImportConfig( from.getInsightManager(), false ) );
		notify();
	}
}
 
開發者ID:Ostrich-Emulators,項目名稱:semtool,代碼行數:50,代碼來源:EngineUtil.java


注:本文中的org.openrdf.repository.RepositoryConnection.export方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。