use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class TestServiceSetup method testNumericTimeout.
@Test
public void testNumericTimeout() {
BasicPattern basicPattern = new BasicPattern();
basicPattern.add(Triple.ANY);
Node serviceNode = NodeFactory.createURI(SERVICE);
OpService opService = new OpService(serviceNode, new OpBGP(basicPattern), false);
Context context = new Context();
ARQ.setNormalMode(context);
context.set(Service.httpQueryTimeout, 10);
try {
Service.exec(opService, context);
Assert.fail("Expected QueryExceptionHTTP");
} catch (QueryExceptionHTTP expected) {
Throwable thrown = expected.getCause();
if (thrown instanceof SocketException || thrown instanceof HttpConnectTimeoutException || thrown instanceof UnknownHostException) {
// expected
} else {
Assert.fail(String.format("Expected SocketException or ConnectTimeoutException, instead got: %s %s", thrown.getClass().getName(), thrown.getMessage()));
}
}
}
use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class TestSPARQLStarParse method build.
private static Triple build(String string) {
Query query = parse(string);
Op op = Algebra.compile(query);
BasicPattern bgp = ((OpBGP) op).getPattern();
assertEquals(1, bgp.size());
Triple t = bgp.get(0);
return t;
}
use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class PathLib method flush.
private static Op flush(BasicPattern bp, Op op) {
if (bp == null || bp.isEmpty())
return op;
OpBGP opBGP = new OpBGP(bp);
op = OpSequence.create(op, opBGP);
return op;
}
use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class TestBlankNodeBinary method bNodeSPARQL_Query_2.
@Test
public void bNodeSPARQL_Query_2() {
String qs = "SELECT * { ?s ?p <_:BCD>}";
Query query = QueryFactory.create(qs);
Op op = Algebra.compile(query);
BasicPattern bp = ((OpBGP) op).getPattern();
Triple t = bp.get(0);
assertEquals("BCD", t.getObject().getBlankNodeLabel());
}
use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class tdbreorder method main.
public static void main(String... args) {
if (args.length != 2) {
System.err.println("Usage: PATTERN STATS");
System.exit(1);
}
LogCtl.enable(StatsMatcher.class);
LogCtl.enable(ReorderTransformationSubstitution.class);
if (args.length != 2) {
System.err.println("Usage: op stats");
System.exit(1);
}
String pattern = args[0];
String statsFile = args[1];
Op op = SSE.readOp(pattern);
BasicPattern bgp;
if (op instanceof OpQuadPattern) {
bgp = ((OpQuadPattern) op).getBasicPattern();
} else if (op instanceof OpBGP) {
bgp = ((OpBGP) op).getPattern();
} else {
System.err.println("Not a quad or triple pattern");
System.exit(2);
bgp = null;
}
ReorderTransformation reorder = chooseReorder(statsFile);
// ReorderTransformation reorder = ReorderLib.fixed() ;
BasicPattern bgp2 = reorder.reorder(bgp);
System.out.println();
print(bgp);
System.out.println();
System.out.println(" ======== >>>>>>>>");
print(bgp2);
System.out.println();
}
Aggregations