/**
  * @medium
  */
 public function testOrderProperty()
 {
     $this->_instances->addTypeFilter($this->_class);
     $this->assertCount(2, $this->_instances->getResources());
     $this->_instances->setOrderProperty("http://model.org/prop", true);
     $r = $this->_instances->getResources();
     $this->assertEquals($r[0]['uri'], 'http://model.org/model#i1');
     $this->_instances->setOrderProperty("http://model.org/prop", false);
     $r = $this->_instances->getResources();
     $this->assertEquals($r[0]['uri'], 'http://model.org/model#i2');
 }
 public function getList($view, $singleResource = true, $limit = null)
 {
     $store = $this->_owApp->erfurt->getStore();
     $graph = $this->_owApp->selectedModel;
     $resource = $this->_owApp->selectedResource;
     $aboutProperty = $this->_privateConfig->about->property;
     $creatorProperty = $this->_privateConfig->creator->property;
     $commentType = $this->_privateConfig->comment->type;
     $contentProperty = $this->_privateConfig->content->property;
     $dateProperty = $this->_privateConfig->date->property;
     if ($limit === null) {
         $limit = $this->_privateConfig->limit;
     }
     // get all resource comments
     // Loading data for list of saved queries
     $listHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('List');
     $list = new OntoWiki_Model_Instances($store, $graph, array());
     $list->addTypeFilter($commentType, 'searchcomments');
     $list->addShownProperty($aboutProperty, "about", false, null, false);
     $list->addShownProperty($creatorProperty, "creator", false, null, false);
     $list->addShownProperty($contentProperty, "content", false, null, false);
     $list->addShownProperty($dateProperty, "date", false, null, false);
     $list->setLimit($limit);
     $list->setOrderProperty($dateProperty, false);
     if ($singleResource) {
         $list->addTripleFilter(array(new Erfurt_Sparql_Query2_Triple($list->getResourceVar(), new Erfurt_Sparql_Query2_IriRef($aboutProperty), new Erfurt_Sparql_Query2_IriRef((string) $resource))));
     } else {
         // doesn't work
         $list->addShownProperty($aboutProperty, "about", false, null, false);
         $instances = $listHelper->getList('instances');
         $query = clone $instances->getResourceQuery();
         $resourceVar = $instances->getResourceVar();
         $vars = $query->getWhere()->getVars();
         foreach ($vars as $var) {
             if ($var->getName() == $resourceVar->getName()) {
                 $var->setName('listresource');
             }
         }
         $elements = $query->getWhere()->getElements();
         //link old list to elements of the community-list
         $elements[] = new Erfurt_Sparql_Query2_Triple($list->getResourceVar(), new Erfurt_Sparql_Query2_IriRef($aboutProperty), $var);
         $list->addTripleFilter($elements, "listfilter");
     }
     $listName = "community";
     $other = new stdClass();
     $other->singleResource = $singleResource;
     $other->statusBar = false;
     if ($list->hasData()) {
         return $listHelper->addListPermanently($listName, $list, $view, 'list_community_main', $other, true);
     } else {
         return null;
     }
 }