Uploaded image for project: 'Apache Commons RDF'
  1. Apache Commons RDF
  2. COMMONSRDF-23

Indication of graph immutability?

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.1.0
    • None
    • api
    • None

    Description

      Alexandre Bertails notes on 2015-05-06:

      > Right now, there is no support in commons-rdf for immutable
      > operations. `Graph`s are mutable by default. Is there any plan to make
      > an API for immutable graphs? Graphs in banana-rdf are immutable by
      > default, and they are persistent in Plantain. We could always wrap an
      > immutable graph in a structure with a `var`, but, well, there are
      > better ways to do that.

      and I (Stian) replied:

      There has been suggestions along those lines. It is not a requirement of Graph now to allow .add() etc. - but there is no method to ask if a graph is mutable or not.

      In the user guide http://commonsrdf.incubator.apache.org/userguide.html#Adding_triples we therefore say:

      > Note: Some Graph implementations are immutable, in which case the below may throw an UnsupportedOperationException.

      We could probably add this to the Javadoc of the mutability methods of Graph with an explicit @throws.

      Some options I can see:

      a) Add @throws UnsupportedOperationException indications as above to add/remove/clear
      b) Add a ImmutableGraph marker interface – as in Clerezza RDF Core (.. with equals() measures as well?)
      c) Add boolean isMutable() method to Graph
      d) Move add/remove/clear to a sub-type MutableGraph

      My own preferences are about that same order

      Attachments

        Issue Links

          Activity

            People

              stain Stian Soiland-Reyes
              stain Stian Soiland-Reyes
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: