function _rdfx_parse_rdf in RDF Extensions 7.2
1 call to _rdfx_parse_rdf()
- rdfx_fetch_rdf in ./rdfx.import.inc
- Loads an RDF file from an HTTP URI or local file, parses it, and builds an
RDF schema representation (associative array) from it.
File
- ./rdfx.import.inc, line 39
- Functions for importing and parsing RDF data.
Code
function _rdfx_parse_rdf($base_uri) {
$namespaces = array();
$parser = ARC2::getRDFParser();
$parser
->parse($base_uri);
switch ($parser->format) {
case 'turtle':
foreach ($parser->parser->prefixes as $prefix => $uri) {
$formatted_prefix = str_replace(':', '', $prefix);
$namespaces[$formatted_prefix] = $uri;
}
break;
default:
foreach ($parser->parser->nsp as $uri => $prefix) {
$namespaces[$prefix] = $uri;
}
break;
}
return array(
$parser
->getTriples(),
$namespaces,
);
}