Search in sources :

Example 36 with Context

use of org.apache.jena.sparql.util.Context in project jena by apache.

the class TestContext method testCxt5.

@Test
public void testCxt5() {
    Context cxt = new Context();
    cxt.set(p1, "false");
    assertTrue("Not false", cxt.isFalse(p1));
    assertTrue("Not false or undef", cxt.isFalseOrUndef(p1));
}
Also used : Context(org.apache.jena.sparql.util.Context) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 37 with Context

use of org.apache.jena.sparql.util.Context in project jena by apache.

the class TestContext method testCxt3.

@Test
public void testCxt3() {
    Context cxt = new Context();
    cxt.set(p1, "v");
    cxt.setIfUndef(p1, "w");
    Object v = cxt.get(p1);
    assertSame("Not as first set", "v", v);
}
Also used : Context(org.apache.jena.sparql.util.Context) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 38 with Context

use of org.apache.jena.sparql.util.Context in project jena by apache.

the class TestContext method testCxt4.

@Test
public void testCxt4() {
    Context cxt = new Context();
    cxt.set(p1, "true");
    assertTrue("Not true", cxt.isTrue(p1));
    assertTrue("Not true or undef", cxt.isTrueOrUndef(p1));
    assertTrue("Not false or undef", cxt.isFalseOrUndef(p2));
    assertTrue("False when undef", !cxt.isFalse(p2));
}
Also used : Context(org.apache.jena.sparql.util.Context) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 39 with Context

use of org.apache.jena.sparql.util.Context in project jena by apache.

the class TestContext method testCxt7.

@Test
public void testCxt7() {
    Context cxt = new Context();
    assertEquals(-1, cxt.getInt(p1, -1));
    cxt.set(p1, 1);
    int x = cxt.getInt(p1, -1);
    assertEquals(1, x);
}
Also used : Context(org.apache.jena.sparql.util.Context) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 40 with Context

use of org.apache.jena.sparql.util.Context in project jena by apache.

the class TestContext method testCxt2.

@Test
public void testCxt2() {
    Context cxt = new Context();
    assertTrue("Defined in empty context", !cxt.isDefined(p1));
    cxt.set(p1, "v");
    assertTrue("Not defined after .set", cxt.isDefined(p1));
    Object v = cxt.get(p1);
    assertSame("Not the same", "v", v);
}
Also used : Context(org.apache.jena.sparql.util.Context) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

Context (org.apache.jena.sparql.util.Context)52 Test (org.junit.Test)36 ExecutionContext (org.apache.jena.sparql.engine.ExecutionContext)15 Map (java.util.Map)11 BaseTest (org.apache.jena.atlas.junit.BaseTest)11 SerializationContext (org.apache.jena.sparql.serializer.SerializationContext)11 HashMap (java.util.HashMap)10 QueryIterSort (org.apache.jena.sparql.engine.iterator.QueryIterSort)9 HttpClient (org.apache.http.client.HttpClient)7 QueryEngineHTTP (org.apache.jena.sparql.engine.http.QueryEngineHTTP)7 Query (org.apache.jena.query.Query)5 QueryCancelledException (org.apache.jena.query.QueryCancelledException)4 SocketException (java.net.SocketException)3 ConnectTimeoutException (org.apache.http.conn.ConnectTimeoutException)3 HttpContext (org.apache.http.protocol.HttpContext)3 JsonObject (org.apache.jena.atlas.json.JsonObject)3 JsonString (org.apache.jena.atlas.json.JsonString)3 Node (org.apache.jena.graph.Node)3 Model (org.apache.jena.rdf.model.Model)3 JsonLDWriteContext (org.apache.jena.riot.JsonLDWriteContext)3