function test_resource_is_first_list() { $Graph = new PueliaGraph(file_get_contents('documents/test-data.ttl')); $parentLists = $Graph->get_subjects_where_resource(RDF_REST, '_:lastList'); $this->assertFalse($Graph->resource_is_first_list('_:lastList'), "should return false because list is linked to from another list"); $this->assertTrue($Graph->resource_is_first_list('_:itemsList'), "should return true because list is not rdf:rest of any other list"); }
public function add_rdf($rdf, $base = false) { $return = parent::add_rdf($rdf, $base); foreach ($this->get_subjects() as $s) { $this->remove_property_values($s, 'http://schemas.talis.com/2005/dir/schema#etag'); } return $return; }
function get_label($uri, $capitalize = false, $use_qnames = FALSE) { if ($label = $this->_config->get_first_literal($uri, RDFS_LABEL)) { return $label; } if ($label = $this->_config->get_first_literal($uri, API . 'name')) { return $label; } if ($label = $this->_config->get_first_literal($uri, API . 'label')) { return $label; } else { return parent::get_label($uri, $capitalize, $use_qnames); } }
function add_rdf($rdf = false, $base = '') { preg_match_all('/@prefix\\s+(.+?):\\s+<(.+?)>/', $rdf, $m); foreach ($m[1] as $n => $prefix) { $this->prefixesFromLoadedTurtle[$prefix] = $m[2][$n]; } parent::add_rdf($rdf, $base); }
function getListOfUrisFromSearchEndpoint() { // get searchindexendpoint $rssTextSearchIndex = $this->ConfigGraph->getRssTextSearchIndex(); // construct url with search parameter $searchQuery = $this->Request->getParam('_search'); $filterstring = implode('&', $this->ConfigGraph->getAllFilters()); foreach ($this->Request->getUnreservedParams() as $k => $v) { list($k, $v) = array(urlencode($k), urlencode($v)); $filterstring .= "&{$k}={$v}"; } $params = queryStringToParams($filterstring); $query_filter = ''; foreach ($params as $k => $v) { if ($uri = $this->ConfigGraph->getUriForVocabPropertyLabel($v)) { $v = $uri; } $query_filter .= ' ' . $k . ':' . addcslashes($v, ':'); } $queryUri = $rssTextSearchIndex . '?query=' . urlencode($searchQuery . $query_filter); logDebug($queryUri); $request = $this->HttpRequestFactory->make('GET', $queryUri); $request->set_accept(PUELIA_RDF_ACCEPT_MIMES); // do request $response = $request->execute(); if ($response->is_success()) { $ListGraph = new PueliaGraph(); $ListGraph->add_rdf($response->body); //get Sequence $SequenceUri = $ListGraph->get_first_resource($queryUri, RSS_ITEMS); $this->list_of_item_uris = $ListGraph->get_sequence_values($SequenceUri); return $this->list_of_item_uris; } else { logError("Endpoint returned {$response->status_code} {$response->body} Search Query URI: {$queryUri}"); $this->setStatusCode(HTTP_Internal_Server_Error); $this->errorMessages[] = "The endpoint used for this search did not return a successful response."; } return array(); }