Beispiel #1
0
/**
 * @param \Tripod\ExtendedGraph $graph
 * @param string $format
 * @return string
 */
function getFormattedGraph(\Tripod\ExtendedGraph $graph, $format)
{
    switch ($format) {
        case FORMAT_RDF_XML:
            $output = $graph->to_rdfxml();
            break;
        case FORMAT_NTRIPLES:
            $output = $graph->to_ntriples();
            break;
        case FORMAT_TURTLE:
            $output = $graph->to_turtle();
            break;
        default:
            $output = $graph->to_json();
    }
    return $output;
}