use of com.thoughtworks.studios.shine.semweb.BoundVariables in project gocd by gocd.
the class SesameDateTimeOrderingTest method sesameBetterOrderDateTimesCorrectly.
@Test
public void sesameBetterOrderDateTimesCorrectly() throws Exception {
Graph tempGraph = new InMemoryTempGraphFactory().createTempGraph();
tempGraph.addTriplesFromTurtle("" + "@prefix xsd:<http://www.w3.org/2001/XMLSchema#> . " + "<http://foo1> <http://bar> \"2005-02-28T00:00:00Z\"^^xsd:dateTime . " + "<http://foo2> <http://bar> \"2005-02-28T00:00:01Z\"^^xsd:dateTime . " + "<http://foo3> <http://bar> \"2005-02-28T00:00:00-05:00\"^^xsd:dateTime . " + "");
List<BoundVariables> bvs = tempGraph.select("PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" + "SELECT ?subject WHERE { " + " ?subject ?p ?o . " + "} ORDER BY (?o)");
assertEquals("http://foo1", bvs.get(0).getAsString("subject"));
assertEquals("http://foo2", bvs.get(1).getAsString("subject"));
assertEquals("http://foo3", bvs.get(2).getAsString("subject"));
bvs = tempGraph.select("PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" + "SELECT ?subject WHERE { " + " ?subject ?p ?o . " + "} ORDER BY DESC (?o)");
assertEquals("http://foo3", bvs.get(0).getAsString("subject"));
assertEquals("http://foo2", bvs.get(1).getAsString("subject"));
assertEquals("http://foo1", bvs.get(2).getAsString("subject"));
}
Aggregations