Example #1
0
 public function testGetSparql()
 {
     $q1 = new Erfurt_Sparql_Query2(Erfurt_Sparql_Query2::typeAsk);
     $this->assertEquals("ASK  \nWHERE { \n} \n", $q1->getSparql());
     $q2 = new Erfurt_Sparql_Query2(Erfurt_Sparql_Query2::typeDescribe);
     $this->assertEquals("DESCRIBE * \nWHERE { \n} \n", $q2->getSparql());
     $q3 = new Erfurt_Sparql_Query2(Erfurt_Sparql_Query2::typeSelect);
     $this->assertEquals("SELECT * \nWHERE { \n} \n", $q3->getSparql());
     $q4 = new Erfurt_Sparql_Query2(Erfurt_Sparql_Query2::typeConstruct);
     $constrPure = "CONSTRUCT  \n{ \n} \nWHERE { \n} \n";
     $this->assertEquals($constrPure, $q4->getSparql());
     $q4->setBase(new Erfurt_Sparql_Query2_IriRef('http://base.com'));
     $this->assertEquals("BASE <http://base.com> \nCONSTRUCT  \n{ \n} \nWHERE { \n} \n", $q4->getSparql());
     $q4->removeBase();
     $this->assertEquals($constrPure, $q4->getSparql());
     $q3->setDistinct();
     $this->assertEquals("SELECT DISTINCT * \nWHERE { \n} \n", $q3->getSparql());
     $q3->setReduced();
     $this->assertEquals("SELECT REDUCED * \nWHERE { \n} \n", $q3->getSparql());
 }