use of org.eclipse.rdf4j.rio.RDFParseException in project rdf4j by eclipse.
the class TriGParserCustomTest method testBadPname02.
@Test
public void testBadPname02() throws Exception {
try {
Rio.parse(new StringReader("@prefix : <http://example/> . {:a%2 :p :o .}"), "", RDFFormat.TRIG);
fail("Did not receive expected exception");
} catch (RDFParseException e) {
}
}
use of org.eclipse.rdf4j.rio.RDFParseException in project rdf4j by eclipse.
the class CustomTurtleParserTest method testSES2086PeriodEndingLocalNamesFailure3.
@Test
public void testSES2086PeriodEndingLocalNamesFailure3() throws Exception {
try {
Rio.parse(new StringReader("@prefix ns: <http://example.org/data/> . ns:1 a ns:Product ; ns:affects ns:4 , ns:16 , ns:uriWithDot. ; ns:title \"An example entity with uriWithDot as an object\" . "), "", RDFFormat.TURTLE);
fail("Did not receive an exception");
} catch (RDFParseException e) {
System.out.println(e.getMessage());
assertTrue(e.getMessage().contains("Expected an RDF value here, found ';'"));
}
}
use of org.eclipse.rdf4j.rio.RDFParseException in project rdf4j by eclipse.
the class CustomTurtleParserTest method testSES2086PeriodEndingLocalNamesFailure2.
@Test
public void testSES2086PeriodEndingLocalNamesFailure2() throws Exception {
try {
Rio.parse(new StringReader("@prefix ns: <http://example.org/data/> . ns:uriWithDot. a ns:Product ; ns:title \"An example subject ending with a dot.\" . "), "", RDFFormat.TURTLE);
fail("Did not receive an exception");
} catch (RDFParseException e) {
System.out.println(e.getMessage());
assertTrue(e.getMessage().contains("Illegal predicate value: \"\"^^<http://www.w3.org/2001/XMLSchema#integer>"));
}
}
use of org.eclipse.rdf4j.rio.RDFParseException in project rdf4j by eclipse.
the class CustomTurtleParserTest method test780IRISpace.
@Test
public void test780IRISpace() throws Exception {
String ttl = "_:b25978837 a <http://purl.bioontology.org/ontology/UATC/\\u0020SERINE\\u0020\\u0020> .";
try {
Rio.parse(new StringReader(ttl), "", RDFFormat.TURTLE);
fail();
} catch (RDFParseException e) {
// Invalid IRI
}
Model model = Rio.parse(new StringReader(ttl), "", RDFFormat.TURTLE, new ParserConfig().set(BasicParserSettings.VERIFY_URI_SYNTAX, false), SimpleValueFactory.getInstance(), new ParseErrorLogger());
assertEquals(1, model.size());
model.filter(null, RDF.TYPE, null).objects().forEach(obj -> assertEquals("http://purl.bioontology.org/ontology/UATC/%20SERINE%20%20", obj.stringValue()));
}
use of org.eclipse.rdf4j.rio.RDFParseException in project rdf4j by eclipse.
the class CustomTurtleParserTest method testSES2086PeriodEndingLocalNamesFailure4.
@Test
public void testSES2086PeriodEndingLocalNamesFailure4() throws Exception {
try {
Rio.parse(new StringReader("@prefix ns: <http://example.org/data/> . ns:1 a ns:uriWithDot. ; ns:title \"An example entity with uriWithDot as an object\" . "), "", RDFFormat.TURTLE);
fail("Did not receive an exception");
} catch (RDFParseException e) {
System.out.println(e.getMessage());
assertTrue(e.getMessage().contains("Expected an RDF value here, found ';'"));
}
}
Aggregations