function get_label($uri, $capitalize = false, $use_qnames = FALSE)
 {
     if ($label = $this->get_first_literal($uri, RDFS_LABEL)) {
         return $label;
     }
     if ($label = $this->get_first_literal($uri, API . 'name')) {
         return $label;
     }
     if ($label = $this->get_first_literal($uri, API . 'label')) {
         return $label;
     } else {
         return parent::get_label($uri, $capitalize, $use_qnames);
     }
 }
 }
 $g = new SimpleGraph();
 $g->from_json($response->body);
 if (!$g->has_triples_about($resource_uri)) {
     send_not_found($uri, $template);
 } else {
     $g->remove_property_values($resource_uri, 'http://schemas.talis.com/2005/dir/schema#etag');
     if ($uri != $doc_uri) {
         header("HTTP/1.1 303 See Other");
         header("Location: " . $doc_uri);
         exit;
     } else {
         $g->add_resource_triple($doc_uri, RDF_TYPE, FOAF_DOCUMENT);
         $g->add_resource_triple($doc_uri, RDF_TYPE, 'http://purl.org/dc/dcmitype/Text');
         $g->add_resource_triple($doc_uri, FOAF_PRIMARYTOPIC, $resource_uri);
         $g->add_literal_triple($doc_uri, 'http://purl.org/dc/terms/title', 'Linked Data for ' . $g->get_label($resource_uri, TRUE));
         foreach ($media_types as $extension => $type_info) {
             $alt_uri = $resource_uri . '.' . $extension;
             $g->add_resource_triple($doc_uri, 'http://purl.org/dc/terms/hasFormat', $alt_uri);
             $g->add_resource_triple($alt_uri, 'http://purl.org/dc/terms/isFormatOf', $doc_uri);
             $g->add_resource_triple($alt_uri, RDF_TYPE, 'http://purl.org/dc/dcmitype/Text');
             $g->add_resource_triple($alt_uri, RDF_TYPE, FOAF_DOCUMENT);
             $g->add_resource_triple($alt_uri, FOAF_PRIMARYTOPIC, $resource_uri);
             $g->add_literal_triple($alt_uri, 'http://purl.org/dc/terms/format', $type_info['type']);
             $g->add_literal_triple($alt_uri, 'http://purl.org/dc/terms/title', 'Linked Data in ' . $type_info['label'] . ' format for ' . $g->get_label($resource_uri, TRUE));
         }
         if ($doc_type == 'rdf') {
             send_rdfxml('200 OK', $g->to_rdfxml(), $content_location, $etag);
         } else {
             if ($doc_type == 'ttl') {
                 send_turtle('200 OK', $g->to_turtle(), $content_location, $etag);