本文整理汇总了Java中org.openrdf.rio.turtle.TurtleWriter.handleStatement方法的典型用法代码示例。如果您正苦于以下问题:Java TurtleWriter.handleStatement方法的具体用法?Java TurtleWriter.handleStatement怎么用?Java TurtleWriter.handleStatement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.rio.turtle.TurtleWriter
的用法示例。
在下文中一共展示了TurtleWriter.handleStatement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ttlToStdout
import org.openrdf.rio.turtle.TurtleWriter; //导入方法依赖的package包/类
public static void ttlToStdout( Model model ) {
TurtleWriter tw = new TurtleWriter( System.out );
try {
tw.startRDF();
for ( Map.Entry<String, String> en : DEFAULTNAMESPACES.entrySet() ) {
tw.handleNamespace( en.getKey(), en.getValue() );
}
for ( Statement s : model ) {
tw.handleStatement( s );
}
tw.endRDF();
}
catch ( Exception e ) {
log.error( e, e );
}
}
示例2: formatChangeSet
import org.openrdf.rio.turtle.TurtleWriter; //导入方法依赖的package包/类
private String formatChangeSet(Graph changeSet) {
StringWriter sw = new StringWriter();
TurtleWriter turtleWriter = new TurtleWriter(sw);
try {
turtleWriter.startRDF();
Iterator<Statement> statementIterator = changeSet.iterator();
while (statementIterator.hasNext()) {
turtleWriter.handleStatement(statementIterator.next());
}
turtleWriter.endRDF();
}
catch (RDFHandlerException e) {
return "Could not format changeset";
}
return sw.toString();
}
示例3: testCreateStatements
import org.openrdf.rio.turtle.TurtleWriter; //导入方法依赖的package包/类
@Test
public void testCreateStatements() throws Exception {
InsightManagerImpl imi = new InsightManagerImpl();
EngineUtil2.createInsightStatements( SRCFILE, imi );
Collection<Statement> stmts
= InsightManagerImpl.getModel( imi, new LocalUserImpl() );
if ( log.isTraceEnabled() ) {
File tmpdir = FileUtils.getTempDirectory();
try ( Writer w = new BufferedWriter( new FileWriter( new File( tmpdir,
SRCFILE.getName() ) ) ) ) {
TurtleWriter tw = new TurtleWriter( w );
tw.startRDF();
tw.handleNamespace( SEMPERS.PREFIX, SEMPERS.NAMESPACE );
tw.handleNamespace( SEMONTO.PREFIX, SEMONTO.NAMESPACE );
tw.handleNamespace( SEMCORE.PREFIX, SEMCORE.NAMESPACE );
tw.handleNamespace( SPIN.PREFIX, SPIN.NAMESPACE );
tw.handleNamespace( SP.PREFIX, SP.NAMESPACE );
tw.handleNamespace( UI.PREFIX, UI.NAMESPACE );
tw.handleNamespace( RDFS.PREFIX, RDFS.NAMESPACE );
tw.handleNamespace( RDF.PREFIX, RDF.NAMESPACE );
tw.handleNamespace( OWL.PREFIX, OWL.NAMESPACE );
tw.handleNamespace( OLO.PREFIX, OLO.NAMESPACE );
tw.handleNamespace( DCTERMS.PREFIX, DCTERMS.NAMESPACE );
tw.handleNamespace( XMLSchema.PREFIX, XMLSchema.NAMESPACE );
for ( Statement s : stmts ) {
tw.handleStatement( s );
}
tw.endRDF();
}
}
assertEquals(48, stmts.size() );
}