function rdfx_fetch_rdf in RDF Extensions 7.2
Loads an RDF file from an HTTP URI or local file, parses it, and builds an RDF schema representation (associative array) from it.
Parameters
$uri: The namespace URI for this graph.
$prefix: The prefix for this graph.
$filename (optional): A local RDF file to parse.
Return value
array
Throws
Exception On network or parse error
1 call to rdfx_fetch_rdf()
- evoc_fetch_vocabulary in evoc/
evoc.module - Fetches the classes and properties of an external RDF vocabulary.
File
- ./
rdfx.import.inc, line 21 - Functions for importing and parsing RDF data.
Code
function rdfx_fetch_rdf($uri, $prefix, $filename = NULL) {
if ($filename != NULL) {
if (!is_file($filename)) {
throw new Exception("File not found: '{$filename}'");
return;
}
$content = file_get_contents($filename);
return _rdfx_parse_rdf($uri, $content);
}
$schema_url = $uri;
$i = strpos($schema_url, '#');
if ($i !== false) {
$schema_url = substr($schema_url, 0, $i);
}
return _rdfx_parse_rdf($uri);
}