Class EasyRdf_Format

Description

Class the represents an RDF file format.

For each format, the name, label, URIs and associated MIME Types are stored. A single parser and serialiser can also be registered to each format.

Located in /EasyRdf/Format.php (line 50)


	
			
Method Summary
static boolean formatExists (string $name)
static object the getFormat (string $query)
static array getFormats ()
static string getHttpAcceptHeader ([array $extraTypes = array()])
static array getNames ()
static EasyRdf_Format guessFormat (string $data)
static object The register (string $name, [string $label = null], [string $uri = null], [string $mimeTypes = array()])
static void registerParser (string $name, string $class)
static void registerSerialiser (string $name, string $class)
static void unregister (string $name)
string getDefaultMimeType ()
string getLabel ()
array getMimeTypes ()
string getName ()
string getParserClass ()
string getSerialiserClass ()
string getUri ()
object The newParser ()
object The newSerialiser ()
void setLabel (string $label)
void setMimeTypes (array $mimeTypes)
void setParserClass (string $class)
void setSerialiserClass (string $class)
void setUri (string $uri)
string __toString ()
Methods
static method formatExists (line 120)

Check if a named graph exists

  • return: true if the format exists
  • access: public
static boolean formatExists (string $name)
  • string $name: the name of the format
static method getFormat (line 131)

Get a EasyRdf_Format from a name, uri or mime type

  • return: first EasyRdf_Format that matches the query
  • throws: EasyRdf_Exception if no format is found
  • access: public
static object the getFormat (string $query)
  • string $query: a query string to search for
static method getFormats (line 74)

Get a list of all the registsed formats

  • return: An array of format objects
  • access: public
static array getFormats ()
static method getHttpAcceptHeader (line 92)

Generates an HTTP Accept header string

The string will contain all of the MIME Types that we are able to parse.

It is also possible to specify additional MIME types in the form array('text/plain' => 0.5) where 0.5 is the q value for that type. The types are sorted by q value before constructing the string.

  • return: list of supported MIME types
  • access: public
static string getHttpAcceptHeader ([array $extraTypes = array()])
  • array $extraTypes: extra MIME types to add
static method getNames (line 65)

Get a list of format names

  • return: An array of formats name
  • access: public
static array getNames ()
static method guessFormat (line 220)

Attempt to guess the document format from some content.

If the document format is not recognised, null is returned.

  • return: The format object
  • access: public
static EasyRdf_Format guessFormat (string $data)
  • string $data: The document data
static method register (line 161)

Register a new format

  • return: new EasyRdf_Format object
  • access: public
static object The register (string $name, [string $label = null], [string $uri = null], [string $mimeTypes = array()])
  • string $name: The name of the format (e.g. ntriples)
  • string $label: The label for the format (e.g. N-Triples)
  • string $uri: The URI for the format
  • string $mimeTypes: One or more mime types for the format
static method registerParser (line 194)

Class method to register a parser class to a format name

  • access: public
static void registerParser (string $name, string $class)
  • string $name: The name of the format (e.g. ntriples)
  • string $class: The name of the class (e.g. EasyRdf_Parser_Ntriples)
static method registerSerialiser (line 206)

Class method to register a serialiser class to a format name

  • access: public
static void registerSerialiser (string $name, string $class)
  • string $name: The name of the format (e.g. ntriples)
  • string $class: The name of the class (e.g. EasyRdf_Serialiser_Ntriples)
static method unregister (line 184)

Remove a format from the registry

  • access: public
static void unregister (string $name)
  • string $name: The name of the format (e.g. ntriples)
getDefaultMimeType (line 334)

Get the default registered mime type for a format object

  • return: The default mime type as a string.
  • access: public
string getDefaultMimeType ()
getLabel (line 280)

Get the label for a format object

  • return: The format label (e.g. RDF/XML)
  • access: public
string getLabel ()
getMimeTypes (line 345)

Get all the registered mime types for a format object

  • return: One or more MIME types in an array with the mime type as the key and q value as the value
  • access: public
array getMimeTypes ()
getName (line 271)

Get the name of a format object

  • return: The name of the format (e.g. rdfxml)
  • access: public
string getName ()
getParserClass (line 388)

Get the name of the class to use to parse the format

  • return: The name of the class
  • access: public
string getParserClass ()
getSerialiserClass (line 430)

Get the name of the class to use to serialise the format

  • return: The name of the class
  • access: public
string getSerialiserClass ()
getUri (line 307)

Get the URI for a format object

  • return: The format URI
  • access: public
string getUri ()
newParser (line 397)

Create a new parser to parse this format

  • return: new parser object
  • access: public
object The newParser ()
newSerialiser (line 439)

Create a new serialiser to parse this format

  • return: new serialiser object
  • access: public
object The newSerialiser ()
setLabel (line 289)

Set the label for a format object

  • access: public
void setLabel (string $label)
  • string $label: The new label for the format
setMimeTypes (line 354)

Set the MIME Types for a format object

  • access: public
void setMimeTypes (array $mimeTypes)
  • array $mimeTypes: One or more mime types
setParserClass (line 370)

Set the parser to use for a format

  • access: public
void setParserClass (string $class)
  • string $class: The name of the class
setSerialiserClass (line 412)

Set the serialiser to use for a format

  • access: public
void setSerialiserClass (string $class)
  • string $class: The name of the class
setUri (line 316)

Set the URI for a format object

  • access: public
void setUri (string $uri)
  • string $uri: The new URI for the format
__toString (line 454)

Magic method to return the name of the format when casted to string

  • return: The name of the format
  • access: public
string __toString ()

Documentation generated on Wed, 20 Jul 2011 19:54:03 +0100 by phpDocumentor 1.4.3