private void writeIRI(IRI iri) throws IOException { NTriplesUtil.append(iri, writer); }
private void writeIRI(IRI iri) throws IOException { NTriplesUtil.append(iri, writer); }
public static void append(Resource resource, Appendable appendable) throws IOException { if (resource instanceof IRI) { append((IRI)resource, appendable); } else if (resource instanceof BNode) { append((BNode)resource, appendable); } else { throw new IllegalArgumentException("Unknown resource type: " + resource.getClass()); } }
public static void append(Resource resource, Appendable appendable) throws IOException { if (resource instanceof IRI) { append((IRI)resource, appendable); } else if (resource instanceof BNode) { append((BNode)resource, appendable); } else { throw new IllegalArgumentException("Unknown resource type: " + resource.getClass()); } }
/** * Appends the N-Triples representation of the given {@link Value} to the given {@link Appendable}, * optionally not serialising the datatype a {@link Literal} with the xsd:string datatype as it is implied * for RDF-1.1. * * @param value * The value to write. * @param appendable * The object to append to. * @param xsdStringToPlainLiteral * True to omit serialising the xsd:string datatype and false to always serialise the datatype for * literals. * @throws IOException */ public static void append(Value value, Appendable appendable, boolean xsdStringToPlainLiteral, boolean escapeUnicode) throws IOException { if (value instanceof Resource) { append((Resource)value, appendable); } else if (value instanceof Literal) { append((Literal)value, appendable, xsdStringToPlainLiteral); } else { throw new IllegalArgumentException("Unknown value type: " + value.getClass()); } }
/** * Appends the N-Triples representation of the given {@link Value} to the given {@link Appendable}, * optionally not serialising the datatype a {@link Literal} with the xsd:string datatype as it is implied * for RDF-1.1. * * @param value * The value to write. * @param appendable * The object to append to. * @param xsdStringToPlainLiteral * True to omit serialising the xsd:string datatype and false to always serialise the datatype for * literals. * @throws IOException */ public static void append(Value value, Appendable appendable, boolean xsdStringToPlainLiteral, boolean escapeUnicode) throws IOException { if (value instanceof Resource) { append((Resource)value, appendable); } else if (value instanceof Literal) { append((Literal)value, appendable, xsdStringToPlainLiteral); } else { throw new IllegalArgumentException("Unknown value type: " + value.getClass()); } }
public static void append(Literal lit, Appendable appendable) throws IOException { // default to false. Users must call new method directly to remove // xsd:string append(lit, appendable, BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL.getDefaultValue()); }
public static void append(Literal lit, Appendable appendable) throws IOException { // default to false. Users must call new method directly to remove // xsd:string append(lit, appendable, BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL.getDefaultValue()); }
/** * Creates an N-Triples string for the supplied literal, optionally ignoring the xsd:string datatype as it * is implied for RDF-1.1. * * @param lit * The literal to write. * @param xsdStringToPlainLiteral * True to omit serialising the xsd:string datatype and false to always serialise the datatype for * literals. */ public static String toNTriplesString(Literal lit, boolean xsdStringToPlainLiteral) { try { StringBuilder sb = new StringBuilder(); append(lit, sb, xsdStringToPlainLiteral); return sb.toString(); } catch (IOException e) { throw new AssertionError(); } }
/** * Creates an N-Triples string for the supplied bNode. */ public static String toNTriplesString(BNode bNode) { try { StringBuilder result = new StringBuilder(bNode.getID().length() + 1); append(bNode, result); return result.toString(); } catch (IOException e) { throw new RuntimeException("Should not receive IOException with StringBuilder", e); } }
/** * Creates an N-Triples string for the supplied bNode. */ public static String toNTriplesString(BNode bNode) { try { StringBuilder result = new StringBuilder(bNode.getID().length() + 1); append(bNode, result); return result.toString(); } catch (IOException e) { throw new RuntimeException("Should not receive IOException with StringBuilder", e); } }
/** * Creates an N-Triples string for the supplied literal, optionally ignoring the xsd:string datatype as it * is implied for RDF-1.1. * * @param lit * The literal to write. * @param xsdStringToPlainLiteral * True to omit serialising the xsd:string datatype and false to always serialise the datatype for * literals. */ public static String toNTriplesString(Literal lit, boolean xsdStringToPlainLiteral) { try { StringBuilder sb = new StringBuilder(); append(lit, sb, xsdStringToPlainLiteral); return sb.toString(); } catch (IOException e) { throw new AssertionError(); } }
public static void append(Value value, Appendable appendable) throws IOException { // default to false. Users must call new method directly to remove // xsd:string append(value, appendable, BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL.getDefaultValue(), NTriplesWriterSettings.ESCAPE_UNICODE.getDefaultValue()); }
public static void append(Value value, Appendable appendable) throws IOException { // default to false. Users must call new method directly to remove // xsd:string append(value, appendable, BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL.getDefaultValue(), NTriplesWriterSettings.ESCAPE_UNICODE.getDefaultValue()); }
if (!ignoreDatatype) { appendable.append("^^"); append(lit.getDatatype(), appendable);
if (!ignoreDatatype) { appendable.append("^^"); append(lit.getDatatype(), appendable);