Order annotations in tree by span start

Bug #521471 reported by Jefficus
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glyphicus
Fix Released
Medium
Xiaonuo Gantan

Bug Description

Annotation documents listed in the tree view are currently sorted by title. There should be a preferences option to change that to sorting by target span starting point instead, so that all annotation associated with the same word or targetted to the same region of the text appear near each other in the list.

Changed in glyphicus:
status: Confirmed → Triaged
assignee: nobody → Nikolai Roman (xiaonuogantan)
Revision history for this message
Xiaonuo Gantan (xiaonuogantan) wrote :

Is this absolutely desired? Although I know how to fix this bug, I'm reluctant to do so because the fixing may break the orthogonality of the whole system. More specifically, the Document class will need access to the DBConn class, which is very bad in terms of software engineering practice.

Revision history for this message
Jefficus (jeff-smithicus) wrote : Re: [Bug 521471] Re: Order annotations in tree by span start

Yes, this is a really useful feature, but that doesn't mean we should
break architectural independence to achieve it. I can think of three
ways to try doing this.

1) We could change the SQL query so that it adds an ORDER BY clause to
pre-sort the data for us.

2) We could sort the records in memory before inserting them into the
tree control.

3) We could subclass the tree control and add a behavior modification
to cause it to sort records the way we want, possibly requiring some
additional information to be included in the tree node records when
they are added to the control.

Will any of these methods work without breaking the architecture?

--
Jeff Smith
Computer Science Dept.
University of Saskatchewan
Phone: 306-665-8157

Revision history for this message
Xiaonuo Gantan (xiaonuogantan) wrote :

I'm currently working on method 2) and 3).

Changed in glyphicus:
status: Triaged → In Progress
Revision history for this message
Xiaonuo Gantan (xiaonuogantan) wrote :

I have partially fixed the bug. The program runs with some exceptions. The annotations are arranged according to their target span. If you add new annotations, you have to reopen the project to see the correct ranking of the annotations. However, due to the database design, we could create several annotations whose doc_id and link_doc_id are the same, which means that the relations between documents and annotations are "one-to-many". This relation leads to certain incorrect ranking of the annotations whose doc_id and link_doc_id are the same. Is this what we want? If we want to implement annotation for annotation, then we should have a "one-to-one" relation between documents and annotations, right?

In addition, when the user clicks one annotation to open it, the program will generate a java.lang.IllegalStateException: Attempt to mutate in notification, which does not affect the functionality of the program.

I have put all the relevant comments about the target span ordering implementation into "TODO" comments in the source code, which could be reviewed from selecting the menu item "Tasks" in Netbeans.

Changed in glyphicus:
status: In Progress → Fix Committed
Revision history for this message
Brent Nelson (brent-nelson) wrote :

I'm not sure I follow exactly, but it is true that I need to be able to use the same document names (I'm assuming this is the doc_id) more than once, which will create a one to many relationship between a doc name and the spans of text that it is applied to.

The necessity of reopening the program is a bit of a hassle, especially for a very active session in which one is adding many annotations. This is a naive question, but can you add a "refresh" function to do this? Perhaps activated by a button called "refresh order"?

Is there a new standalone version that I can try?

Revision history for this message
Jefficus (jeff-smithicus) wrote :

Nikolai: the doc_id is the id of the annotation. The link_doc_id is the id
of the target doc. So if you have a doc with the same doc_id and
link_doc_id, it would specify a doc annotating itself.

Why does the display need to be refreshed? When you create a new annotation,
why can't it insert itself into the tree at the correctly sorted location?

We have discussed the possibility of having many-to-many comment linkages
before, but we've never really made a decision. Given the increased
complexity that implies for the UI, I think we should decide to limit
ourselves to one-to-one linking for now.

On Tue, Apr 13, 2010 at 11:13 PM, Nikolai Roman <email address hidden>wrote:

> I have partially fixed the bug. The program runs with some exceptions.
> The annotations are arranged according to their target span. If you add
> new annotations, you have to reopen the project to see the correct
> ranking of the annotations. However, due to the database design, we
> could create several annotations whose doc_id and link_doc_id are the
> same, which means that the relations between documents and annotations
> are "one-to-many". This relation leads to certain incorrect ranking of
> the annotations whose doc_id and link_doc_id are the same. Is this what
> we want? If we want to implement annotation for annotation, then we
> should have a "one-to-one" relation between documents and annotations,
> right?
>
> In addition, when the user clicks one annotation to open it, the program
> will generate a java.lang.IllegalStateException: Attempt to mutate in
> notification, which does not affect the functionality of the program.
>
> I have put all the relevant comments about the target span ordering
> implementation into "TODO" comments in the source code, which could be
> reviewed from selecting the menu item "Tasks" in Netbeans.
>
> ** Changed in: glyphicus
> Status: In Progress => Fix Committed
>
> --
> Order annotations in tree by span start
> https://bugs.launchpad.net/bugs/521471
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Jeff Smith
Computer Science Dept.
University of Saskatchewan
Phone: 306-665-8157

Revision history for this message
Jefficus (jeff-smithicus) wrote :

Brent: I'd rather not forward a new version just yet, with only a partial
implementation.
--
Jeff Smith
Computer Science Dept.
University of Saskatchewan
Phone: 306-665-8157

Revision history for this message
Xiaonuo Gantan (xiaonuogantan) wrote :

Jeff: When I insert the document, I make the compareTo(Object o) method compare the start position of the corresponding annotation, so the tree is ranked correctly after the insertion and there is no need to refresh the tree. Thank you for good insight on fixing this bug.

Now the bug is fully fixed.

Changed in glyphicus:
status: Fix Committed → In Progress
status: In Progress → Fix Committed
Changed in glyphicus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.