Giter Site home page Giter Site logo

addDCElement is too slow about atom4r HOT 3 CLOSED

mpadge avatar mpadge commented on June 12, 2024
addDCElement is too slow

from atom4r.

Comments (3)

eblondel avatar eblondel commented on June 12, 2024 1

@mpadge I've slightly improved the code, first by fetching DC rdf vocabulary by default, (previously done at each DC element creation), secondly by simplifying each DC element class by aligning with the R6 class writing convention used in the package, for what concern native DC elements (for which we don't really need to look into all class inheritance). Together with that, i've provided setters for lists of elements . See #14

from atom4r.

eblondel avatar eblondel commented on June 12, 2024

Yes, this is well known issue that I have to look into very soon. I had already improved this in similar package methods (eg geometa) and I have to see if this can be applied here. I didn't know about 'memoise' and I will look into it, thanks for that. Also something you have to know is that the 'add' methods check if there is alread a value, and will return FALSE if already available, but since some elements consist in complex objects (and not simple string values) the comparison is done by comparing the out xml.

An immediate approach, faster, that is actually implemented in the decode function, is not to use the util adders (and then much less convenient), but directly set the fields with the appropriate elements. Example:

dc <- DCEntry$new()
dc[["contributor"]] <- lapply(c("Bob", "Peter", "Bunny"), function(x){DCContributor$new( value = x)})

On this basis, I will support new setters as talked in #14

from atom4r.

mpadge avatar mpadge commented on June 12, 2024

Great stuff - thanks!

from atom4r.

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.