Uploaded image for project: 'Clerezza'
  1. Clerezza
  2. CLEREZZA-431

RDFList should not write in its constructor

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The implementation of RdfList in the rdf.utils project performs a write when creating an empty RdfList.

      This is dangerous because when the underlying graph is a LockableMGraphWrapper it tries to get a write lock on the graph before adding. If the creation of the list happens inside a read lock on the same graph this will create a deadlock. It requires a lot of knowledge of the implementation to be aware of these side-effects.

      It may be better for users of RdflList if no such unexpected locks are set. The write access happens, because for an empty list, the triple "listResource owl:sameAs rdf:Nil" is added to the underlying graph. This is correct but not necessary. The suggestion is that the presence of an rdf:first property is used to determine whether the list is empty or not. We can provide a static method for the user to create an empty list with the owl:sameAs rdf:Nil triple if a user desires to do so and is aware of the side effects. In the add and remove methods the owl:sameAs rdf:Nil triple can still be removed/added as these operations clearly require write access.

        Attachments

        1. clerezza-431-patch.diff
          4 kB
          Daniel Spicar

          Activity

            People

            • Assignee:
              reto Reto Gmür
              Reporter:
              daniel.spicar Daniel Spicar
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: