public function getpossiblevaluesAction() { $listHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('List'); $listName = $this->_request->getParam('list'); if ($listHelper->listExists($listName)) { $list = $listHelper->getList($listName); //TODO the store is not serialized anymore. it is missing by default. Controllers have to set it //how to determine here? //use the default store here - but also Sparql-Adapters are possible $list->setStore($this->_erfurt->getStore()); } else { $this->view->values = array(); return; } $predicate = $this->_request->getParam('predicate', ''); $inverse = $this->_request->getParam('inverse', ''); $this->view->values = $list->getPossibleValues($predicate, true, $inverse == "true"); require_once 'OntoWiki/Model/TitleHelper.php'; $titleHelper = new OntoWiki_Model_TitleHelper($this->_owApp->selectedModel); foreach ($this->view->values as $value) { if ($value['type'] == 'uri') { $titleHelper->addResource($value['value']); } } foreach ($this->view->values as $key => $value) { if ($value['type'] == 'uri') { $this->view->values[$key]['title'] = $titleHelper->getTitle($value['value']); } else { $this->view->values[$key]['title'] = $value['value']; } } }
protected function _descriptionResource($uri) { if (null === $this->_descriptionHelper) { $this->_descriptionHelper = new OntoWiki_Model_TitleHelper($this->_model); } $this->_descriptionHelper->addResource($uri); }
/** * Get information about the selected model * @param $modelStore Store of selected model * @param $model Model itself * @param $modelIri Iri of the selected model * @return Array Array with fields containing information about the model */ public static function getModelInformation($modelStore, $model, $modelIri) { $modelResource = new OntoWiki_Model_Resource($modelStore, $model, $modelIri); $modelResource = $modelResource->getValues(); $titleHelper = new OntoWiki_Model_TitleHelper($model); $modelInformation = array(); // if model resource contains further information about the model if (true === isset($modelResource[$modelIri])) { // just add all used predicates to title helper, to get // the titles later on foreach ($modelResource[$modelIri] as $predicateUri => $object) { $titleHelper->addResource($predicateUri); } // now build model information array foreach ($modelResource[$modelIri] as $predicateUri => $object) { // set predicate label $modelInformation[$predicateUri] = array('predicateLabel' => $titleHelper->getTitle($predicateUri)); // choose type of content (uri or literal) if (true === isset($object[0]['content'])) { $modelInformation[$predicateUri]['content'] = $object[0]['content']; } else { $modelInformation[$predicateUri]['content'] = $object[0]['uri']; } } } return $modelInformation; }
public function lastchange($uri) { // TODO: fill this value with the erfurt versioning api $versioning = Erfurt_App::getInstance()->getVersioning(); $history = $versioning->getLastModifiedForResource($uri, (string) OntoWiki::getInstance()->selectedModel); if (empty($history)) { return array('resourceUri' => $uri, 'resourceTitle' => '', 'timeStamp' => '', 'timeIso8601' => '', 'timeDuration' => '', 'userTitle' => '', 'userUri' => '', 'userHref' => ''); } $th = new OntoWiki_Model_TitleHelper(OntoWiki::getInstance()->selectedModel); $th->addResource($history['useruri']); $th->addResource($uri); $return = array(); $userUrl = new OntoWiki_Url(array('route' => 'properties')); $userUrl->setParam('r', $history['useruri']); $return['resourceUri'] = $uri; $return['resourceTitle'] = $th->getTitle($uri); $return['timeStamp'] = $history['tstamp']; //unix timestamp $return['timeIso8601'] = date('c', $history['tstamp']); // ISO 8601 format try { $return['timeDuration'] = OntoWiki_Utils::dateDifference($history['tstamp'], null, 3); // x days ago } catch (Exception $e) { $return['timeDuration'] = ''; } $return['userTitle'] = $th->getTitle($history['useruri']); $return['userUri'] = $history['useruri']; $return['userHref'] = $userUrl; //use URI helper return $return; }
public function getContents() { $query = new Erfurt_Sparql_SimpleQuery(); $results = false; $similars = array(); $typesArr = array(); $types = $this->_getTypes(); $url = new OntoWiki_Url(array('route' => 'properties'), array('r')); $listUrl = new OntoWiki_Url(array('route' => 'instances'), array()); $titleHelper = new OntoWiki_Model_TitleHelper($this->_owApp->selectedModel); $titleHelper->addResources($types); foreach ($types as $typeUri) { if (!array_key_exists($typeUri, $typesArr)) { $typesArr[$typeUri] = $typeUri; } $query->resetInstance()->setProloguePart('SELECT DISTINCT ?uri')->setWherePart('WHERE { ?uri a <' . $typeUri . '> . FILTER (!sameTerm(?uri, <' . (string) $this->_owApp->selectedResource . '>)) FILTER (isURI(?uri)) }')->setLimit(OW_SHOW_MAX + 1); if ($instances = $this->_owApp->selectedModel->sparqlQuery($query)) { $results = true; $url->setParam('r', $typeUri, true); // create properties url for the class $typesArr[$typeUri] = array('uri' => $typeUri, 'url' => (string) $url, 'title' => $titleHelper->getTitle($typeUri, $this->_lang), 'has_more' => false); // has_more is used for the dots if (count($instances) > OW_SHOW_MAX) { $typesArr[$typeUri]['has_more'] = true; $instances = array_splice($instances, 0, OW_SHOW_MAX); } $instTitleHelper = new OntoWiki_Model_TitleHelper($this->_owApp->selectedModel); $instTitleHelper->addResources($instances, 'uri'); $conf['filter'][0] = array('mode' => 'rdfsclass', 'rdfsclass' => $typeUri, 'action' => 'add'); // the list url is used for the context menu link $listUrl->setParam('instancesconfig', json_encode($conf), true); $listUrl->setParam('init', true, true); $typesArr[$typeUri]['listUrl'] = (string) $listUrl; foreach ($instances as $row) { $instanceUri = $row['uri']; // set URL $url->setParam('r', $instanceUri, true); if (!array_key_exists($typeUri, $similars)) { $similars[$typeUri] = array(); } // add instance $similars[$typeUri][$instanceUri] = array('uri' => $instanceUri, 'title' => $instTitleHelper->getTitle($instanceUri, $this->_lang), 'url' => (string) $url); } } } $this->view->types = $typesArr; $this->view->similars = $similars; if (!$results) { $this->view->message = 'No matches.'; } return $this->render('similarinstances'); }
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 link($options = array()) { $model = OntoWiki::getInstance()->selectedModel; $titleHelper = new OntoWiki_Model_TitleHelper($model); // check for options and assign local vars or null $uri = isset($options['uri']) ? (string) $options['uri'] : null; $literal = isset($options['literal']) ? $options['literal'] : null; $text = isset($options['text']) ? $options['text'] : null; $property = isset($options['property']) ? $options['property'] : null; $class = isset($options['class']) ? ' class="' . $options['class'] . '"' : ''; $prefix = isset($options['prefix']) ? $options['prefix'] : ''; $suffix = isset($options['suffix']) ? $options['suffix'] : ''; $iprefix = isset($options['iprefix']) ? $options['iprefix'] : ''; $isuffix = isset($options['isuffix']) ? $options['isuffix'] : ''; $direct = isset($options['direct']) ? true : false; // resolve short forms (overwrite full name values with short forms values) $uri = isset($options['r']) ? (string) $options['r'] : $uri; $literal = isset($options['l']) ? $options['l'] : $literal; $text = isset($options['t']) ? $options['t'] : $text; $property = isset($options['p']) ? $options['p'] : $property; // if an uri is given, we do not need to search for if (isset($uri)) { // resolve qnames and check uri input $uri = Erfurt_Uri::getFromQnameOrUri((string) $uri, $model); } else { // if no uri is given, we need to search by using the literal if (!isset($literal)) { throw new Exception('The link helper needs at least one parameter literal or uri'); } // if a property is given, use <properyuri> instead of a variable part in the query $property = $property ? '<' . Erfurt_Uri::getFromQnameOrUri($property, $model) . '>' : '?property'; // build the query including PREFIX declarations $query = ''; foreach ($model->getNamespaces() as $ns => $nsprefix) { $query .= 'PREFIX ' . $nsprefix . ': <' . $ns . '>' . PHP_EOL; } $query .= 'SELECT DISTINCT ?resourceUri WHERE {?resourceUri ' . $property . ' ?literal FILTER (!isBLANK(?resourceUri)) FILTER (REGEX(?literal, "^' . $literal . '$", "i")) } LIMIT 1'; $result = $model->sparqlQuery($query); if (!$result) { // resource not found, so return plain literal or given text return isset($text) ? $text : $literal; } else { $uri = $result[0]['resourceUri']; } } // generate the link URL from the resource URI if ($direct == true) { $url = $uri; } else { $url = new OntoWiki_Url(array('route' => 'properties'), array('r')); $url->setParam('r', $uri, true); $url = (string) $url; } // link text comes from title helper or option $text = isset($text) ? $text : $titleHelper->getTitle($uri); return "{$prefix}<a{$class} href='{$url}'>{$iprefix}{$text}{$isuffix}</a>{$suffix}"; }
/** * Returns the content for the model list. */ public function getContents() { $models = array(); $selectedModel = $this->_owApp->selectedModel ? $this->_owApp->selectedModel->getModelIri() : null; $lang = $this->_config->languages->locale; $titleHelper = new OntoWiki_Model_TitleHelper(); $titleHelper->addResources(array_keys($this->graphUris)); $useGraphUriAsLink = false; if (isset($this->_privateConfig->useGraphUriAsLink) && (bool) $this->_privateConfig->useGraphUriAsLink) { $useGraphUriAsLink = true; } foreach ($this->graphUris as $graphUri => $true) { $linkUrl = $this->_config->urlBase . 'model/select/?m=' . urlencode($graphUri); if ($useGraphUriAsLink) { if (isset($this->_config->vhosts)) { $vHostsArray = $this->_config->vhosts->toArray(); foreach ($vHostsArray as $vHostUri) { if (strpos($graphUri, $vHostUri) !== false) { // match $linkUrl = $graphUri; break; } } } } $temp = array(); $temp['url'] = $linkUrl; $temp['graphUri'] = $graphUri; $temp['selected'] = $selectedModel == $graphUri ? 'selected' : ''; // use URI if no title exists $label = $titleHelper->getTitle($graphUri, $lang); $temp['label'] = !empty($label) ? $label : $graphUri; $temp['backendName'] = $true; $models[] = $temp; } $content = $this->render('modellist', $models, 'models'); return $content; }
public function getContents() { $url = new OntoWiki_Url(array('route' => 'properties')); if (!empty($this->_subjects)) { $instances = array(); $instancesTitleHelper = new OntoWiki_Model_TitleHelper($this->_owApp->selectedModel); $instancesTitleHelper->addResources($this->_subjects, 'resourceUri'); foreach ($this->_subjects as $instance) { $instanceUri = $instance['resourceUri']; if (!array_key_exists($instanceUri, $instances)) { // URL $url->setParam('r', $instanceUri, true); $instances[$instanceUri] = array('uri' => $instanceUri, 'title' => $instancesTitleHelper->getTitle($instanceUri, $this->_lang), 'url' => (string) $url); } } $this->view->instances = $instances; } if (!empty($this->_objects)) { $objects = array(); $objectTitleHelper = new OntoWiki_Model_TitleHelper($this->_owApp->selectedModel); $objectTitleHelper->addResources($this->_objects, 'resourceUri'); foreach ($this->_objects as $object) { $objectUri = $object['resourceUri']; if (!array_key_exists($objectUri, $objects)) { // URL $url->setParam('r', $objectUri, true); $objects[$objectUri] = array('uri' => $objectUri, 'title' => $objectTitleHelper->getTitle($objectUri, $this->_lang), 'url' => (string) $url); } } $this->view->objects = $objects; } $url = new OntoWiki_Url(array('controller' => 'resource', 'action' => 'instances')); $url->setParam('instancesconfig', json_encode(array('filter' => array(array('id' => 'propertyUsage', 'action' => 'add', 'mode' => 'query', 'query' => (string) $this->_subjectQuery))))); $url->setParam('init', true); $this->view->subjectListLink = (string) $url; $url->setParam('instancesconfig', json_encode(array('filter' => array(array('id' => 'propertyUsage', 'action' => 'add', 'mode' => 'query', 'query' => (string) $this->_objectQuery))))); $this->view->objectListLink = (string) $url; if (empty($this->_subjects) && empty($this->_objects)) { $this->view->message = 'No matches.'; } // render data into template return $this->render('usage'); }
/** * Add additional fields to each entry of the given array. These fields are * heavily used in the UI. Each field starts with __cv_ and could be ignored * usally. * @param $assocSPOArray array Usally the result of generateAssocSPOArrayFromSparqlResult * @param $useTitleHelper bool optional Manually deactivate title helper * @return Array An enriched version of given $assocSPOArray */ public function enrichResult($assocSPOArray, $useTitleHelper = true) { // generate unique hash using given SPO array and model uri $objectId = md5($this->_model->getModelIri() . json_encode($assocSPOArray)); // check there is already a cached object for this hash $result = $this->_objectCache->load($objectId); // no cache entry found if (false === $result) { // start QueryCache transaction $this->_queryCache->startTransaction($objectId); $return = array(); $spoArrayCount = count($assocSPOArray); if (true === $useTitleHelper) { $titleHelper = new OntoWiki_Model_TitleHelper($this->_model); /** * go through all entries to add them to title helper */ if ($this->_titleHelperLimit >= $spoArrayCount) { foreach ($assocSPOArray as $mainKey => $entry) { if (true === Erfurt_Uri::check($mainKey)) { $titleHelper->addResource($mainKey); } } } } /** * enrich data with CubeViz specific stuff */ foreach ($assocSPOArray as $mainKey => $entry) { // URI of the element $entry['__cv_uri'] = $mainKey; // hashed URI of the element $entry['__cv_hashedUri'] = md5($mainKey); if (true === $useTitleHelper && $this->_titleHelperLimit >= $spoArrayCount) { // Nice label using TitleHelper $entry['__cv_niceLabel'] = $titleHelper->getTitle($mainKey); } else { $entry['__cv_niceLabel'] = $mainKey; } // Comment if (true === isset($entry['http://www.w3.org/2000/01/rdf-schema#comment']) && true === is_string($entry['http://www.w3.org/2000/01/rdf-schema#comment']) && 0 < strlen($entry['http://www.w3.org/2000/01/rdf-schema#comment'])) { $entry['__cv_description'] = $entry['http://www.w3.org/2000/01/rdf-schema#comment']; } else { $entry['__cv_description'] = ''; } $return[] = $entry; } // end the QueryCache transaction $this->_queryCache->endTransaction($objectId); // save the result value in the object cache $this->_objectCache->save($result, $objectId); } return $return; }
/** * Singleton instance * * @return OntoWiki_Model_Instance */ public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
/** * @desc get the titles for a given array of resources * * @param string modelIri * @param array resources * * @return array An associative array of resources and their titles */ public function getTitles($modelIri, $resources) { // ["http://pfarrerbuch.comiles.eu/sachsen/"] $resources = json_decode($resources); $model = $this->_store->getModel($modelIri); $titleHelper = new OntoWiki_Model_TitleHelper($model, $this->_store); $titleHelper->addResources($resources); $titles = array(); foreach ($resources as $resourceUri) { $titles[$resourceUri] = $titleHelper->getTitle($resourceUri); } return $titles; }
/** * Displays all preoperties and values for a resource, denoted by parameter */ public function propertiesAction() { $this->_addLastModifiedHeader(); $store = $this->_owApp->erfurt->getStore(); $graph = $this->_owApp->selectedModel; $resource = $this->_owApp->selectedResource; $navigation = $this->_owApp->navigation; $translate = $this->_owApp->translate; // add export formats to resource menu $resourceMenu = OntoWiki_Menu_Registry::getInstance()->getMenu('resource'); $menu = new OntoWiki_Menu(); $menu->setEntry('Resource', $resourceMenu); $event = new Erfurt_Event('onCreateMenu'); $event->menu = $resourceMenu; $event->resource = $this->_owApp->selectedResource; $event->model = $this->_owApp->selectedModel; $event->trigger(); $event = new Erfurt_Event('onPropertiesAction'); $event->uri = (string) $resource; $event->graph = $this->_owApp->selectedModel->getModelUri(); $event->trigger(); // Give plugins a chance to add entries to the menu $this->view->placeholder('main.window.menu')->set($menu->toArray(false, true)); $title = $resource->getTitle($this->_config->languages->locale) ? $resource->getTitle($this->_config->languages->locale) : OntoWiki_Utils::contractNamespace((string) $resource); $windowTitle = sprintf($translate->_('Properties of %1$s'), $title); $this->view->placeholder('main.window.title')->set($windowTitle); if (!empty($resource)) { $event = new Erfurt_Event('onPreTabsContentAction'); $event->uri = (string) $resource; $result = $event->trigger(); if ($result) { $this->view->preTabsContent = $result; } $event = new Erfurt_Event('onPrePropertiesContentAction'); $event->uri = (string) $resource; $result = $event->trigger(); if ($result) { $this->view->prePropertiesContent = $result; } $model = new OntoWiki_Model_Resource($store, $graph, (string) $resource); $values = $model->getValues(); $predicates = $model->getPredicates(); // new trigger onPropertiesActionData to work with data (reorder with plugin) $event = new Erfurt_Event('onPropertiesActionData'); $event->uri = (string) $resource; $event->predicates = $predicates; $event->values = $values; $result = $event->trigger(); if ($result) { $predicates = $event->predicates; $values = $event->values; } $titleHelper = new OntoWiki_Model_TitleHelper($graph); // add graphs $graphs = array_keys($predicates); $titleHelper->addResources($graphs); // set RDFa widgets update info for editable graphs and other graph info $graphInfo = array(); $editableFlags = array(); foreach ($graphs as $g) { $graphInfo[$g] = $titleHelper->getTitle($g, $this->_config->languages->locale); if ($this->_erfurt->getAc()->isModelAllowed('edit', $g)) { $editableFlags[$g] = true; $this->view->placeholder('update')->append(array('sourceGraph' => $g, 'queryEndpoint' => $this->_config->urlBase . 'sparql/', 'updateEndpoint' => $this->_config->urlBase . 'update/')); } else { $editableFlags[$g] = false; } } $this->view->graphs = $graphInfo; $this->view->editableFlags = $editableFlags; $this->view->values = $values; $this->view->predicates = $predicates; $this->view->resourceUri = (string) $resource; $this->view->graphUri = $graph->getModelIri(); $this->view->graphBaseUri = $graph->getBaseIri(); $this->view->editable = false; // use $this->editableFlags[$graph] now // prepare namespaces $namespacePrefixes = $graph->getNamespacePrefixes(); $graphBase = $graph->getBaseUri(); if (!array_key_exists(OntoWiki_Utils::DEFAULT_BASE, $namespacePrefixes)) { $namespacePrefixes[OntoWiki_Utils::DEFAULT_BASE] = $graphBase; } $this->view->namespacePrefixes = $namespacePrefixes; } $toolbar = $this->_owApp->toolbar; // show only if not forwarded and if model is writeable // TODO: why is isEditable not false here? if ($this->_request->getParam('action') == 'properties' && $graph->isEditable() && $this->_owApp->erfurt->getAc()->isModelAllowed('edit', $this->_owApp->selectedModel)) { // TODO: check acl $toolbar->appendButton(OntoWiki_Toolbar::EDIT, array('name' => 'Edit Properties', 'title' => 'SHIFT + ALT + e')); $toolbar->appendButton(OntoWiki_Toolbar::EDITADD, array('name' => 'Clone', 'class' => 'clone-resource', 'title' => 'SHIFT + ALT + l')); // ->appendButton(OntoWiki_Toolbar::EDITADD, array('name' => 'Add Property', 'class' => 'property-add')); $params = array('name' => 'Delete', 'url' => $this->_config->urlBase . 'resource/delete/?r=' . urlencode((string) $resource)); $toolbar->appendButton(OntoWiki_Toolbar::SEPARATOR); $toolbar->appendButton(OntoWiki_Toolbar::DELETE, $params); $toolbar->prependButton(OntoWiki_Toolbar::SEPARATOR); $toolbar->prependButton(OntoWiki_Toolbar::ADD, array('name' => 'Add Property', '+class' => 'property-add', 'title' => 'SHIFT + ALT + a')); $toolbar->prependButton(OntoWiki_Toolbar::SEPARATOR); $toolbar->prependButton(OntoWiki_Toolbar::CANCEL, array('+class' => 'hidden', 'title' => 'SHIFT + ALT + c')); $toolbar->prependButton(OntoWiki_Toolbar::SAVE, array('+class' => 'hidden', 'title' => 'SHIFT + ALT + s')); } // let plug-ins add buttons $toolbarEvent = new Erfurt_Event('onCreateToolbar'); $toolbarEvent->resource = (string) $resource; $toolbarEvent->graph = (string) $graph; $toolbarEvent->toolbar = $toolbar; $eventResult = $toolbarEvent->trigger(); if ($eventResult instanceof OntoWiki_Toolbar) { $toolbar = $eventResult; } // add toolbar $this->view->placeholder('main.window.toolbar')->set($toolbar); //show modules $this->addModuleContext('main.window.properties'); }
/** * get titles and build link-urls (for a sparql result of the resource query) * * @param array $resources an array of resource uris * * @return array */ public function convertResources($resources) { // add titles first, seperatly $uris = array(); foreach ($resources as $resource) { $uris[] = $resource['value']; } $this->_titleHelper->addResources($uris); //$lang = OntoWiki::getInstance()->getConfig()->languages->locale; $resourceResults = array(); foreach ($resources as $resource) { $thisResource = $resource; $thisResource['uri'] = $resource['value']; // the URL to view this resource in detail $url = new OntoWiki_Url(array('controller' => 'resource', 'action' => 'properties'), array()); $url->r = $resource['value']; $thisResource['url'] = (string) $url; // title $thisResource['title'] = $this->_titleHelper->getTitle($resource['value']); $resourceResults[] = $thisResource; } return $resourceResults; }
public function getContents() { $titleHelper = new OntoWiki_Model_TitleHelper($this->_owApp->selectedModel); $query = new Erfurt_Sparql_SimpleQuery(); $results = false; $_predicates = $this->_predicates; $properties = array(); $instances = array(); $url = new OntoWiki_Url(array('route' => 'properties'), array('r')); $titleHelper->addResources($_predicates, 'uri'); foreach ($_predicates as $predicate) { $predicateUri = $predicate['uri']; $url->setParam('r', $predicateUri, true); // create properties url for the relation $properties[$predicateUri]['uri'] = $predicateUri; $properties[$predicateUri]['url'] = (string) $url; $properties[$predicateUri]['title'] = $titleHelper->getTitle($predicateUri, $this->_lang); $query->resetInstance()->setProloguePart('SELECT DISTINCT ?uri')->setWherePart('WHERE { ?uri <' . $predicateUri . '> <' . (string) $this->_owApp->selectedResource . '> . FILTER (isURI(?uri)) }')->setLimit(OW_SHOW_MAX + 1); if ($subjects = $this->_owApp->selectedModel->sparqlQuery($query)) { $results = true; // has_more is used for the dots if (count($subjects) > OW_SHOW_MAX) { $properties[$predicateUri]['has_more'] = true; $subjects = array_splice($subjects, 0, OW_SHOW_MAX); } else { $properties[$predicateUri]['has_more'] = false; } $subjectTitleHelper = new OntoWiki_Model_TitleHelper($this->_owApp->selectedModel); $subjectTitleHelper->addResources($subjects, 'uri'); foreach ($subjects as $subject) { $subjectUri = $subject['uri']; $subject['title'] = $subjectTitleHelper->getTitle($subjectUri, $this->_lang); // set URL $url->setParam('r', $subjectUri, true); $subject['url'] = (string) $url; if (array_key_exists($predicateUri, $instances)) { if (!array_key_exists($subjectUri, $instances[$predicateUri])) { $instances[$predicateUri][$subjectUri] = $subject; } } else { $instances[$predicateUri] = array($subjectUri => $subject); } } } } $this->view->resource = $this->_owApp->selectedResource; $this->view->properties = $properties; $this->view->instances = $instances; if (!$results) { $this->view->message = 'No matches.'; } return $this->render('linkinghere'); }
/** * Listing history for selected Resource */ public function listAction() { $model = $this->_owApp->selectedModel; $translate = $this->_owApp->translate; $store = $this->_erfurt->getStore(); $resource = $this->_owApp->selectedResource; $ac = $this->_erfurt->getAc(); $params = $this->_request->getParams(); $limit = 20; $rUriEncoded = urlencode((string) $resource); $mUriEncoded = urlencode((string) $model); $feedUrl = $this->_config->urlBase . "history/feed?r={$rUriEncoded}&mUriEncoded"; $this->view->headLink()->appendAlternate($feedUrl, 'application/atom+xml', 'History Feed'); // redirecting to home if no model/resource is selected if (empty($model) || empty($this->_owApp->selectedResource) && empty($params['r']) && $this->_owApp->lastRoute !== 'instances') { $this->_abort('No model/resource selected.', OntoWiki_Message::ERROR); } // getting page (from and for paging) if (!empty($params['page']) && (int) $params['page'] > 0) { $page = (int) $params['page']; } else { $page = 1; } // enabling versioning $versioning = $this->_erfurt->getVersioning(); $versioning->setLimit($limit); if (!$versioning->isVersioningEnabled()) { $this->_abort('Versioning/History is currently disabled', null, false); } $singleResource = true; // setting if class or instances if ($this->_owApp->lastRoute === 'instances') { // setting default title $title = $resource->getTitle() ? $resource->getTitle() : OntoWiki_Utils::contractNamespace($resource->getIri()); $windowTitle = $translate->_('Versions for elements of the list'); $listHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('List'); $listName = "instances"; if ($listHelper->listExists($listName)) { $list = $listHelper->getList($listName); $list->setStore($store); } else { $this->_owApp->appendMessage(new OntoWiki_Message('something went wrong with the list of instances', OntoWiki_Message::ERROR)); } $query = clone $list->getResourceQuery(); $query->setLimit(0); $query->setOffset(0); //echo htmlentities($query); $results = $model->sparqlQuery($query); $resourceVar = $list->getResourceVar()->getName(); $resources = array(); foreach ($results as $result) { $resources[] = $result[$resourceVar]; } //var_dump($resources); $historyArray = $versioning->getHistoryForResourceList($resources, (string) $this->_owApp->selectedModel, $page); //var_dump($historyArray); $singleResource = false; } else { // setting default title $title = $resource->getTitle() ? $resource->getTitle() : OntoWiki_Utils::contractNamespace($resource->getIri()); $windowTitle = sprintf($translate->_('Versions for %1$s'), $title); $historyArray = $versioning->getHistoryForResource((string) $resource, (string) $this->_owApp->selectedModel, $page); } $historyArrayCount = count($historyArray); if ($historyArrayCount === $limit + 1) { $count = $page * $limit + 1; unset($historyArray[$limit]); } else { $count = ($page - 1) * $limit + $historyArrayCount; } $idArray = array(); $userArray = $this->_erfurt->getUsers(); $titleHelper = new OntoWiki_Model_TitleHelper(); // Load IDs for rollback and Username Labels for view foreach ($historyArray as $key => $entry) { $idArray[] = (int) $entry['id']; if (!$singleResource) { $historyArray[$key]['url'] = $this->_config->urlBase . "view?r=" . urlencode($entry['resource']); $titleHelper->addResource($entry['resource']); } if ($entry['useruri'] == $this->_erfurt->getConfig()->ac->user->anonymousUser) { $userArray[$entry['useruri']] = 'Anonymous'; } else { if ($entry['useruri'] == $this->_erfurt->getConfig()->ac->user->superAdmin) { $userArray[$entry['useruri']] = 'SuperAdmin'; } else { if (is_array($userArray[$entry['useruri']])) { if (isset($userArray[$entry['useruri']]['userName'])) { $userArray[$entry['useruri']] = $userArray[$entry['useruri']]['userName']; } else { $titleHelper->addResource($entry['useruri']); $userArray[$entry['useruri']] = $titleHelper->getTitle($entry['useruri']); } } } } } $this->view->userArray = $userArray; $this->view->idArray = $idArray; $this->view->historyArray = $historyArray; $this->view->singleResource = $singleResource; $this->view->titleHelper = $titleHelper; if (empty($historyArray)) { $this->_owApp->appendMessage(new OntoWiki_Message('No history for the selected resource(s).', OntoWiki_Message::INFO)); } if ($this->_erfurt->getAc()->isActionAllowed('Rollback')) { $this->view->rollbackAllowed = true; // adding submit button for rollback-action $toolbar = $this->_owApp->toolbar; $toolbar->appendButton(OntoWiki_Toolbar::SUBMIT, array('name' => $translate->_('Rollback changes'), 'id' => 'history-rollback')); $this->view->placeholder('main.window.toolbar')->set($toolbar); } else { $this->view->rollbackAllowed = false; } // paging $statusBar = $this->view->placeholder('main.window.statusbar'); // the normal page_param p collides with the generic-list param p OntoWiki_Pager::setOptions(array('page_param' => 'page')); $statusBar->append(OntoWiki_Pager::get($count, $limit)); // setting view variables $url = new OntoWiki_Url(array('controller' => 'history', 'action' => 'rollback')); $this->view->placeholder('main.window.title')->set($windowTitle); $this->view->formActionUrl = (string) $url; $this->view->formMethod = 'post'; // $this->view->formName = 'instancelist'; $this->view->formName = 'history-rollback'; $this->view->formEncoding = 'multipart/form-data'; }
public function infoAction() { OntoWiki::getInstance()->getNavigation()->disableNavigation(); $this->_owApp->selectedResource = new OntoWiki_Resource($this->_request->getParam('m'), $this->_owApp->selectedModel); $store = $this->_owApp->erfurt->getStore(); $graph = $this->_owApp->selectedModel; $resource = $this->_owApp->selectedResource; //$navigation = $this->_owApp->navigation; $translate = $this->_owApp->translate; $event = new Erfurt_Event('onPropertiesAction'); $event->uri = (string) $resource; $event->graph = (string) $resource; $event->trigger(); $windowTitle = $translate->_('Model info'); $this->view->placeholder('main.window.title')->set($windowTitle); $title = $resource->getTitle($this->_owApp->getConfig()->languages->locale); $this->view->modelTitle = $title ? $title : OntoWiki_Utils::contractNamespace((string) $resource); $resourcesUrl = new OntoWiki_Url(array('route' => 'instances'), array()); $resourcesUrl->init = true; $this->view->resourcesUrl = (string) $resourcesUrl; if (!empty($resource)) { $model = new OntoWiki_Model_Resource($store, $graph, (string) $resource); $values = $model->getValues(); $predicates = $model->getPredicates(); $titleHelper = new OntoWiki_Model_TitleHelper($graph); $graphs = array_keys($predicates); $titleHelper->addResources($graphs); $graphInfo = array(); $editableFlags = array(); foreach ($graphs as $g) { $graphInfo[$g] = $titleHelper->getTitle($g, $this->_config->languages->locale); $editableFlags[$g] = false; } $this->view->graphs = $graphInfo; $this->view->resourceIri = (string) $resource; $this->view->graphIri = $graph->getModelIri(); $this->view->values = $values; $this->view->predicates = $predicates; $this->view->graphBaseIri = $graph->getBaseIri(); $this->view->namespacePrefixes = $graph->getNamespacePrefixes(); $this->view->editableFlags = $editableFlags; if (!is_array($this->view->namespacePrefixes)) { $this->view->namespacePrefixes = array(); } if (!array_key_exists(OntoWiki_Utils::DEFAULT_BASE, $this->view->namespacePrefixes)) { $this->view->namespacePrefixes[OntoWiki_Utils::DEFAULT_BASE] = $graph->getBaseIri(); } $infoUris = $this->_config->descriptionHelper->properties; //echo (string)$resource; if (count($values) > 0) { $query = 'ASK FROM <' . (string) $resource . '>' . ' WHERE {' . ' <' . (string) $resource . '> a <http://xmlns.com/foaf/0.1/PersonalProfileDocument>' . ' }'; $q = Erfurt_Sparql_SimpleQuery::initWithString($query); if ($this->_owApp->extensionManager->isExtensionActive('foafprofileviewer') && $store->sparqlAsk($q) === true) { $this->view->showFoafLink = true; $this->view->foafLink = $this->_config->urlBase . 'foafprofileviewer/display'; } } $this->view->infoPredicates = array(); foreach ($infoUris as $infoUri) { if (isset($predicates[(string) $graph]) && array_key_exists($infoUri, $predicates[(string) $graph])) { $this->view->infoPredicates[$infoUri] = $predicates[(string) $graph][$infoUri]; } } } $this->addModuleContext('main.window.modelinfo'); }
/** * 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; }
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); }
/** * JSON output of the RDFauthor init config, which is a RDF/JSON Model * without objects where the user should be able to add data * * get/post parameters: * mode - class, resource or clone * class: prop list based on one class' resources * resource: prop list based on one resource * clone: prop list and values based on one resource (with new uri) * edit: prop list and values based on one resource * uri - parameter for mode (class uri, resource uri) */ public function rdfauthorinitAction() { // service controller needs no view renderer $this->_helper->viewRenderer->setNoRender(); // disable layout for Ajax requests $this->_helper->layout()->disableLayout(); $store = OntoWiki::getInstance()->erfurt->getStore(); $response = $this->getResponse(); $model = $this->_owApp->selectedModel; if (isset($this->_request->m)) { $model = $store->getModel($this->_request->m); } if (empty($model)) { throw new OntoWiki_Exception('Missing parameter m (model) and no selected model in session!'); } if (isset($this->_request->uri) && Zend_Uri::check($this->_request->uri)) { $parameter = $this->_request->uri; } else { throw new OntoWiki_Exception('Missing or invalid parameter uri (clone uri) !'); } if (isset($this->_request->mode)) { $workingMode = $this->_request->mode; } else { $workingMode = 'resource'; } if ($workingMode != 'edit') { $resourceUri = $model->getBaseUri() . 'newResource/' . md5(date('F j, Y, g:i:s:u a')); } else { $resourceUri = $parameter; } if ($workingMode == 'class') { $properties = $model->sparqlQuery('SELECT DISTINCT ?uri ?value { ?s ?uri ?value. ?s a <' . $parameter . '>. } LIMIT 20 ', array('result_format' => 'extended')); } elseif ($workingMode == 'clone') { // FIXME: more than one values of a property are not supported right now // FIXME: Literals are not supported right now $properties = $model->sparqlQuery('SELECT ?uri ?value { <' . $parameter . '> ?uri ?value. #FILTER (isUri(?value)) } LIMIT 20 ', array('result_format' => 'extended')); } elseif ($workingMode == 'edit') { $properties = $model->sparqlQuery('SELECT ?uri ?value { <' . $parameter . '> ?uri ?value. } LIMIT 20 ', array('result_format' => 'extended')); } else { // resource $properties = $model->sparqlQuery('SELECT DISTINCT ?uri ?value { <' . $parameter . '> ?uri ?value. } LIMIT 20 ', array('result_format' => 'extended')); } // empty object to hold data $output = new stdClass(); $newProperties = new stdClass(); $properties = $properties['results']['bindings']; // feed title helper w/ URIs $titleHelper = new OntoWiki_Model_TitleHelper($model); $titleHelper->addResources($properties, 'uri'); if (!empty($properties)) { foreach ($properties as $property) { $currentUri = $property['uri']['value']; $currentValue = $property['value']['value']; $currentType = $property['value']['type']; $value = new stdClass(); if ($currentType == 'literal' || $currentType == 'typed-literal') { if (isset($property['value']['datatype'])) { $value->datatype = $property['value']['datatype']; } else { if (isset($property['value']['xml:lang'])) { $value->lang = $property['value']['xml:lang']; } } /* not in RDFauthor 0.8 else { // plain literal --> rdfQuery needs extra quotes $currentValue = '"' . $currentValue . '"'; } */ } // return title from titleHelper $value->title = $titleHelper->getTitle($currentUri); if ($currentUri == EF_RDF_TYPE) { switch ($workingMode) { case 'resource': /* fallthrough */ /* fallthrough */ case 'clone': $value->value = $currentValue; break; case 'edit': $value->value = $currentValue; break; case 'class': $value->value = $parameter; break; } $value->type = $currentType; } else { // $currentUri != EF_RDF_TYPE if ($workingMode == 'clone' || $workingMode == 'edit') { $value->value = $currentValue; $value->type = $currentType; } if ($workingMode == 'class') { $value->value = ''; $value->type = $currentType; } } // deal with multiple values of a property if (isset($newProperties->{$currentUri})) { $tempProperty = $newProperties->{$currentUri}; $tempProperty[] = $value; $newProperties->{$currentUri} = $tempProperty; } else { $newProperties->{$currentUri} = array($value); } } // foreach $output->{$resourceUri} = $newProperties; } else { // empty sparql results -> start with a plain resource if ($workingMode == 'class') { // for classes, add the rdf:type property $value = new stdClass(); $value->value = $parameter; $value->type = 'uri'; $value->hidden = true; $uri = EF_RDF_TYPE; $newProperties->{$uri} = array($value); } $value = new stdClass(); $value->type = 'literal'; $value->title = 'label'; $uri = EF_RDFS_LABEL; $newProperties->{$uri} = array($value); $output->{$resourceUri} = $newProperties; } // send the response $response->setHeader('Content-Type', 'application/json'); $response->setBody(json_encode($output)); }
/** * Searches for properties in the local database. * * @param array $termsArray * @param string $modelUri * @param int $limit * * @return array */ private function _searchLocalPropertiesOnly(array $termsArray, $modelUri, $limit) { require_once 'Erfurt/Sparql/SimpleQuery.php'; $query = new Erfurt_Sparql_SimpleQuery(); $query->setProloguePart('SELECT DISTINCT ?uri ?o'); if (null !== $modelUri) { $query->addFrom($modelUri); } $where = '{ { ?uri ?p ?o . ?uri <' . EF_RDF_TYPE . '> ?o2 . FILTER ( sameTerm(?o2, <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property>) || sameTerm(?o2, <http://www.w3.org/2002/07/owl#DatatypeProperty>) || sameTerm(?o2, <http://www.w3.org/2002/07/owl#ObjectProperty>) ) FILTER (('; $uriRegexFilter = array(); foreach ($termsArray as $t) { $uriRegexFilter[] = 'regex(str(?uri), "' . $t . '", "i")'; } $where .= implode(' && ', $uriRegexFilter) . ') || (isLiteral(?o) && '; $oRegexFilter = array(); foreach ($termsArray as $t) { $oRegexFilter[] = 'regex(?o, "' . $t . '", "i")'; } $where .= implode(' && ', $oRegexFilter) . ')) } UNION {'; $where .= '?s ?uri ?o . FILTER ('; $where .= implode(' && ', $uriRegexFilter) . ') } }'; $query->setWherePart($where); $query->setOrderClause('?uri'); $query->setLimit($limit); $store = Erfurt_App::getInstance()->getStore(); $queryResult = $store->sparqlQuery($query, array('result_format' => 'extended')); $tempResult = array(); foreach ($queryResult['results']['bindings'] as $row) { if ($row['o']['type'] === 'literal') { $weight = $this->_getWeight($termsArray, $row['uri']['value'], $row['o']['value']); } else { $weight = $this->_getWeight($termsArray, $row['uri']['value']); } if (isset($tempResult[$row['uri']['value']])) { if ($weight > $tempResult[$row['uri']['value']]) { $tempResult[$row['uri']['value']] = $weight; } } else { $tempResult[$row['uri']['value']] = $weight; } } arsort($tempResult); require_once 'OntoWiki/Model/TitleHelper.php'; require_once 'OntoWiki/Utils.php'; if (null !== $modelUri) { $model = $store->getModel($modelUri, false); $titleHelper = new OntoWiki_Model_TitleHelper($model); } else { $titleHelper = new OntoWiki_Model_TitleHelper(); } $titleHelper->addResources(array_keys($tempResult)); $translate = $this->_owApp->translate; $result = array(); foreach ($tempResult as $uri => $w) { $title = $titleHelper->getTitle($uri); if (null !== $title) { $result[$uri] = str_replace('|', 'Ι', $title) . '|' . $uri . '|' . $translate->_('Local Search'); } else { $result[$uri] = OntoWiki_Utils::compactUri($uri) . $uri . '|' . $translate->_('Local Search'); } } return $result; }
/** * * @param void * @return void */ public function compareAction() { // set paths $basePath = $this->view->basePath = $this->_config->staticUrlBase . 'extensions/cubeviz/'; $baseCssPath = $basePath . 'public/css/'; $baseJavascriptPath = $basePath . 'public/javascript/'; $baseImagesPath = $basePath . 'public/images/'; /** * Including css files for this action */ $this->view->headLink()->appendStylesheet($baseCssPath . 'foreign/Bootstrap/bootstrap.min.css')->appendStylesheet($baseCssPath . 'foreign/FontAwesome/css/font-awesome.min.css')->appendStylesheet($baseCssPath . '/CompareAction/CompareAction.css')->appendStylesheet($baseCssPath . '/main.css'); // Libraries $this->view->headScript()->appendFile($basePath . 'ChartConfig.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/highcharts.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/highcharts-more.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/CryptoJS_Md5.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/json2.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/javascriptStats-1.0.1.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/formulaParser.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/underscore.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/underscore.string.js', 'text/javascript')->appendScript('_.mixin(_.str.exports());'); // for underscore.string // If this module is in the "development" context if ('development' === $this->_privateConfig->get('context')) { $this->view->headScript()->appendFile($baseJavascriptPath . 'libraries/munit.js', 'text/javascript')->appendFile($baseJavascriptPath . 'Test.js', 'text/javascript')->appendFile($baseJavascriptPath . 'Main.js', 'text/javascript'); // otherwise it is in "production" context } else { $this->view->headScript()->appendFile($baseJavascriptPath . 'Main-production.js', 'text/javascript'); } $this->view->translate = $this->_owApp->translate; $this->view->staticUrlBase = $this->_config->staticUrlBase; $this->view->cubevizImagesPath = $basePath . 'public/images/'; $on = $this->_owApp->getNavigation(); $on->disableNavigation(); // disable OntoWiki's Navigation /** * load data and setup view */ $store = $this->_erfurt->getStore(); $th = new OntoWiki_Model_TitleHelper(null, $store); $models = $store->getAvailableModels(); $this->view->models = array(); // config for frontend if (false === CubeViz_ViewHelper::$isCubeVizAppLoaded) { $config['backend'] = array('context' => $this->_privateConfig->get('context'), 'database' => $this->_owApp->getConfig()->store->backend, 'dataHash' => '', 'imagesPath' => $baseImagesPath, 'modelInformation' => array(), 'modelUrl' => '', 'serviceUrl' => '', 'uiHash' => '', 'uiParts' => array('dataselectionModule' => array()), 'uiSettings' => array(), 'retrievedObservations' => array(), 'url' => $this->_config->staticUrlBase . 'cubeviz/'); $this->view->headScript()->appendScript('cubeVizApp._ = ' . json_encode($config, JSON_FORCE_OBJECT) . ';')->appendScript('cubeVizApp._.backend.chartConfig = CubeViz_ChartConfig;'); } // each element will be an object (acting as an associative array) // with "1" or "2" as key (index) $config['compareAction'] = array('datasets' => array(1 => null, 2 => null), 'components' => array('dimensions' => array(1 => null, 2 => null), 'measures' => array(1 => null, 2 => null), 'attributes' => array(1 => null, 2 => null)), 'models' => array(1 => null, 2 => null), 'originalObservations' => array(1 => null, 2 => null), 'retrievedObservations' => array(1 => null, 2 => null), 'slices' => array(1 => null, 2 => null), 'equalDimensions' => array(), 'unequalDimensions' => array(1 => null, 2 => null), 'numberOfObservations' => array(1 => -1, 2 => -1)); $this->view->headScript()->appendScript('cubeVizApp._.compareAction = ' . json_encode($config['compareAction'], JSON_FORCE_OBJECT) . ';'); // modellist foreach ($models as $modelUri => $entry) { $th->addResource($modelUri); } foreach ($models as $modelUri => $entry) { $this->view->models[] = array('label' => $th->getTitle($modelUri), 'uri' => $modelUri); } }