easyrdf
easyrdf copied to clipboard
customizable Graph class
Would be useful to add a TypeMapper::setDefaultGraphClass() method to permit customization (and extension) of the base Graph class.
Actually I had such a need, but the only solution I found was to get the Graph from Sparql\Client::query() and translate it within my own class:
use EasyRdf\Graph;
class MyGraph extends Graph
{
public static function extend($real_graph)
{
$contents = $real_graph->serialise('turtle');
return new self($real_graph->getUri(), $contents, 'turtle');
}
// ... my own stuff...
}
Not very efficient...
Sounds like an interesting enhancement. Out of interest, what customisations are you doing to your Graph class?
Pull request #381
(I'm intercepting add() and deleteSingleProperty() calls to keep track of modifications operated directly into the Graph and provide further elaborations).