bnodeMap[$name])) { $this->bnodeMap[$name] = $this->graph->newBNodeId(); } return $this->bnodeMap[$name]; } /** * Delete the bnode mapping - to be called at the start of a new parse * @ignore */ protected function resetBnodeMap() { $this->bnodeMap = array(); } /** * Check, cleanup parameters and prepare for parsing * @ignore */ protected function checkParseParams($graph, $data, $format, $baseUri) { if ($graph == null or !is_object($graph) or !($graph instanceof EasyRdf_Graph)) { throw new InvalidArgumentException( "\$graph should be an EasyRdf_Graph object and cannot be null" ); } else { $this->graph = $graph; } if ($format == null or $format == '') { throw new InvalidArgumentException( "\$format cannot be null or empty" ); } elseif (is_object($format) and $format instanceof EasyRdf_Format) { $this->format = $format = $format->getName(); } elseif (!is_string($format)) { throw new InvalidArgumentException( "\$format should be a string or an EasyRdf_Format object" ); } else { $this->format = $format; } if ($baseUri) { if (!is_string($baseUri)) { throw new InvalidArgumentException( "\$baseUri should be a string" ); } else { $this->baseUri = new EasyRdf_ParsedUri($baseUri); } } else { $this->baseUri = null; } // Prepare for parsing $this->resetBnodeMap(); $this->tripleCount = 0; } /** * Sub-classes must follow this protocol * @ignore */ public function parse($graph, $data, $format, $baseUri) { throw new EasyRdf_Exception( "This method should be overridden by sub-classes." ); } /** * Add a triple to the current graph, and keep count of the number of triples * @ignore */ protected function addTriple($resource, $property, $value) { $count = $this->graph->add($resource, $property, $value); $this->tripleCount += $count; return $count; } }