public function EasyRdf_Graph::parse

Parse some RDF data into the graph object.

Parameters

string $data Data to parse for the graph:

string $format Optional format of the data:

string $uri The URI of the data to load:

Return value

integer The number of triples added to the graph

3 calls to EasyRdf_Graph::parse()
EasyRdf_Graph::load in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Load RDF data into the graph from a URI.
EasyRdf_Graph::parseFile in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Parse a file containing RDF data into the graph object.
EasyRdf_Graph::__construct in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Constructor

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php, line 211

Class

EasyRdf_Graph
Container for collection of EasyRdf_Resources.

Code

public function parse($data, $format = null, $uri = null) {
  $this
    ->checkResourceParam($uri, true);
  if (empty($format) or $format == 'guess') {

    // Guess the format if it is Unknown
    $format = EasyRdf_Format::guessFormat($data, $uri);
  }
  else {
    $format = EasyRdf_Format::getFormat($format);
  }
  if (!$format) {
    throw new EasyRdf_Exception("Unable to parse data of an unknown format.");
  }
  $parser = $format
    ->newParser();
  return $parser
    ->parse($this, $data, $format, $uri);
}