← Back to team overview

zeitgeist team mailing list archive

[Bug 592599] Re: Hard to use exclusive queries

 

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 a member of Zeitgeist
Framework Team, which is subscribed to Zeitgeist Framework.

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.





Follow ups

References