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);
     } else {
         if ($doc_type == 'json') {
             send_json('200 OK', $g->to_json(), $content_location, $etag);
         } else {
             header("Content-Type: text/html; charset=UTF-8");
             $title = $g->get_label($resource_uri, TRUE);
             $page_title = 'Linked Data for ' . $g->get_label($resource_uri, TRUE) . ' | ' . htmlspecialchars($this_host);
             $body .= '<p>A description of the resource identified by <a href="' . htmlspecialchars($resource_uri) . '">' . htmlspecialchars($resource_uri) . '</a></p>' . "\n";
             $body .= '          <table class="linkeddata" summary="RDF description of the resource identified by ' . htmlspecialchars($resource_uri) . '. Property names are in the first column, values are in the second.">' . "\n";
             $body .= '            <tbody>' . "\n";
             $properties = $g->get_subject_properties($resource_uri, TRUE);
             $priority_properties = array_intersect($ordered_properties, $properties);
             $remaining_properties = array_diff($properties, $priority_properties);
             sort($remaining_properties);
             $properties = array_merge($priority_properties, $remaining_properties);
             $class = 'oddrow';
             $index = $g->get_index();
             foreach ($properties as $p) {
                 $body .= '              <tr class="' . $class . '">' . "\n";
                 $body .= '                <th valign="top" class="' . $class . '"><a href="' . htmlspecialchars($p) . '">' . htmlspecialchars($g->get_label($p, TRUE)) . '</a></th>' . "\n";
                 $body .= '                <td valign="top" class="' . $class . '">';
                 for ($i = 0; $i < count($index[$resource_uri][$p]); $i++) {
                     if ($i > 0) {
                         $body .= ', ';
                     }
                     if ($index[$resource_uri][$p][$i]['type'] === 'literal') {