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 . '>'); } } }
protected function _writeObject($o, $oType, $lang = null, $dType = null) { if ($oType === 'uri') { $this->_writeUri($o); } else { if ($oType === 'bnode') { $this->_writeBNode($o); } else { $this->_write('"'); $this->_write(Erfurt_Syntax_Utils_Turtle::encodeString($o)); $this->_write('"'); if (null !== $lang) { $this->_write('@' . $lang); } else { if (null !== $dType) { $this->_write('^^'); $this->_writeUri($dType); } } } } }