public function test_get_record_by_uri() { //$this->tester->haveInDatabase( "reg_prefix", [ 'uri' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", 'rank' => '2', 'rdf' ] ); $this->specify( "that the record can be retrieved by uri", function () { verify( $this->PrefixPeer->findByUri( "http://www.w3.org/1999/02/22-rdf-syntax-ns#" )->getPrefix() )->equals( "rdf" ); } ); }
public function retrievePrefixes() { $prefixes = $this->schema->getPrefixes(); if ('schema' === $this->type) { $namespaces = \SchemaPropertyElementPeer::getNamespaceList($this->schema->getId()); } else { $namespaces = \VocabularyPeer::getNamespaceList($this->schema->getId()); } //check the retrieved namespaces for a match to existing prefixes foreach ($namespaces as $uri) { //if we find the uri in existing schema prefixes, move on if ($prefixes and array_search($uri, $prefixes) !== false) { continue; } //look for it in Prefixes table $namespacePrefix = \PrefixPeer::findByUri($uri); if ($namespacePrefix) { //add it to the prefix array $prefixes[ $namespacePrefix->getPrefix() ] = $uri; } //check it against the schema token elseif (trim($uri, "/#") == trim($this->schema->getUri(), "#/")) { $prefixes[ $this->schema->getToken() ] = $uri; } else { $prefixes[ ] = $uri; } } if (empty($prefixes)) { $prefixes = $this->getDefaultPrefix(); } return $prefixes; }