Bug #2685

RCP: 0.8.0, finalize lazy loading of TXMResult children

Added by Matthieu Decorde almost 4 years ago. Updated over 3 years ago.

Status:New Start date:12/03/2019
Priority:Urgent Due date:
Assignee:- % Done:

80%

Category:Persistence / Lazy Spent time: -
Target version:TXM 0.8.1

Description

Currently TXMResult children are automatically computed when the TXMResult is computed.

This simplifies the usage of the TXMResult BUT partially breaks the lazy loading feature since all children are computed with the TXMResult.
Eg. computing a sub result of a partition will compute all its parent up to the Partition. Then the Partition will compute all its children therefore all the children results.

Some TXMResults need their children to be computed at the same time.
1) to beeing consistent and usable :
- eg. the Partition and its Parts.
2) to maintain a coherent state between in a results branch
- eg. Lexical Table => CA => AHC
3) for UI viewing
- eg. the Editor of the CA that needs to display the Eigenvalues bar chart child

Solution 1

WIP:

Piste d'améliorations du lazy :
- on pourrait avoir un lazy plus fin lors du recalcul des enfants d'un parent en ne recalculant que les enfants qui ont déjà été ouverts (computés au moins une fois, hasBeenComputedOnce()), ne les passer en dirty depuis le compute du parent que si Children.hasBeenComputedOnce()
- on pourrait ne jamais recalculé les enfants d'un résultat et mettre à jours dès qu'on souhaite le manipuler (ouverture d'un éditeur, recalcul dans l'éditeur, afficher une fenêtre dans l'éditeur "le résultat doit être recalculé etc."

Piste de résolution de la synchronisation Partition-Parts :
- en amont du test hasBeenComputed() de l'amélioration du lazy, introduire une variable interne de TXMResult : synchronizedWithParent qui est réglée à true pour les Parts

Change the way to manage the dirty state of the children, eg.:
TXMResult.compute()

    // set the children as dirty since the result has changed
    for (int i = 0; i < this.children.size(); i++) {
        if(child.mustBeSyncWithParent() || child.hasBeenComputedOnce())
            this.children.get(i).setDirty();
        }
    }

Related issues

related to Feature #978: TBX: 0.7.6, lazy loading for subcorpora and partitions Closed 08/22/2014

Associated revisions

Revision 2437
Added by Sebastien Jacquot almost 4 years ago

Finalize the start and done computing messages of results (refs #2573)
Finalize lazy loading of TXMResult children (refs #2685)

History

#1 Updated by Matthieu Decorde almost 4 years ago

  • Description updated (diff)

#2 Updated by Sebastien Jacquot almost 4 years ago

  • Description updated (diff)

#3 Updated by Sebastien Jacquot almost 4 years ago

  • % Done changed from 0 to 80

Lazy loading has been implemented with a variation the described solution:

                for (int i = 0; i < this.children.size(); i++) {

                        TXMResult child = this.children.get(i);
                        if (child.mustBeSynchronizedWithParent() || child.hasBeenComputedOnce()) {
                            child.compute(monitor, deepComputing);
                        }

                        if (monitor != null && this.children.size() > 1) {
                            monitor.worked(1);
                        }
                    }

but it creates some incoherent states, eg. with a branch ad LT => Specificities, when reopening the LT and editing word => to frlemma, the Specificities child node label is not updated until the Specificities result is reopened.

#4 Updated by Sebastien Jacquot almost 4 years ago

To fix that I edited org.txm.core.results.TXMResult.getCurrentName() to force the simple name BEFORE the lazy name. Need to check it works for all result types.


    /**
     * Gets the user name if exists otherwise, the lazy name if exists, otherwise the simple name.
     * 
     * @return the current name
     */
    public String getCurrentName() {
        if (!this.userName.isEmpty()) {
            return this.userName;
        }
        // else if (this.lazyName != null && !this.lazyName.isEmpty()) {
        // return this.lazyName;
        // }
        // else {
        // return this.getSimpleName();
        // }

        else if (this.getSimpleName() != null && !this.getSimpleName().isEmpty()) {
            return this.getSimpleName();
        }
        else {
            return this.lazyName;
        }

    }

#5 Updated by Sebastien Jacquot over 3 years ago

  • Category changed from Corpus to Development
  • Target version changed from TXM 0.8.2 to TXM 0.8.1

#6 Updated by Sebastien Jacquot over 3 years ago

  • Category changed from Development to Persistence / Lazy

Also available in: Atom PDF