/** * Creates a new writer using the given character space * * @param writer * Writer * @param charSpace * Character space */ public NTriplesWriter(Writer writer, CharSpace charSpace) { super(writer, new NodeFormatterNT(charSpace)); } }
protected void writeLiteralOneLine(AWriter w, String lex, String datatypeURI) { super.formatLitDT(w, lex, datatypeURI) ; }
@Override public void formatLitString(AWriter w, String lex) { writeEscaped(w, lex); }
public static String toNTriplesString(Node node) { NodeFormatterNT formatter = new NodeFormatterNT(); AWriter writer = new StringWriterI(); formatter.format(writer, node); String result = writer.toString(); return result; }
@Override public void formatLitDT(AWriter w, String lex, String datatypeURI) { writeEscaped(w, lex); w.print("^^"); formatURI(w, datatypeURI); } }
@Override public void formatURI(AWriter w, String uriStr) { Pair<String, String> pName = prefixMap.abbrev(uriStr) ; // Check if legal if ( pName != null ) { // Check legal - need to check its legal, not for illegal. // The splitter in "abbrev" only has a weak rule. String prefix = pName.getLeft() ; String localname = pName.getRight() ; if ( safePrefixName(prefix, localname) ) { w.print(prefix) ; w.print(':') ; w.print(localname) ; return ; } } // Attempt base abbreviation. if ( iriResolver != null ) { String x = abbrevByBase(uriStr) ; if ( x != null ) { w.print('<') ; w.print(x) ; w.print('>') ; return ; } } // else super.formatURI(w, uriStr) ; }
@Override public void formatLitDT(AWriter w, String lex, String datatypeURI) { writeEscaped(w, lex) ; w.print("^^") ; formatURI(w, datatypeURI) ; } }
super.formatURI(w, uriStr) ;
/** * Creates a new writer * * @param writer * Writer */ public NTriplesWriter(Writer writer) { super(writer, new NodeFormatterNT()); }
@Override public void formatLitString(AWriter w, String lex) { writeEscaped(w, lex) ; }
super.formatLitDT(w, lex, datatypeURI) ;
/** * Creates a new tuple writer using the default NTriples node formatter * * @param writer * Writer */ public AbstractLineBasedNodeTupleWriter(Writer writer) { this(writer, new NodeFormatterNT()); }
@Override public void formatLitLang(AWriter w, String lex, String langTag) { writeEscaped(w, lex); w.print('@'); w.print(langTag); }
/** * Creates a new writer using the given character space * * @param writer * Writer * @param charSpace * Character space */ public NQuadsWriter(Writer writer, CharSpace charSpace) { super(writer, new NodeFormatterNT(charSpace)); } }
@Override public void formatLitLang(AWriter w, String lex, String langTag) { writeEscaped(w, lex) ; w.print('@') ; w.print(langTag) ; }
/** * Creates a new writer * * @param writer * Writer * @param charSpace * Character space to use */ public NTriplesNodeWriter(Writer writer, CharSpace charSpace) { super(writer, new NodeFormatterNT(charSpace)); }
/** * Output tuples, choosing ASCII or UTF8 See * {@link StreamRDFLib#writer} for ways to create a AWriter object. */ public WriterStreamRDFPlain(AWriter w, CharSpace charSpace) { out = w ; nodeFmt = new NodeFormatterNT(charSpace) ; }
/** * Creates a new writer * * @param writer * Writer */ public NQuadsWriter(Writer writer) { super(writer, new NodeFormatterNT()); }
/** * Creates a new writer using the default NTriples node formatter * * @param writer * Writer */ public AbstractLineBasedQuadWriter(Writer writer) { this(writer, new NodeFormatterNT()); }
/** * Creates a new tuple writer using the default NTriples node formatter * * @param writer * Writer */ public AbstractNodeWriter(Writer writer) { this(writer, new NodeFormatterNT()); }