class EasyRdf_Format
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.
Methods
static array |
getNames()
Get a list of format names |
|
static array |
getFormats()
Get a list of all the registered formats |
|
static string |
getHttpAcceptHeader(array $extraTypes = array())
Generates an HTTP Accept header string |
|
static boolean |
formatExists(string $name)
Check if a named graph exists |
|
static object |
getFormat(string $query)
Get a EasyRdf_Format from a name, uri or mime type |
|
static object |
register(string $name, string $label = null, string $uri = null, string $mimeTypes = array(), string $extensions = array())
Register a new format |
|
static |
unregister(string $name)
Remove a format from the registry |
|
static |
registerParser(string $name, string $class)
Class method to register a parser class to a format name |
|
static |
registerSerialiser(string $name, string $class)
Class method to register a serialiser class to a format name |
|
static object |
guessFormat(string $data, string $filename = null)
Attempt to guess the document format from some content. |
|
__construct(string $name)
This constructor is for internal use only. |
||
string |
getName()
Get the name of a format object |
|
string |
getLabel()
Get the label for a format object |
|
setLabel(string $label)
Set the label for a format object |
||
string |
getUri()
Get the URI for a format object |
|
setUri(string $uri)
Set the URI for a format object |
||
string |
getDefaultMimeType()
Get the default registered mime type for a format object |
|
array |
getMimeTypes()
Get all the registered mime types for a format object |
|
setMimeTypes(array $mimeTypes)
Set the MIME Types for a format object |
||
string |
getDefaultExtension()
Get the default registered file extension (filename suffix) for a format object |
|
array |
getExtensions()
Get all the registered file extensions (filename suffix) for a format object |
|
setExtensions(mixed $extensions)
Set the file format extensions (filename suffix) for a format object |
||
setParserClass(string $class)
Set the parser to use for a format |
||
string |
getParserClass()
Get the name of the class to use to parse the format |
|
object |
newParser()
Create a new parser to parse this format |
|
setSerialiserClass(string $class)
Set the serialiser to use for a format |
||
string |
getSerialiserClass()
Get the name of the class to use to serialise the format |
|
object |
newSerialiser()
Create a new serialiser to parse this format |
|
string |
__toString()
Magic method to return the name of the format when casted to string |
Details
at line 65
static public array
getNames()
Get a list of format names
at line 74
static public array
getFormats()
Get a list of all the registered formats
at line 92
static public string
getHttpAcceptHeader(array $extraTypes = array())
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.
at line 121
static public boolean
formatExists(string $name)
Check if a named graph exists
at line 132
static public object
getFormat(string $query)
Get a EasyRdf_Format from a name, uri or mime type
at line 164
static public object
register(string $name, string $label = null, string $uri = null, string $mimeTypes = array(), string $extensions = array())
Register a new format
at line 192
static public
unregister(string $name)
Remove a format from the registry
at line 202
static public
registerParser(string $name, string $class)
Class method to register a parser class to a format name
at line 215
static public
registerSerialiser(string $name, string $class)
Class method to register a serialiser class to a format name
at line 233
static public object
guessFormat(string $data, string $filename = null)
Attempt to guess the document format from some content.
If $filename is given, then the suffix is first used to guess the format.
If the document format is not recognised, null is returned.
at line 279
public
__construct(string $name)
This constructor is for internal use only.
To create a new format, use the register method.
at line 289
public string
getName()
Get the name of a format object
at line 298
public string
getLabel()
Get the label for a format object
at line 307
public
setLabel(string $label)
Set the label for a format object
at line 325
public string
getUri()
Get the URI for a format object
at line 334
public
setUri(string $uri)
Set the URI for a format object
at line 352
public string
getDefaultMimeType()
Get the default registered mime type for a format object
at line 365
public array
getMimeTypes()
Get all the registered mime types for a format object
at line 374
public
setMimeTypes(array $mimeTypes)
Set the MIME Types for a format object
at line 390
public string
getDefaultExtension()
Get the default registered file extension (filename suffix) for a format object
at line 401
public array
getExtensions()
Get all the registered file extensions (filename suffix) for a format object
at line 410
public
setExtensions(mixed $extensions)
Set the file format extensions (filename suffix) for a format object
at line 426
public
setParserClass(string $class)
Set the parser to use for a format
at line 444
public string
getParserClass()
Get the name of the class to use to parse the format
at line 453
public object
newParser()
Create a new parser to parse this format
at line 468
public
setSerialiserClass(string $class)
Set the serialiser to use for a format
at line 486
public string
getSerialiserClass()
Get the name of the class to use to serialise the format
at line 495
public object
newSerialiser()
Create a new serialiser to parse this format
at line 510
public string
__toString()
Magic method to return the name of the format when casted to string