本文整理匯總了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#" ) );
}
示例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();
}
}
示例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();
}
}