Search in sources :

Example 6 with OpService

use of org.apache.jena.sparql.algebra.op.OpService in project jena by apache.

the class TestService method service_exec_2.

@Test
public void service_exec_2() {
    OpService op = makeOpElt(env);
    QueryIterator qIter = Service.exec(op, new Context());
    assertNotNull(qIter);
}
Also used : Context(org.apache.jena.sparql.util.Context) QueryIterator(org.apache.jena.sparql.engine.QueryIterator) OpService(org.apache.jena.sparql.algebra.op.OpService) EnvTest(org.apache.jena.test.conn.EnvTest) Test(org.junit.Test)

Example 7 with OpService

use of org.apache.jena.sparql.algebra.op.OpService in project jena by apache.

the class TestService method service_exec_3.

@Test
public void service_exec_3() {
    DatasetGraph dsg = env.dsg();
    dsg.executeWrite(() -> dsg.add(SSE.parseQuad("(_ :s :p :o)")));
    OpService op = makeOpElt(env);
    QueryIterator qIter = Service.exec(op, new Context());
    assertNotNull(qIter);
    assertTrue(qIter.hasNext());
    qIter.next();
    assertFalse(qIter.hasNext());
}
Also used : Context(org.apache.jena.sparql.util.Context) QueryIterator(org.apache.jena.sparql.engine.QueryIterator) OpService(org.apache.jena.sparql.algebra.op.OpService) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) EnvTest(org.apache.jena.test.conn.EnvTest) Test(org.junit.Test)

Example 8 with OpService

use of org.apache.jena.sparql.algebra.op.OpService in project jena by apache.

the class TestService method service_exec_1.

// Forms of the OpService elements.
@Test
public void service_exec_1() {
    OpService op = makeOp(env);
    QueryIterator qIter = Service.exec(op, new Context());
    assertNotNull(qIter);
}
Also used : Context(org.apache.jena.sparql.util.Context) QueryIterator(org.apache.jena.sparql.engine.QueryIterator) OpService(org.apache.jena.sparql.algebra.op.OpService) EnvTest(org.apache.jena.test.conn.EnvTest) Test(org.junit.Test)

Example 9 with OpService

use of org.apache.jena.sparql.algebra.op.OpService in project jena by apache.

the class TestService method makeOp.

/*package*/
static OpService makeOp(EnvTest env, Node serviceNode) {
    ElementGroup elt = new ElementGroup();
    Element elt1 = new ElementTriplesBlock(bgp);
    elt.addElement(elt1);
    Op subOp = Algebra.compile(elt1);
    // ElementService eltService = new ElementService(SERVICE, elt);
    OpService opService = new OpService(serviceNode, subOp, false);
    return opService;
}
Also used : Op(org.apache.jena.sparql.algebra.Op) Element(org.apache.jena.sparql.syntax.Element) ElementTriplesBlock(org.apache.jena.sparql.syntax.ElementTriplesBlock) OpService(org.apache.jena.sparql.algebra.op.OpService) ElementGroup(org.apache.jena.sparql.syntax.ElementGroup)

Example 10 with OpService

use of org.apache.jena.sparql.algebra.op.OpService in project jena by apache.

the class TestService method makeOpElt.

/*package*/
static OpService makeOpElt(EnvTest env) {
    Node serviceNode = NodeFactory.createURI(env.datasetURL());
    ElementGroup elt = new ElementGroup();
    Element elt1 = new ElementTriplesBlock(bgp);
    elt.addElement(elt1);
    Op subOp = Algebra.compile(elt1);
    ElementService eltService = new ElementService(SERVICE, elt);
    OpService opService = new OpService(serviceNode, subOp, eltService, false);
    return opService;
}
Also used : Op(org.apache.jena.sparql.algebra.Op) ElementService(org.apache.jena.sparql.syntax.ElementService) Node(org.apache.jena.graph.Node) Element(org.apache.jena.sparql.syntax.Element) ElementTriplesBlock(org.apache.jena.sparql.syntax.ElementTriplesBlock) OpService(org.apache.jena.sparql.algebra.op.OpService) ElementGroup(org.apache.jena.sparql.syntax.ElementGroup)

Aggregations

OpService (org.apache.jena.sparql.algebra.op.OpService)12 Context (org.apache.jena.sparql.util.Context)9 Test (org.junit.Test)8 Node (org.apache.jena.graph.Node)6 SocketException (java.net.SocketException)5 OpBGP (org.apache.jena.sparql.algebra.op.OpBGP)5 BasicPattern (org.apache.jena.sparql.core.BasicPattern)5 QueryExceptionHTTP (org.apache.jena.sparql.engine.http.QueryExceptionHTTP)5 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)4 ConnectTimeoutException (org.apache.http.conn.ConnectTimeoutException)3 EnvTest (org.apache.jena.test.conn.EnvTest)3 UnknownHostException (java.net.UnknownHostException)2 HttpConnectTimeoutException (java.net.http.HttpConnectTimeoutException)2 Op (org.apache.jena.sparql.algebra.Op)2 Element (org.apache.jena.sparql.syntax.Element)2 ElementGroup (org.apache.jena.sparql.syntax.ElementGroup)2 ElementTriplesBlock (org.apache.jena.sparql.syntax.ElementTriplesBlock)2 QueryExecException (org.apache.jena.query.QueryExecException)1 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)1 ExecutionContext (org.apache.jena.sparql.engine.ExecutionContext)1