You are here

protected function EasyRdf_Sparql_Client::convertToTriples in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Client.php \EasyRdf_Sparql_Client::convertToTriples()
2 calls to EasyRdf_Sparql_Client::convertToTriples()
EasyRdf_Sparql_Client::insert in vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Client.php
EasyRdf_Sparql_Client::updateData in vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Client.php

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Client.php, line 296

Class

EasyRdf_Sparql_Client
Class for making SPARQL queries using the SPARQL 1.1 Protocol

Code

protected function convertToTriples($data) {
  if (is_string($data)) {
    return $data;
  }
  elseif (is_object($data) and $data instanceof EasyRdf_Graph) {

    # FIXME: insert Turtle when there is a way of seperateing out the prefixes
    return $data
      ->serialise('ntriples');
  }
  else {
    throw new EasyRdf_Exception("Don't know how to convert to triples for SPARQL query: " . $response
      ->getBody());
  }
}