public function testPrependTitlePropertySameInstances()
 {
     $config = array('titleHelper' => array('properties' => array('skosPlabel' => 'http://www.w3.org/2004/02/skos/core#prefLabel', 'dcTitle' => 'http://purl.org/dc/elements/1.1/title', 'dcTitle2' => 'http://purl.org/dc/terms/title', 'swrcTitle' => 'http://swrc.ontoware.org/ontology#title', 'foafName' => 'http://xmlns.com/foaf/0.1/name', 'doapName' => 'http://usefulinc.com/ns/doap#name', 'siocName' => 'http://rdfs.org/sioc/ns#name', 'tagName' => 'http://www.holygoat.co.uk/owl/redwood/0.1/tags/name', 'lgeodName' => 'http://linkedgeodata.org/vocabulary#name', 'geoName' => 'http://www.geonames.org/ontology#name', 'goName' => 'http://www.geneontology.org/dtds/go.dtd#name', 'rdfsLabel' => 'http://www.w3.org/2000/01/rdf-schema#label'), 'searchMode' => 'language'));
     $graph = new Erfurt_Rdf_Model('http://example.org/graph123/');
     $resource = 'http://example.org/graph123/resourceABC';
     $titleHelper = new OntoWiki_Model_TitleHelper($graph, $this->_store, $config);
     $title = $titleHelper->getTitle($resource);
     $this->assertEquals('testABC', $title);
     // now prepend a property
     $titleHelper->prependTitleProperty('http://ns.ontowiki.net/SysOnt/Site/menuLabel');
     $title = $titleHelper->getTitle($resource);
     $this->assertEquals('testMenuLabel', $title);
 }
 public function navigationList($options = array())
 {
     $owapp = OntoWiki::getInstance();
     $store = $owapp->erfurt->getStore();
     $this->model = $owapp->selectedModel;
     $titleHelper = new OntoWiki_Model_TitleHelper($this->model);
     if (!isset($options['navResource']) || !$options['navResource']) {
         if (isset($options['navProperty'])) {
             $this->_navProperty = $options['navProperty'];
             $resource = new OntoWiki_Resource($this->resourceUri, $this->model);
             $description = $resource->getDescription();
             $description = $description[(string) $resource];
             if (isset($description[$this->_navProperty])) {
                 $this->_navResource = $description[$this->_navProperty][0]['value'];
             } else {
                 return '';
             }
         } else {
             return '';
         }
     } else {
         $this->_navResource = $options['navResource'];
     }
     // overwrite standard options with given ones, if given as option
     $this->_listTag = isset($options['listTag']) ? $options['listTag'] : $this->_listTag;
     $this->_listClass = isset($options['listClass']) ? $options['listClass'] : $this->_listClass;
     $this->_activeItemClass = isset($options['activeItemClass']) ? $options['activeItemClass'] : $this->_activeItemClass;
     $this->_activeUrl = isset($options['activeUrl']) ? $options['activeUrl'] : $this->_activeUrl;
     $this->_prefix = isset($options['prefix']) ? $options['prefix'] : $this->_prefix;
     $this->_suffix = isset($options['suffix']) ? $options['suffix'] : $this->_suffix;
     $this->_navClass = isset($options['navClass']) ? $options['navClass'] : $this->_navClass;
     $this->_navId = isset($options['navId']) ? $options['navId'] : $this->_navId;
     $this->_subheadTag = isset($options['subheadTag']) ? $options['subheadTag'] : $this->_subheadTag;
     $this->_subheadClass = isset($options['subheadClass']) ? $options['subheadClass'] : $this->_subheadClass;
     $this->_subheadSkipLink = isset($options['subheadSkipLink']) ? $options['subheadSkipLink'] : $this->_subheadSkipLink;
     $this->_sublistTag = isset($options['sublistTag']) ? $options['sublistTag'] : $this->_listTag;
     // takes the list tag for default
     $this->_sublistClass = isset($options['sublistClass']) ? $options['sublistClass'] : $this->_sublistClass;
     if (isset($options['titleProperty'])) {
         $titleHelper->prependTitleProperty($options['titleProperty']);
     } else {
         $titleHelper->prependTitleProperty($this->_menuLabel);
     }
     $navigation = $this->_getMenu($this->_navResource, $this->model, $titleHelper);
     $navigation = $this->_setTitles($navigation, $titleHelper);
     return $this->render($navigation);
 }
 /**
  * Function generates nice URIs by certain rules (naming scheme and available resource data)
  * Two modes are possible: live from store namingly 'sparql', or with memory model in rdfphp
  * format to use 'rdfphp'.
  *
  * @param string $format (see class constants for possible values)
  * @param array  $data   further data (in rdfphp-mode the insert statements)
  *
  * @return string generated 'nice' URI
  */
 public function generateUri($resourceUri, $format = self::FORMAT_SPARQL, $data = array())
 {
     $titleHelper = new OntoWiki_Model_TitleHelper($this->_model);
     if (isset($this->_config->property->title)) {
         $titleHelper->prependTitleProperty($this->_config->property->title);
     }
     // call format specific generation function
     switch ($format) {
         case self::FORMAT_SPARQL:
             $return = $this->generateUriFromSparql($resourceUri, $titleHelper);
             break;
         case self::FORMAT_RDFPHP:
             if (is_array($data) && count($data) > 0) {
                 $newInstance = $data[$resourceUri];
                 $return = $this->generateUriFromRdfphp($resourceUri, $newInstance, $titleHelper);
             }
             break;
     }
     // check if resources with same prefix exist
     if (($count = $this->countUriPattern($return)) > 0) {
         $return .= '/' . $count;
     }
     return $return;
 }