function testQueryGetFullUri() { $q = new Query(); $q->addPrefix('rdfs', 'http://www.w3.org/2000/01/rdf-schema#'); $q->addPrefix('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); $q->addPrefix('xsd', 'http://www.w3.org/2001/XMLSchema#'); $this->assertEqual('http://www.w3.org/2001/XMLSchema#integer', $q->getFullUri('xsd:integer')); $this->assertFalse($q->getFullUri('yyy:integer')); $this->assertFalse($q->getFullUri('integer')); }
/** * Adds a new namespace prefix to the query object. * * @return void * @throws SparqlParserException */ protected function parsePrefix() { $this->_fastForward(); $prefix = substr(current($this->tokens), 0, -1); $this->_fastForward(); if ($this->iriCheck(current($this->tokens))) { $uri = substr(current($this->tokens), 1, -1); $this->query->addPrefix($prefix, $uri); } else { $msg = current($this->tokens); $msg = preg_replace('/</', '<', $msg); throw new SparqlParserException("IRI expected", null, key($this->tokens)); } }