use of org.apache.jena.shex.parser.javacc.ParseException in project jena by apache.
the class ShExC method parseShapeMap$.
private static ShexMap parseShapeMap$(ShExJavacc parser, String baseURI, Context context) {
ParserProfile profile = new ParserProfileStd(RiotLib.factoryRDF(), ErrorHandlerFactory.errorHandlerStd, IRIxResolver.create(baseURI).build(), PrefixMapFactory.create(), context, false, false);
// addStandardPrefixes(profile.getPrefixMap());
parser.setProfile(profile);
// We don't use the StreamRDF.
parser.setDest(StreamRDFLib.sinkNull());
try {
parser.parseShapeMapStart();
parser.UnitShapeMap();
ShexMap map = parser.parseShapeMapFinish();
return map;
} catch (ParseException ex) {
throw new ShexParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
} catch (TokenMgrError tErr) {
int col = parser.token.endColumn;
int line = parser.token.endLine;
throw new ShexParseException(tErr.getMessage(), line, col);
}
}
use of org.apache.jena.shex.parser.javacc.ParseException in project jena by apache.
the class ShExC method parse$.
// --------
private static ShexSchema parse$(ShExJavacc parser, String sourceURI, String baseURI, Context context) {
ParserProfile profile = new ParserProfileStd(RiotLib.factoryRDF(), ErrorHandlerFactory.errorHandlerStd, IRIxResolver.create(baseURI).build(), PrefixMapFactory.create(), context, false, false);
// addStandardPrefixes(profile.getPrefixMap());
sourceURI = IRILib.filenameToIRI(sourceURI);
parser.setProfile(profile);
// We don't use the StreamRDF.
parser.setDest(StreamRDFLib.sinkNull());
parser.setSourceAndBase(sourceURI, baseURI);
try {
parser.parseShapesStart();
parser.UnitShapes();
ShexSchema shapes = parser.parseShapesFinish();
validatePhase2(shapes);
return shapes;
} catch (ParseException ex) {
throw new ShexParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
} catch (TokenMgrError tErr) {
int col = parser.token.endColumn;
int line = parser.token.endLine;
throw new ShexParseException(tErr.getMessage(), line, col);
}
}
Aggregations