net.rootdev.javardfa.output
Class TurtleSink

java.lang.Object
  extended by net.rootdev.javardfa.output.NTripleSink
      extended by net.rootdev.javardfa.output.TurtleSink
All Implemented Interfaces:
StatementSink

public class TurtleSink
extends NTripleSink

A pretty ropey turtle serialiser. Advantages: streams, no dependencies.

Author:
pldms

Field Summary
 
Fields inherited from class net.rootdev.javardfa.output.NTripleSink
comments, out
 
Constructor Summary
TurtleSink(OutputStream os, String... comments)
           
TurtleSink(Writer writer, String... comments)
           
 
Method Summary
 void addLiteral(String subject, String predicate, String lex, String lang, String datatype)
          Add statement with a literal object.
 void addObject(String subject, String predicate, String object)
          Add statement with non-literal object.
protected  String enc(int codepoint)
           
 void end()
          Complete parsing
protected  String longenc(int codepoint)
           
 
Methods inherited from class net.rootdev.javardfa.output.NTripleSink
addPrefix, encode, quote, setBase, start, toLiteral, toNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurtleSink

public TurtleSink(OutputStream os,
                  String... comments)
           throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

TurtleSink

public TurtleSink(Writer writer,
                  String... comments)
Method Detail

end

public void end()
Description copied from interface: StatementSink
Complete parsing

Specified by:
end in interface StatementSink
Overrides:
end in class NTripleSink

addObject

public void addObject(String subject,
                      String predicate,
                      String object)
Description copied from interface: StatementSink
Add statement with non-literal object. Blank nodes begin with _:, variables with ?, otherwise IRI

Specified by:
addObject in interface StatementSink
Overrides:
addObject in class NTripleSink
Parameters:
subject - Subject of triple
predicate - Predicate
object - Object

addLiteral

public void addLiteral(String subject,
                       String predicate,
                       String lex,
                       String lang,
                       String datatype)
Description copied from interface: StatementSink
Add statement with a literal object. As above, blank nodes begin with _:, variables with ?, otherwise IRI

Specified by:
addLiteral in interface StatementSink
Overrides:
addLiteral in class NTripleSink
Parameters:
subject - Subject of triple
predicate - Predicate
lex - Lexical form
lang - Language (may be null)
datatype - Datatype IRI (may be null)

enc

protected final String enc(int codepoint)
Overrides:
enc in class NTripleSink

longenc

protected final String longenc(int codepoint)
Overrides:
longenc in class NTripleSink


Copyright © 2009-2012. All Rights Reserved.