← Back to team overview

zeitgeist team mailing list archive

[Bug 592599] Re: Hard to use exclusive queries

 

** Branch linked: lp:~zeitgeist/zeitgeist/fix-592599-subject-AND

-- 
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 Unity Files Place: New
Status in Zeitgeist Framework: In Progress

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.





References