use of org.apache.jena.shacl.compact.reader.ShaclcParseException in project jena by apache.
the class shacl_parse method exec.
private void exec(String fn, boolean multipleFiles) {
Shapes shapes;
PrintStream out = System.out;
PrintStream err = System.err;
try {
Graph g = parseFile(fn);
shapes = Shapes.parse(g);
} catch (RiotException ex) {
/*ErrorHandler logged this */
return;
} catch (ShaclParseException | ShaclcParseException ex) {
// Errors parsing SHACL Compact Syntax.
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.shacl.compact.reader.ShaclcParseException in project jena by apache.
the class ShaclcParser method parse$.
private static void parse$(ShaclCompactParserJJ parser, StreamRDF stream, String baseURI, Context context) {
ParserProfile profile = new ParserProfileStd(RiotLib.factoryRDF(), ErrorHandlerFactory.errorHandlerStd, IRIxResolver.create(baseURI).build(), PrefixMapFactory.create(), context, false, false);
SHACLC.addStandardPrefixes(profile.getPrefixMap());
stream.start();
parser.setDest(stream);
parser.setProfile(profile);
parser.start();
try {
parser.Unit();
} catch (ParseException ex) {
throw new ShaclcParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
} catch (TokenMgrError tErr) {
int col = parser.token.endColumn;
int line = parser.token.endLine;
throw new ShaclcParseException(tErr.getMessage(), line, col);
}
parser.finish();
stream.finish();
}
Aggregations