Search in sources :

Example 41 with Graph

use of com.thoughtworks.studios.shine.semweb.Graph 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"));
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) BoundVariables(com.thoughtworks.studios.shine.semweb.BoundVariables) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Test(org.junit.Test)

Aggregations

Graph (com.thoughtworks.studios.shine.semweb.Graph)41 Test (org.junit.Test)26 InMemoryTempGraphFactory (com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory)18 File (java.io.File)7 JobXmlViewModel (com.thoughtworks.go.server.domain.xml.JobXmlViewModel)5 ShineRuntimeException (com.thoughtworks.studios.shine.ShineRuntimeException)5 InputStream (java.io.InputStream)5 TestFailureSetup (com.thoughtworks.go.server.dao.sparql.TestFailureSetup)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 Date (java.util.Date)4 Pipeline (com.thoughtworks.go.domain.Pipeline)3 Stage (com.thoughtworks.go.domain.Stage)3 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)3 StageXmlViewModel (com.thoughtworks.go.server.domain.xml.StageXmlViewModel)3 XSLTTransformerRegistry (com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry)3 Modification (com.thoughtworks.go.domain.materials.Modification)2 GoGRDDLResourceRDFizer (com.thoughtworks.studios.shine.cruise.GoGRDDLResourceRDFizer)2 BoundVariables (com.thoughtworks.studios.shine.semweb.BoundVariables)2 IOException (java.io.IOException)2 Transformer (javax.xml.transform.Transformer)2