本文整理汇总了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();
}
}