net.rootdev.javardfa.output
Class RDFXMLSink

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

public class RDFXMLSink
extends Object
implements StatementSink

A pretty ropey RDF/XML serialiser. Advantages: streams, no dependencies.

Author:
pldms

Constructor Summary
RDFXMLSink(OutputStream os, 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.
 void addPrefix(String prefix, String uri)
          Add a prefix mapping.
 void end()
          Complete parsing
 void setBase(String base)
           
protected  String[] split(String predicate)
           
 void start()
          Begin parsing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RDFXMLSink

public RDFXMLSink(OutputStream os,
                  String... comments)
Method Detail

start

public void start()
Description copied from interface: StatementSink
Begin parsing

Specified by:
start in interface StatementSink

end

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

Specified by:
end in interface StatementSink

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
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
Parameters:
subject - Subject of triple
predicate - Predicate
lex - Lexical form
lang - Language (may be null)
datatype - Datatype IRI (may be null)

addPrefix

public void addPrefix(String prefix,
                      String uri)
Description copied from interface: StatementSink
Add a prefix mapping.

Specified by:
addPrefix in interface StatementSink

split

protected String[] split(String predicate)

setBase

public void setBase(String base)
Specified by:
setBase in interface StatementSink


Copyright © 2009-2012. All Rights Reserved.