function test_from_turtle_parses_datatypes()
 {
     $g = new SimpleGraph();
     $g->from_turtle('<http://example.org/subj> <http://example.org/pred> "1390"^^<http://www.w3.org/2001/XMLSchema#gYear> .');
     $this->assertEquals(1, count($g->get_triples()));
     $index = $g->get_index();
     $this->assertEquals("1390", $index['http://example.org/subj']['http://example.org/pred'][0]['value']);
     $this->assertEquals("http://www.w3.org/2001/XMLSchema#gYear", $index['http://example.org/subj']['http://example.org/pred'][0]['datatype']);
 }
    function test_get_resource_property_values()
    {
        $ex = "http://example.com/";
        $turtle = <<<_TTL_
@base <{$ex}> .

<s> <has> <a> , <b> , <c> , <d> , <e> .
<a> <p> 2 .      
<b> <p> 3 .      
<c> <p> 1 .      
<e> <p> "!" , "_" .

_TTL_;
        $graph = new SimpleGraph();
        $graph->from_turtle($turtle);
        $expected = array($ex . 'd', $ex . 'e', $ex . 'c', $ex . 'a', $ex . 'b');
        $actual = $graph->get_resource_triple_values($ex . 's', $ex . 'has', $ex . 'p');
        $actual_r = $graph->get_resource_triple_values($ex . 's', $ex . 'has', $ex . 'p', true);
        $actual_unsorted = $graph->get_resource_triple_values($ex . 's', $ex . 'has');
        $this->assertEquals($expected, $actual, "should return the resource values of one property, ordered by a property of those resources");
        $this->assertEquals(array_reverse($expected), $actual_r, "should return the resource values of one property, ordered by a property of those resources, sorted in descending order");
        $this->assertEquals(count($actual), count($actual_unsorted), "number of results should be the same whether sorted or not");
    }