die("no URI"); } $uri = $_REQUEST['URI']; $rdf = ""; $uri = preg_replace("/^(?!http:\\/\\/)/", "http://", $uri); $objsrc = file_get_contents($uri); include_once "../Graphite.php"; include_once "../arc/ARC2.php"; $g = new Graphite(); $finfo = new finfo(FILEINFO_MIME_TYPE); $mimetype = $finfo->buffer($objsrc); if ($mimetype == "application/RDF+XML") { $g->addRDFXML("", $objsrc); $rdf = $objsrc; } elseif ($mimetype == "text/turtle") { $g->addTurtle("", $objsrc); $rdf = $objsrc; } elseif ($mimetype == "text/html") { //Try to get RDFXML link in the link section in the head // $rdfuri = ""; // $model = str_get_html($objsrc); // // foreach( $model->find('head',0)->find('link') as $link ){ // if ($link->type == 'application/rdf+xml'){ // $rdfuri = $link->href; // $rdf = file_get_contents($rdfuri); // $uri = preg_replace("/rdf/","id", $rdfuri); // $g->addRDFXML("", $rdf); // } else { // die ("No RDF found"); // }