Hard to use exclusive queries

Bug #592599 reported by Mikkel Kamstrup Erlandsen on 2010-06-11
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zeitgeist Framework
Fix Released
Medium
Markus Korn
unity-lens-files
Undecided
Unassigned

Bug Description

(Canonical hat on)

For Unity we want to try and group recent files into some categories like Documents, Images, Video, Presentations, etc, and I've discovered an unfortunate decision in our template matching algorithm, making this quite hard to get 100% right.

The deal is that the designers think that the Documents section should not contain Presentations (which makes quite good sense if there is a separate section for this). Also we'd like to have an "Other" section with unclassified stuff. But since nfo:Presentation is a subclass of nfo:Document a query for all documents would also include all presentations (which is "correct", but not what we want in this particular case).

So roughly speaking the query for the Documents section should be

  all subtypes of nfo:Document but NOT nfo:Presentation

Currently this is simply not possible in Zeitgeist, because we do logical OR between all subject templates. What I'd propose to do to make these kind of queries possible, is to switch to logical AND between subjects, but keep it at logical OR between events. So in code I'd like the following code to work:

  su1 = Subject.new_for_values(interpretation=DOCUMENT)
  su2 = Subject.new_for_values(interpretation="!"+PRESENTATION)
  ev = Event()
  ev.subjects.append(su1)
  ev.subjects.append(su2)
  # now query for [ev].

As you probably realize we have the same problem (but even stronger) in the "Other" section where we want to exclude all the listed sections and match everything else.

Related branches

Markus Korn (thekorn) wrote :

I agree with you here, the combinator for subjects should be AND, but the one for events should stay OR - that makes the most sense.

Changed in zeitgeist:
status: New → Confirmed

We can solve Others by having a root interpretation
it will look like this
 su1 = Subject.new_for_values(interpretation=ROOT)
 su2 = Subject.new_for_values(interpretation="!"+DOCUMENT)
 su2 = Subject.new_for_values(interpretation="!"+AUDIO)
 ...
 ev = Event()
 ev.subjects.append(su1)
 ev.subjects.append(su2)
 ...
What do you think?

On Fri, Jun 11, 2010 at 2:13 PM, Markus Korn <email address hidden> wrote:

> I agree with you here, the combinator for subjects should be AND, but
> the one for events should stay OR - that makes the most sense.
>
> ** Changed in: zeitgeist
> Status: New => Confirmed
>
> --
> Hard to use exclusive queries
> https://bugs.launchpad.net/bugs/592599
> You received this bug notification because you are subscribed to The
> Zeitgeist Project.
>
> Status in Zeitgeist Framework: Confirmed
>
> Bug description:
> (Canonical hat on)
>
> For Unity we want to try and group recent files into some categories like
> Documents, Images, Video, Presentations, etc, and I've discovered an
> unfortunate decision in our template matching algorithm, making this quite
> hard to get 100% right.
>
> The deal is that the designers think that the Documents section should not
> contain Presentations (which makes quite good sense if there is a separate
> section for this). Also we'd like to have an "Other" section with
> unclassified stuff. But since nfo:Presentation is a subclass of nfo:Document
> a query for all documents would also include all presentations (which is
> "correct", but not what we want in this particular case).
>
> So roughly speaking the query for the Documents section should be
>
> all subtypes of nfo:Document but NOT nfo:Presentation
>
> Currently this is simply not possible in Zeitgeist, because we do logical
> OR between all subject templates. What I'd propose to do to make these kind
> of queries possible, is to switch to logical AND between subjects, but keep
> it at logical OR between events. So in code I'd like the following code to
> work:
>
> su1 = Subject.new_for_values(interpretation=DOCUMENT)
> su2 = Subject.new_for_values(interpretation="!"+PRESENTATION)
> ev = Event()
> ev.subjects.append(su1)
> ev.subjects.append(su2)
> # now query for [ev].
>
> As you probably realize we have the same problem (but even stronger) in the
> "Other" section where we want to exclude all the listed sections and match
> everything else.
>
>
>

--
This is me doing some advertisement for my blog http://seilo.geekyogre.com

