Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customizable Graph class #380

Open
madbob opened this issue Apr 4, 2021 · 2 comments
Open

customizable Graph class #380

madbob opened this issue Apr 4, 2021 · 2 comments

Comments

@madbob
Copy link

madbob commented Apr 4, 2021

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...

@njh
Copy link
Collaborator

njh commented Apr 5, 2021

Sounds like an interesting enhancement. Out of interest, what customisations are you doing to your Graph class?

@madbob
Copy link
Author

madbob commented Apr 6, 2021

Pull request #381

(I'm intercepting add() and deleteSingleProperty() calls to keep track of modifications operated directly into the Graph and provide further elaborations).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants