public static function EasyRdf_Format::getFormat

Get a EasyRdf_Format from a name, uri or mime type

Parameters

string $query a query string to search for:

Return value

object the first EasyRdf_Format that matches the query

Throws

EasyRdf_Exception if no format is found

4 calls to EasyRdf_Format::getFormat()
EasyRdf_Format::guessFormat in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Format.php
Attempt to guess the document format from some content.
EasyRdf_Graph::parse in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Parse some RDF data into the graph object.
EasyRdf_Graph::serialise in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Serialise the graph into RDF
EasyRdf_GraphStore::sendGraph in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/GraphStore.php
Send some graph data to the graph store

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Format.php, line 133

Class

EasyRdf_Format
Class the represents an RDF file format.

Code

public static function getFormat($query) {
  if (!is_string($query) or $query == null or $query == '') {
    throw new InvalidArgumentException("\$query should be a string and cannot be null or empty");
  }
  foreach (self::$formats as $format) {
    if ($query == $format->name or $query == $format->uri or array_key_exists($query, $format->mimeTypes) or in_array($query, $format->extensions)) {
      return $format;
    }
  }

  # No match
  throw new EasyRdf_Exception("Format is not recognised: {$query}");
}