Beispiel #1
0
 protected function _writeUri($uri)
 {
     $prefix = null;
     $splitIdx = Erfurt_Syntax_Utils_Turtle::findUriSplitIndex($uri);
     if ($splitIdx !== false) {
         $ns = substr($uri, 0, $splitIdx);
         if (isset($this->_namespaces[$ns])) {
             $prefix = $this->_namespaces[$ns];
         } else {
             if (null !== $this->_baseUri && substr($uri, 0, $splitIdx) === $this->_baseUri) {
                 $prefix = null;
                 $uri = substr($uri, $splitIdx);
             } else {
                 // We need to support large exports so we add namespaces once and write uris that do not match as
                 // full uris.
                 //$this->_addNamespace($ns);
                 //$prefix = $this->_namespaces[$ns];
             }
         }
         if (null !== $prefix) {
             $this->_write($prefix . ':' . substr($uri, $splitIdx));
             $this->_lastWrittenUriLength = strlen($prefix . ':' . substr($uri, $splitIdx));
         } else {
             $this->_write('<' . $uri . '>');
             $this->_lastWrittenUriLength = strlen('<' . $uri . '>');
         }
     } else {
         if (null !== $this->_baseUri && $uri === $this->_baseUri) {
             $this->_write('<>');
             $this->_lastWrittenUriLength = strlen('<>');
         } else {
             $this->_write('<' . $uri . '>');
             $this->_lastWrittenUriLength = strlen('<' . $uri . '>');
         }
     }
 }