NTriplesUtil { public static Triple parseTriple(String nTriplesTriple, ValueFactory valueFactory) { TripleMatch tm = parseTripleInternal(nTriplesTriple, valueFactory); if (tm.length != nTriplesTriple.length()) { throw new IllegalArgumentException("Not a valid N-Triples triple: " + nTriplesTriple); } return tm.triple; }  static Value parseValue(String nTriplesValue, ValueFactory valueFactory); static Resource parseResource(String nTriplesResource, ValueFactory valueFactory); static IRI parseURI(String nTriplesURI, ValueFactory valueFactory); static BNode parseBNode(String nTriplesBNode, ValueFactory valueFactory); static Literal parseLiteral(String nTriplesLiteral, ValueFactory valueFactory); static Triple parseTriple(String nTriplesTriple, ValueFactory valueFactory); static String toNTriplesString(Value value); static String toNTriplesString(Value value, boolean xsdStringToPlainLiteral); static void append(Value value, Appendable appendable); static void append(Value value, Appendable appendable, boolean xsdStringToPlainLiteral,
			boolean escapeUnicode); static String toNTriplesString(Resource resource); static void append(Resource resource, Appendable appendable); static String toNTriplesString(IRI uri); static void append(IRI uri, Appendable appendable); static void append(IRI uri, Appendable appendable, boolean escapeUnicode); static String toNTriplesString(BNode bNode); static void append(BNode bNode, Appendable appendable); static String toNTriplesString(Literal lit); static String toNTriplesString(Literal lit, boolean xsdStringToPlainLiteral); static void append(Literal lit, Appendable appendable); static void append(Literal lit, Appendable appendable, boolean xsdStringToPlainLiteral,
			boolean escapeUnicode); static String toNTriplesString(Triple triple); static void append(Triple triple, Appendable appendable); @Deprecated static boolean isLetterOrNumber(int c); @Deprecated static boolean isLetter(int c); @Deprecated static boolean isNumber(int c); static boolean isValidCharacterForBNodeLabel(int c); static boolean isLiberalCharactersButNotDot(int c); static boolean isUnderscore(int c); static boolean isDot(int c); static String escapeString(String label); static void escapeString(String label, Appendable appendable); static void escapeString(String label, Appendable appendable, boolean escapeUnicode); static String unescapeString(String s); static String toHexString(int decimal, int stringLength);  }
@Test public void testParseTriple() { String[] triples = new String[] { "<<<http: "<<http: "<< <http: "<<http: "<<<<_:bnode1foobar<urn:täst>\"literál за проба\"^^<urn:test\\u0444\\U00000444>>><http: "<<<<_:bnode1foobar urn:täst \"literál за проба\"^^<urn:testфф>>> http: "<< <<_:bnode1foobar<urn:täst> \"literál за проба\"^^<urn:test\\u0444\\U00000444> >> <http: "<<<<_:bnode1foobar urn:täst \"literál за проба\"^^<urn:testфф>>> http: "<<_:test_\uD800\uDC00_\uD840\uDC00_bnode <urn:x> <urn:y>>>", "<<_:test_\uD800\uDC00_\uD840\uDC00_bnode urn:x urn:y>>", "<<<<_:bnode1foobar<urn:täst>\"literál за проба\"^^<urn:test\\u0444\\U00000444><http: null, "<<<<_:bnode1foobar<urn:täst>\"literál за проба\"^^<urn:test\\u0444\\U00000444>>><http: null, "<<\"test\" <urn:test> \"test\">>", null, "<<<urn:test> _:test \"test\">>", null, "<<<urn:a> <<<urn:1> <urn:2> <urn:3>>> <urn:b>>>", null }; for (int i = 0; i < triples.length; i += 2) { parseTriple(triples[i], triples[i + 1], (t) -> NTriplesUtil.parseTriple(t, f)); parseTriple(triples[i], triples[i + 1], (t) -> (Triple) NTriplesUtil.parseValue(t, f)); parseTriple(triples[i], triples[i + 1], (t) -> (Triple) NTriplesUtil.parseResource(t, f)); } }