public static function EasyRdf_Format::getFormat in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Format.php \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 vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Format.php - Attempt to guess the document format from some content.
- EasyRdf_Graph::parse in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Graph.php - Parse some RDF data into the graph object.
- EasyRdf_Graph::serialise in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Graph.php - Serialise the graph into RDF
- EasyRdf_GraphStore::sendGraph in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ GraphStore.php - Send some graph data to the graph store
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Format.php, line 132
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}");
}