Пример #1
0
 public function testSetWithMethodsAsk()
 {
     $queryString = '
         ASK
         WHERE {
             ?comment <http://rdfs.org/sioc/ns#about> ?resource.
             ?comment a <http://rdfs.org/sioc/types#Comment>.
             ?comment <http://rdfs.org/sioc/ns#has_creator> ?author.
             ?comment <http://rdfs.org/sioc/ns#content> ?content.
             ?comment <http://purl.org/dc/terms/created> ?date.
         }
         ORDER BY DESC(?date)
         LIMIT 6';
     $queryObject = new Erfurt_Sparql_SimpleQuery();
     $queryObject->setAsk();
     $queryObject->setWherePart('WHERE {
             ?comment <http://rdfs.org/sioc/ns#about> ?resource.
             ?comment a <http://rdfs.org/sioc/types#Comment>.
             ?comment <http://rdfs.org/sioc/ns#has_creator> ?author.
             ?comment <http://rdfs.org/sioc/ns#content> ?content.
             ?comment <http://purl.org/dc/terms/created> ?date.
         }');
     $queryObject->setOrderClause('DESC(?date)');
     $queryObject->setLimit(6);
     $this->assertQueryEquals($queryString, (string) $queryObject);
     $this->assertEquals(true, $queryObject->isAsk());
     $this->assertEquals(null, $queryObject->getSelectClause());
 }