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, [ $filename = NULL])
static object The register (string $name, [string $label = null], [string $uri = null], [string $mimeTypes = array()], [string $extensions = array()])
static void registerParser (string $name, string $class)
static void registerSerialiser (string $name, string $class)
static void unregister (string $name)
string getDefaultMimeType ()
array getExtensions ()
string getLabel ()
array getMimeTypes ()
string getName ()
string getParserClass ()
string getSerialiserClass ()
string getUri ()
object The newParser ()
object The newSerialiser ()
void setExtensions ( $extensions, array $mimeTypes)
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 121)

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 132)

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 75)

Get a list of all the registered formats

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

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 66)

Get a list of format names

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

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, [ $filename = NULL])
  • string $data: The document data
  • $filename
static method register (line 164)

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 $extensions = 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
  • string $extensions: One or more extensions (file suffix)
static method registerParser (line 198)

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 210)

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 188)

Remove a format from the registry

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

Get the default registered file extension (filename suffix) for a format object

  • return: The default extension as a string.
  • access: public
string getDefaultExtension ()
getDefaultMimeType (line 343)

Get the default registered mime type for a format object

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

Get all the registered file extensions (filename suffix) for a format object

  • return: One or more extensions as an array
  • access: public
array getExtensions ()
getLabel (line 289)

Get the label for a format object

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

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 280)

Get the name of a format object

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

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

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

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

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

Get the URI for a format object

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

Create a new parser to parse this format

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

Create a new serialiser to parse this format

  • return: new serialiser object
  • access: public
object The newSerialiser ()
setExtensions (line 397)

Set the file format extensions (filename suffix) for a format object

  • access: public
void setExtensions ( $extensions, array $mimeTypes)
  • array $mimeTypes: One or more file extensions
  • $extensions
setLabel (line 298)

Set the label for a format object

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

Set the MIME Types for a format object

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

Set the parser to use for a format

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

Set the serialiser to use for a format

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

Set the URI for a format object

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

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, 16 Jan 2013 19:16:37 +0000 by phpDocumentor 1.4.4