<?
# Testing SimpleRdfParser.

# Copyright (c) 2002-2004 Morten Frederiksen
# License: http://www.gnu.org/licenses/gpl

define('RDFAPI_INCLUDE_DIR', '/net/home/web/www/share/php/rdfapi-php/api/');
require_once(
'SimpleRdfParser.php');

$uri='http://www.wasab.dk/morten/2004/05/SimpleRdfParser-example-in.rdf';
$error='';

# Parse and reserialise.
$p = new SimpleRdfParser();
$rdf = @file($uri);
if (
is_array($rdf)) {
    
$rdf = join('', $rdf);
    if (
is_array($error = @$p->string2triples($rdf, $uri))) {
        
#print_r($error);
        #exit;
        
$xml = $p->triples2string();
        
header('Content-Type: application/rdf+xml');
        print(
$xml);
        exit;
    }
} else
    
$error = 'Unable to fetch from ' . $uri;

print(
$error);