use of org.apache.jena.sparql.sse.SSE_ParseException in project jena by apache.
the class SerializationTest method runTestWorker.
protected void runTestWorker(Query query, Syntax syntax) {
IndentedLineBuffer buff = new IndentedLineBuffer();
query.serialize(buff, syntax);
String baseURI = null;
if (!query.explicitlySetBaseURI())
// Not in query - use the same one (e.g. file read from) .
baseURI = query.getBaseURI();
try {
QueryUtils.checkParse(query);
} catch (RuntimeException ex) {
System.err.println("**** Test: " + testEntry.getName());
System.err.println("** " + ex.getMessage());
System.err.println(query);
throw ex;
}
try {
QueryUtils.checkOp(query, true);
} catch (SSE_ParseException ex) {
System.err.println("**** Test: " + testEntry.getName());
System.err.println("** Algebra error: " + ex.getMessage());
}
}
use of org.apache.jena.sparql.sse.SSE_ParseException in project jena by apache.
the class SSE_Parser method parse$.
private static void parse$(Reader reader, ParseHandler handler, ParserEntry parserStep) {
SSE_ParserCore p = new SSE_ParserCore(reader);
p.setHandler(handler);
try {
parserStep.entry(p);
// EOF checking done within the parser.
} catch (ParseException ex) {
throw new SSE_ParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
} catch (TokenMgrError tErr) {
// Last valid token : not the same as token error message - but this should not happen
int col = p.token.endColumn;
int line = p.token.endLine;
throw new SSE_ParseException(tErr.getMessage(), line, col);
}
}
use of org.apache.jena.sparql.sse.SSE_ParseException in project jena by apache.
the class TDB2StorageBuilder method chooseReorderTransformation.
public static ReorderTransformation chooseReorderTransformation(Location location) {
if (location == null)
return ReorderLib.identity();
ReorderTransformation reorder = null;
if (location.exists(Names.optStats)) {
try {
reorder = ReorderLib.weighted(location.getPath(Names.optStats));
log.debug("Statistics-based BGP optimizer");
} catch (SSE_ParseException ex) {
log.warn("Error in stats file: " + ex.getMessage());
reorder = null;
}
}
if (reorder == null && location.exists(Names.optFixed)) {
reorder = ReorderLib.fixed();
log.debug("Fixed pattern BGP optimizer");
}
if (location.exists(Names.optNone)) {
reorder = ReorderLib.identity();
log.debug("Optimizer explicitly turned off");
}
if (reorder == null)
reorder = SystemTDB.getDefaultReorderTransform();
if (reorder == null && warnAboutOptimizer)
ARQ.getExecLogger().warn("No BGP optimizer");
return reorder;
}
use of org.apache.jena.sparql.sse.SSE_ParseException in project jena by apache.
the class DatasetBuilderStd method chooseOptimizer.
public static ReorderTransformation chooseOptimizer(Location location) {
if (location == null)
return ReorderLib.identity();
ReorderTransformation reorder = null;
if (location.exists(Names.optStats)) {
try {
reorder = ReorderLib.weighted(location.getPath(Names.optStats));
} catch (SSE_ParseException ex) {
log.warn("Error in stats file: " + ex.getMessage());
reorder = null;
}
}
if (reorder == null && location.exists(Names.optFixed)) {
// Not as good but better than nothing.
reorder = ReorderLib.fixed();
log.debug("Fixed pattern BGP optimizer");
}
if (location.exists(Names.optNone)) {
reorder = ReorderLib.identity();
log.debug("Optimizer explicitly turned off");
}
if (reorder == null)
reorder = SystemTDB.defaultReorderTransform;
if (reorder == null && warnAboutOptimizer)
ARQ.getExecLogger().warn("No BGP optimizer");
return reorder;
}
use of org.apache.jena.sparql.sse.SSE_ParseException in project jena by apache.
the class NodecLib method decode.
private static /*public*/
Node decode(String s, PrefixMapping pmap) {
if (s.startsWith("_:")) {
s = s.substring(2);
return NodeFactory.createBlankNode(s);
}
if (s.startsWith("<")) {
s = s.substring(1, s.length() - 1);
s = StrUtils.decodeHex(s, MarkerChar);
return NodeFactory.createURI(s);
}
try {
// SSE invocation is expensive (??).
// Try TokenizerText?
// Use for literals only.
Node n = SSE.parseNode(s, pmap);
return n;
} catch (SSE_ParseException ex) {
Log.error(NodeLib.class, "decode: Failed to parse: " + s);
throw ex;
}
}
Aggregations