use of org.apache.jena.shex.parser.ShexParseException in project jena by apache.
the class shex_parse method exec.
private void exec(String fn, boolean multipleFiles) {
ShexSchema shapes;
PrintStream out = System.out;
PrintStream err = System.err;
if (!FileOps.exists(fn)) {
err.println(fn + " : File not found");
return;
}
try {
shapes = Shex.readSchema(fn);
} catch (RiotException ex) {
/*ErrorHandler logged this */
return;
} catch (ShexParseException ex) {
if (multipleFiles)
err.println(fn + " : ");
err.println(ex.getMessage());
return;
}
boolean outputByPrev = false;
if (printText) {
outputByPrev = printText(out, err, shapes);
}
if (printCompact) {
if (outputByPrev) {
out.println("- - - - - - - - ");
outputByPrev = false;
}
outputByPrev = printCompact(out, err, shapes);
}
if (printRDF) {
if (outputByPrev) {
out.println("- - - - - - - - ");
outputByPrev = false;
}
outputByPrev = printRDF(out, err, shapes);
}
}
use of org.apache.jena.shex.parser.ShexParseException in project jena by apache.
the class RunnerShexBadSyntax method fileBadSyntax.
public static ShexSchema fileBadSyntax(String filename) {
String str = IO.readWholeFileAsUTF8(filename);
InputStream input = new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8));
try {
ShexSchema shapes = ShExC.parse(input, filename, null);
// Should not get here.
System.out.print("-- ");
System.out.println(FileOps.basename(filename));
System.out.println(str);
fail("Parsed negative syntax test");
return shapes;
} catch (ShexParseException ex) {
return null;
}
}
Aggregations