Git Product home page Git Product logo

Comments (5)

arne-bdt avatar arne-bdt commented on June 3, 2024 1

Thanks for your advice!

I added the Copyable<> interface in org.apache.jena.atlas.lib. That seemed to be the appropriate location since e.g. the Closeble interface is also located there.

G#copy is also available.

from jena.

arne-bdt avatar arne-bdt commented on June 3, 2024

I implemented the feature in a separate clean branch .
Any comments are welcome.

from jena.

arne-bdt avatar arne-bdt commented on June 3, 2024

Could someone take a look at this improvement?

Unfortunately, I don't see a way to implement really fast cloning of graphs as a lightweight sidecar or in a separate module or project.
I have extended the underlying collections and then implemented the function within the graphs.

If I want to use fast cloning today, I need to maintain duplicates of the source code of the collections and the graphs in my project.
--> Do you see the extension as beneficial for the Jena project?
--> Otherwise, I would also be happy if someone had an idea for a less invasive implementation.

from jena.

rvesse avatar rvesse commented on June 3, 2024

Could someone take a look at this improvement?

Unfortunately, I don't see a way to implement really fast cloning of graphs as a lightweight sidecar or in a separate module or project. I have extended the underlying collections and then implemented the function within the graphs.

Tbh the branch doesn't look that heavyweight to me.

What I might consider is generalising your approach by adding a new interface Copyable<T> which provides a single T copy() method and having all relevant interfaces/classes extend/implement as appropriate.

You could then consider adding a new utility method Graph G.copy(Graph original) that could check whether the provided instance implements the new interface, and if so defers to the copy() method, otherwise does G.copyGraphSrcToDst(original, GraphFactory.createGraphMem())

If I want to use fast cloning today, I need to maintain duplicates of the source code of the collections and the graphs in my project. --> Do you see the extension as beneficial for the Jena project? --> Otherwise, I would also be happy if someone had an idea for a less invasive implementation.

Yes there's definitely value here

Generalising it and making it opt-in may make it less invasive and allow us to adopt it over time in other places as appropriate.

from jena.

rvesse avatar rvesse commented on June 3, 2024

For reference - G.copyGraphSrcToDst() - which is basically equivalent to your copy in your description

from jena.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.