Seif: No. Since all the subject templates are ORed together you end up matching everything. In fact just these two lines match everything:

 su1 = Subject.new_for_values(interpretation="!"+DOCUMENT)
 su2 = Subject.new_for_values(interpretation="!"+AUDIO)

So the only way to construct "Others" would be via inclusive queries:

 su_1 = Subject.new_for_values(interpretation=MINDMAP)
 ...
 su_n = Subject.new_for_values(interpretation=VCARD)

Including everything except the predefined categories. Needlnes to say this approach breaks down as soon as someone adds another file of unknown type since that will not match this query.

Seif Lotfy (seif) wrote :

Oh you got me wrong the subject templates shoudl be changed to AND like u
suggested then use the queries...

On Fri, Jun 11, 2010 at 7:06 PM, Mikkel Kamstrup Erlandsen <
<email address hidden>> wrote:

> Seif: No. Since all the subject templates are ORed together you end up
> matching everything. In fact just these two lines match everything:
>
> su1 = Subject.new_for_values(interpretation="!"+DOCUMENT)
> su2 = Subject.new_for_values(interpretation="!"+AUDIO)
>
> So the only way to construct "Others" would be via inclusive queries:
>
> su_1 = Subject.new_for_values(interpretation=MINDMAP)
> ...
> su_n = Subject.new_for_values(interpretation=VCARD)
>
> Including everything except the predefined categories. Needlnes to say
> this approach breaks down as soon as someone adds another file of
> unknown type since that will not match this query.
>
> --
> Hard to use exclusive queries
> https://bugs.launchpad.net/bugs/592599
> You received this bug notification because you are subscribed to The
> Zeitgeist Project.
>
> Status in Zeitgeist Framework: Confirmed
>
> Bug description:
> (Canonical hat on)
>
> For Unity we want to try and group recent files into some categories like
> Documents, Images, Video, Presentations, etc, and I've discovered an
> unfortunate decision in our template matching algorithm, making this quite
> hard to get 100% right.
>
> The deal is that the designers think that the Documents section should not
> contain Presentations (which makes quite good sense if there is a separate
> section for this). Also we'd like to have an "Other" section with
> unclassified stuff. But since nfo:Presentation is a subclass of nfo:Document
> a query for all documents would also include all presentations (which is
> "correct", but not what we want in this particular case).
>
> So roughly speaking the query for the Documents section should be
>
> all subtypes of nfo:Document but NOT nfo:Presentation
>
> Currently this is simply not possible in Zeitgeist, because we do logical
> OR between all subject templates. What I'd propose to do to make these kind
> of queries possible, is to switch to logical AND between subjects, but keep
> it at logical OR between events. So in code I'd like the following code to
> work:
>
> su1 = Subject.new_for_values(interpretation=DOCUMENT)
> su2 = Subject.new_for_values(interpretation="!"+PRESENTATION)
> ev = Event()
> ev.subjects.append(su1)
> ev.subjects.append(su2)
> # now query for [ev].
>
> As you probably realize we have the same problem (but even stronger) in the
> "Other" section where we want to exclude all the listed sections and match
> everything else.
>
>
>

--
This is me doing some advertisement for my blog http://seilo.geekyogre.com

Targetting for 0.4.1 as there is rough consensus

Changed in zeitgeist:
importance: Undecided → Medium
milestone: none → 0.4.1
status: Confirmed → Triaged
Siegfried Gevatter (rainct) wrote :

+1, go for it.

Markus Korn (thekorn) on 2010-07-02
Changed in zeitgeist:
assignee: nobody → Markus Korn (thekorn)
Markus Korn (thekorn) wrote :

I'm going to work on this bug and all its implications over this weekend.

Changed in zeitgeist:
status: Triaged → In Progress
Seif Lotfy (seif) on 2010-07-26
Changed in zeitgeist:
status: In Progress → Fix Released
Changed in unity-place-files:
status: New → In Progress
Changed in unity-place-files:
status: In Progress → Fix Released
Changed in zeitgeist:
milestone: 0.4.1 → 0.5.0
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers