Re: [Zeitgeist] [Bug 487321] Re: What value should subject.origin have?
So lets say i switched from i opened a website the a document will the website be the origin of the document... if yes i think this is kinda wrong. since we are talking about a subject origin as opposed to what you are suggesting what i would call a event origin... Lets have an irc meeting... With the wildcards coming up we could rethink that... On Fri, May 14, 2010 at 8:19 PM, Siegfried Gevatter wrote: > 2010/5/14 Michal Hruby : > > Therefore the web page visit event could have as origin set -- the domain > Completely agree. > > > As for Mikkel's IM use case, I don't think it's ZG's job to log every > message, so there'd be only some kind of CONVERSATION_STARTED event > Completely agree. > > :) > > -- > What value should subject.origin have? > https://bugs.launchpad.net/bugs/487321 > You received this bug notification because you are subscribed to The > Zeitgeist Project. > > Status in Zeitgeist Framework: Triaged > > Bug description: > >> + origin = > info.get_uri().rpartition("/")[0] > > WHY? > > > > -- This is me doing some advertisement for my blog http://seilo.geekyogre.com -- What value should subject.origin have? https://bugs.launchpad.net/bugs/487321 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: Triaged Bug description: >> + origin = >> info.get_uri().rpartition("/")[0] WHY? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
Re: [Zeitgeist] [Merge] lp:~thekorn/zeitgeist/wildcard_support into lp:zeitgeist
Very good job... The test cases work here and I tried it with Sezen... It took me sometime to understand the code but mostly because i also missed up on the negations. But good job +10 -- https://code.launchpad.net/~thekorn/zeitgeist/wildcard_support/+merge/25345 Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~thekorn/zeitgeist/wildcard_support into lp:zeitgeist. ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
Re: [Zeitgeist] [Bug 580601] [NEW] Inconsistent data in event_view
> Is this on purpose? Yes. There are only a few dozen actors and mimetypes, while there can be any number of different origins. Actors and mimetypes are cached at startup. -- Inconsistent data in event_view https://bugs.launchpad.net/bugs/580601 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: New Bug description: While working on the wildcard implementation I had some hard time with our event_view view. And I'm esp. wondering why event.actor and event.subj_mimetype are ids where fields like event.subj_origin is already JOINed to the actual string. Is this on purpose? shouldn't be all fields (except *Interpretation and *Manifestation) be evaluated to strings instead of being an id? Or am I missing sth. which is very important (maybe wrt. performance) Siegfried, Mikkel can you please explain this design to me. Thanks, Markus ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
Re: [Zeitgeist] [Bug 485966] Re: Using filters (text match / exclusion / etc)
2010/5/14 Markus Korn : > Please cry out loud if you think that case sensitive searches is a bad > thing. I'm crying out loud! (not really constructive, I know :P) -- Using filters (text match / exclusion / etc) https://bugs.launchpad.net/bugs/485966 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: In Progress Status in Zeitgeist Framework 0.3 series: In Progress Bug description: - How can I get all events except those with interpretation VISIT_EVENT? - In case you give me above the awful answer "looking for all interpretations except VISIT_EVENT", how can I get all events except those from application "firefox.desktop"? - How can I get all those events whose URI ends with "myfile.txt"? - And those events whose title contains "zeitgeist"? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
Re: [Zeitgeist] [Bug 487321] Re: What value should subject.origin have?
2010/5/14 Michal Hruby : > Therefore the web page visit event could have as origin set -- the domain Completely agree. > As for Mikkel's IM use case, I don't think it's ZG's job to log every > message, so there'd be only some kind of CONVERSATION_STARTED event Completely agree. :) -- What value should subject.origin have? https://bugs.launchpad.net/bugs/487321 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: Triaged Bug description: >> + origin = >> info.get_uri().rpartition("/")[0] WHY? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 580643] Re: conversion script for the database and database versioning
*** This bug is a duplicate of bug 566898 *** https://bugs.launchpad.net/bugs/566898 added Mikkel's work on 1.) ** Changed in: zeitgeist Importance: Undecided => Critical ** Changed in: zeitgeist Status: New => Confirmed ** Changed in: zeitgeist Milestone: None => 0.3.4 ** This bug has been marked a duplicate of bug 566898 Log DB file should be versioned -- conversion script for the database and database versioning https://bugs.launchpad.net/bugs/580643 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: This is a bugreport to track and organize the work we need to do wrt. 1.) schema-versions 2.) update script to update 'old' databases to a database which works well with our new ontology I think mikkel started working on 1.) This is release critical for any new release. ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 580643] [NEW] conversion script for the database and database versioning
*** This bug is a duplicate of bug 566898 *** https://bugs.launchpad.net/bugs/566898 Public bug reported: This is a bugreport to track and organize the work we need to do wrt. 1.) schema-versions 2.) update script to update 'old' databases to a database which works well with our new ontology I think mikkel started working on 1.) This is release critical for any new release. ** Affects: zeitgeist Importance: Critical Status: Confirmed ** Branch linked: lp:~kamstrup/zeitgeist/schema_versions -- conversion script for the database and database versioning https://bugs.launchpad.net/bugs/580643 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: This is a bugreport to track and organize the work we need to do wrt. 1.) schema-versions 2.) update script to update 'old' databases to a database which works well with our new ontology I think mikkel started working on 1.) This is release critical for any new release. ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Merge] lp:~thekorn/zeitgeist/wildcard_support into lp:zeitgeist
Markus Korn has proposed merging lp:~thekorn/zeitgeist/wildcard_support into lp:zeitgeist. Requested reviews: Mikkel Kamstrup Erlandsen (kamstrup) Zeitgeist Framework Team (zeitgeist) This branch adds wildcard-support to some template-fields, and completes the fix of bug 485966 -- https://code.launchpad.net/~thekorn/zeitgeist/wildcard_support/+merge/25345 Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~thekorn/zeitgeist/wildcard_support into lp:zeitgeist. === modified file '_zeitgeist/engine/main.py' --- _zeitgeist/engine/main.py 2010-05-14 11:54:52 + +++ _zeitgeist/engine/main.py 2010-05-14 17:20:42 + @@ -32,7 +32,7 @@ from collections import defaultdict from zeitgeist.datamodel import Event as OrigEvent, StorageState, TimeRange, \ - ResultType, get_timestamp_for_now, Interpretation, Symbol, NEGATION_OPERATOR + ResultType, get_timestamp_for_now, Interpretation, Symbol, NEGATION_OPERATOR, WILDCARD from _zeitgeist.engine.datamodel import Event, Subject from _zeitgeist.engine.extension import ExtensionsCollection, load_class from _zeitgeist.engine import constants @@ -44,6 +44,12 @@ logging.basicConfig(level=logging.DEBUG) log = logging.getLogger("zeitgeist.engine") +class NegationNotSupported(ValueError): + pass + +class WildcardNotSupported(ValueError): + pass + def parse_negation(kind, field, value, parse_negation=True): """checks if value starts with the negation operator, if value starts with the negation operator but the field does @@ -55,8 +61,42 @@ negation = True value = value[len(NEGATION_OPERATOR):] if negation and field not in kind.SUPPORTS_NEGATION: - raise ValueError("This field does not support negation") + raise NegationNotSupported("This field does not support negation") return value, negation + +def parse_wildcard(kind, field, value): + """checks if value ends with the a wildcard, + if value ends with a wildcard but the field does not support wildcards + a ValueError is raised. + This function returns a (value_without_wildcard, wildcard)-tuple + """ + wildcard = False + if value.endswith(WILDCARD): + wildcard = True + value = value[:-len(WILDCARD)] + if wildcard and field not in kind.SUPPORTS_WILDCARDS: + raise WildcardNotSupported("This field does not support wildcards") + return value, wildcard + +def parse_operators(kind, field, value): + """runs both (parse_negation and parse_wildcard) parser functions + on query values, and handles the special case of Subject.Text correctly. + returns a (value_without_negation_and_wildcard, negation, wildcard)-tuple + """ + try: + value, negation = parse_negation(kind, field, value) + except ValueError: + if kind is Subject and field == Subject.Text: + # we do not support negation of the text field, + # the text field starts with the NEGATION_OPERATOR + # so we handle this string as the content instead + # of an operator + negation = False + else: + raise + value, wildcard = parse_wildcard(kind, field, value) + return value, negation, wildcard + class ZeitgeistEngine: @@ -186,58 +226,57 @@ subwhere.add("id = ?", event_template.id) try: -value, negation = parse_negation(Event, Event.Interpretation, event_template.interpretation) +value, negation, wildcard = parse_operators(Event, Event.Interpretation, event_template.interpretation) # Expand event interpretation children event_interp_where = WhereClause(WhereClause.OR, negation) for child_interp in (Symbol.find_child_uris_extended(value)): if child_interp: - event_interp_where.add("interpretation = ?", - self._interpretation[child_interp]) + event_interp_where.add_text_condition("interpretation", + child_interp, like=wildcard, cache=self._interpretation) if event_interp_where: subwhere.extend(event_interp_where) -value, negation = parse_negation(Event, Event.Manifestation, event_template.manifestation) +value, negation, wildcard = parse_operators(Event, Event.Manifestation, event_template.manifestation) # Expand event manifestation children event_manif_where = WhereClause(WhereClause.OR, negation) for child_manif in (Symbol.find_child_uris_extended(value)): if child_manif: - event_manif_where.add("manifestation = ?", - self._manifestation[child_manif]) + event_manif_where.add_text_condition("manifestation", + child_manif, like=wildcard, cache=self._manifestation) if event_manif_where: subwhere.extend(event_manif_where) -value, negation = parse_negation(Subject, Subject.Interpretation, subject_template.interpretation) +value, negation, wildcard = parse_operators(Subject, Subject.Interpretation, subject_template.interpretation) # Expand subject interpretation children su_interp_where = WhereClause(WhereClause.OR, negation) for child_interp in (S
[Zeitgeist] [Bug 485966] Re: Using filters (text match / exclusion / etc)
** Branch linked: lp:~thekorn/zeitgeist/wildcard_support -- Using filters (text match / exclusion / etc) https://bugs.launchpad.net/bugs/485966 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: In Progress Status in Zeitgeist Framework 0.3 series: In Progress Bug description: - How can I get all events except those with interpretation VISIT_EVENT? - In case you give me above the awful answer "looking for all interpretations except VISIT_EVENT", how can I get all events except those from application "firefox.desktop"? - How can I get all those events whose URI ends with "myfile.txt"? - And those events whose title contains "zeitgeist"? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 580601] [NEW] Inconsistent data in event_view
Public bug reported: While working on the wildcard implementation I had some hard time with our event_view view. And I'm esp. wondering why event.actor and event.subj_mimetype are ids where fields like event.subj_origin is already JOINed to the actual string. Is this on purpose? shouldn't be all fields (except *Interpretation and *Manifestation) be evaluated to strings instead of being an id? Or am I missing sth. which is very important (maybe wrt. performance) Siegfried, Mikkel can you please explain this design to me. Thanks, Markus ** Affects: zeitgeist Importance: Undecided Status: New -- Inconsistent data in event_view https://bugs.launchpad.net/bugs/580601 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: New Bug description: While working on the wildcard implementation I had some hard time with our event_view view. And I'm esp. wondering why event.actor and event.subj_mimetype are ids where fields like event.subj_origin is already JOINed to the actual string. Is this on purpose? shouldn't be all fields (except *Interpretation and *Manifestation) be evaluated to strings instead of being an id? Or am I missing sth. which is very important (maybe wrt. performance) Siegfried, Mikkel can you please explain this design to me. Thanks, Markus ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 487321] Re: What value should subject.origin have?
I think that it makes sense to store in subject.origin the location where subject.uri can be found. Therefore the web page visit events could have as origin set either their referrer page or the domain (only if referrer is unavailable, since we can parse the domain from uri anyway). As for Mikkel's IM use case, I don't think it's ZG's job to log every message, so there'd be only some kind of CONVERSATION_STARTED event, and I'd suggest this: event.actor = "mailto:john@example.com"; subject.uri = # uri of conversation log * subject.origin = # location where log is saved subject.text = "Conversation with %s" % real_name subject.mimetype = # mimetype of uri * If there's no log, uri, origin and mimetype are empty. -- What value should subject.origin have? https://bugs.launchpad.net/bugs/487321 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: Triaged Bug description: >> + origin = >> info.get_uri().rpartition("/")[0] WHY? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 485966] Re: Using filters (text match / exclusion / etc)
I've started working on the wildcard part in lp:~thekorn/zeitgeist/wildcard_support And I'm adding another constraint: searches are case sensitive. Please cry out loud if you think that case sensitive searches is a bad thing. -- Using filters (text match / exclusion / etc) https://bugs.launchpad.net/bugs/485966 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: In Progress Status in Zeitgeist Framework 0.3 series: In Progress Bug description: - How can I get all events except those with interpretation VISIT_EVENT? - In case you give me above the awful answer "looking for all interpretations except VISIT_EVENT", how can I get all events except those from application "firefox.desktop"? - How can I get all those events whose URI ends with "myfile.txt"? - And those events whose title contains "zeitgeist"? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 580372] Re: Event.new_for_values() does not check arguments
** Summary changed: - Event.new_for_values() does not chec arguments + Event.new_for_values() does not check arguments -- Event.new_for_values() does not check arguments https://bugs.launchpad.net/bugs/580372 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: New Bug description: Something like >>> event = Event.new_for_values(boo=234234) should raise a TypeError (or ValueError) instead of creating an Event which make no sense: >>> print event Event([['', '1273824118015', '', '', ''], [], '']) ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 580364] Re: searching with subject_storage in template is not working
Ok, zeitgeist is not raising a ValueError if someone tries to query on storage, I'll let this bug open so we can implement support for this field in the future. revno: 1471 committer: Markus Korn branch nick: trunk timestamp: Fri 2010-05-14 13:54:52 +0200 message: Raise a ValueError if someone tries to query by storage field, this feature might be added in the future (LP: #580364) ** Changed in: zeitgeist Status: New => Triaged ** Changed in: zeitgeist Importance: Undecided => Wishlist -- searching with subject_storage in template is not working https://bugs.launchpad.net/bugs/580364 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: Triaged Bug description: I've just added a testcase to lp:zeitgeist which shows that a template like template = Event.new_for_values(subject_storage="") returns all events, instead of only all events with subject_storage="". There are two ways to fx this bug: 1.) implement searching for subject_storage 2.) raise an ValueError if we do not support such kind of queries suggestions? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Merge] lp:~thekorn/zeitgeist/negation_support into lp:zeitgeist
The proposal to merge lp:~thekorn/zeitgeist/negation_support into lp:zeitgeist has been updated. Status: Needs review => Merged -- https://code.launchpad.net/~thekorn/zeitgeist/negation_support/+merge/25299 Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~thekorn/zeitgeist/negation_support into lp:zeitgeist. ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 579972] Re: Send events to zeitgeist
Jendrik: Interpretation.AUDIO is future proof. MUSIC will be removed in ZG 0.3.4. The actual metadata of the track (such as it's album) are better stored in an actual metadata repository - such as Tracker (which probably already knows this). Zeitgeist is mainly meant as a log to store the event and not full metadata for the actual subjects of these events (only the subset that we really really need). -- Send events to zeitgeist https://bugs.launchpad.net/bugs/579972 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Data-Sources. Status in Decibel Audio Player: Confirmed Status in Zeitgeist Data-Sources: New Bug description: Hi, great job on 1.04! I think it would be great if decibel would send events to the zeitgeist engine. Zeitgeist is an exciting new system and it will probably attract many users in the future. I have already written and attached the plugin. It would be great if you could add it to the program. ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
Re: [Zeitgeist] [Merge] lp:~thekorn/zeitgeist/negation_support into lp:zeitgeist
Review: Approve review only, no test run It looks very good Markus! And lots of unit tests +10 for that ;-) One thing - nothing critical: * Why not make EQUAL a real function instead of a lambda? I am not sure of the Python internals, but I'd assume that functions are cheaper because they don't capture a lambda context * The expression: if field_id in self.SUPPORTS_NEGATION \ and expression.startswith(NEGATION_OPERATOR): I didn't actually test run this, but I am ready to trust you :-) -- https://code.launchpad.net/~thekorn/zeitgeist/negation_support/+merge/25299 Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~thekorn/zeitgeist/negation_support into lp:zeitgeist. ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 580364] Re: searching with subject_storage in template is not working
I think that we want to support this at some point. Maybe we should just throw an exception for now and then target the feature for 0.3.5 (ie /not/ for 0.3.4) -- searching with subject_storage in template is not working https://bugs.launchpad.net/bugs/580364 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: New Bug description: I've just added a testcase to lp:zeitgeist which shows that a template like template = Event.new_for_values(subject_storage="") returns all events, instead of only all events with subject_storage="". There are two ways to fx this bug: 1.) implement searching for subject_storage 2.) raise an ValueError if we do not support such kind of queries suggestions? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 580372] [NEW] Event.new_for_values() does not chec arguments
Public bug reported: Something like >>> event = Event.new_for_values(boo=234234) should raise a TypeError (or ValueError) instead of creating an Event which make no sense: >>> print event Event([['', '1273824118015', '', '', ''], [], '']) ** Affects: zeitgeist Importance: Undecided Status: New -- Event.new_for_values() does not chec arguments https://bugs.launchpad.net/bugs/580372 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: New Bug description: Something like >>> event = Event.new_for_values(boo=234234) should raise a TypeError (or ValueError) instead of creating an Event which make no sense: >>> print event Event([['', '1273824118015', '', '', ''], [], '']) ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Merge] lp:~thekorn/zeitgeist/negation_support into lp:zeitgeist
Markus Korn has proposed merging lp:~thekorn/zeitgeist/negation_support into lp:zeitgeist. Requested reviews: Zeitgeist Framework Team (zeitgeist) Related bugs: #485966 Using filters (text match / exclusion / etc) https://bugs.launchpad.net/bugs/485966 This branch adds negation support as described in [0]. There are now some fields in a template which can be prefixed with the negation operator ("!"), which will result in a NOT condition in the search. Negation support is implemented on SQL level as well as the datamodel level. Once this branch is landed I will work on the wildcards part of bug 485966. [0] https://bugs.edge.launchpad.net/zeitgeist/+bug/485966/comments/13 -- https://code.launchpad.net/~thekorn/zeitgeist/negation_support/+merge/25299 Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~thekorn/zeitgeist/negation_support into lp:zeitgeist. === modified file '_zeitgeist/engine/main.py' --- _zeitgeist/engine/main.py 2010-05-13 22:33:21 + +++ _zeitgeist/engine/main.py 2010-05-14 08:09:25 + @@ -32,8 +32,8 @@ from collections import defaultdict from zeitgeist.datamodel import Event as OrigEvent, StorageState, TimeRange, \ - ResultType, get_timestamp_for_now, Interpretation, Symbol -from _zeitgeist.engine.datamodel import Event, Subject + ResultType, get_timestamp_for_now, Interpretation, Symbol, NEGATION_OPERATOR +from _zeitgeist.engine.datamodel import Event, Subject from _zeitgeist.engine.extension import ExtensionsCollection, load_class from _zeitgeist.engine import constants from _zeitgeist.engine.sql import get_default_cursor, unset_cursor, \ @@ -44,6 +44,20 @@ logging.basicConfig(level=logging.DEBUG) log = logging.getLogger("zeitgeist.engine") +def parse_negation(kind, field, value, parse_negation=True): + """checks if value starts with the negation operator, + if value starts with the negation operator but the field does + not support negation a ValueError is raised. + This function returns a (value_without_negation, negation)-tuple + """ + negation = False + if parse_negation and value.startswith(NEGATION_OPERATOR): + negation = True + value = value[len(NEGATION_OPERATOR):] + if negation and field not in kind.SUPPORTS_NEGATION: + raise ValueError("This field does not support negation") + return value, negation + class ZeitgeistEngine: def __init__ (self): @@ -167,36 +181,40 @@ subwhere.add("id = ?", event_template.id) try: +value, negation = parse_negation(Event, Event.Interpretation, event_template.interpretation) # Expand event interpretation children -event_interp_where = WhereClause(WhereClause.OR) -for child_interp in (Symbol.find_child_uris_extended(event_template.interpretation)): +event_interp_where = WhereClause(WhereClause.OR, negation) +for child_interp in (Symbol.find_child_uris_extended(value)): if child_interp: event_interp_where.add("interpretation = ?", self._interpretation[child_interp]) if event_interp_where: subwhere.extend(event_interp_where) +value, negation = parse_negation(Event, Event.Manifestation, event_template.manifestation) # Expand event manifestation children -event_manif_where = WhereClause(WhereClause.OR) -for child_manif in (Symbol.find_child_uris_extended(event_template.manifestation)): +event_manif_where = WhereClause(WhereClause.OR, negation) +for child_manif in (Symbol.find_child_uris_extended(value)): if child_manif: event_manif_where.add("manifestation = ?", self._manifestation[child_manif]) if event_manif_where: subwhere.extend(event_manif_where) +value, negation = parse_negation(Subject, Subject.Interpretation, subject_template.interpretation) # Expand subject interpretation children -su_interp_where = WhereClause(WhereClause.OR) -for child_interp in (Symbol.find_child_uris_extended(subject_template.interpretation)): +su_interp_where = WhereClause(WhereClause.OR, negation) +for child_interp in (Symbol.find_child_uris_extended(value)): if child_interp: su_interp_where.add("subj_interpretation = ?", self._interpretation[child_interp]) if su_interp_where: subwhere.extend(su_interp_where) +value, negation = parse_negation(Subject, Subject.Manifestation, subject_template.manifestation) # Expand subject manifestation children -su_manif_where = WhereClause(WhereClause.OR) -for child_manif in (Symbol.find_child_uris_extended(subject_template.manifestation)): +su_manif_where = WhereClause(WhereClause.OR, negation) +for child_manif in (Symbol.find_child_uris_extended(value)): if child_manif: su_manif_where.add("subj_manifestation = ?", self._manifestation[child_manif]) @@ -205,23 +223,37 @@ # FIXME: Expand mime children as well. # Right now we on
[Zeitgeist] [Bug 580364] Re: searching with subject_storage in template is not working
you can run this testcase in lp:zeitgeist by running test/engine-test.py ZeitgeistEngineTest.testBug580364 -- searching with subject_storage in template is not working https://bugs.launchpad.net/bugs/580364 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: New Bug description: I've just added a testcase to lp:zeitgeist which shows that a template like template = Event.new_for_values(subject_storage="") returns all events, instead of only all events with subject_storage="". There are two ways to fx this bug: 1.) implement searching for subject_storage 2.) raise an ValueError if we do not support such kind of queries suggestions? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 580364] [NEW] searching with subject_storage in template is not working
Public bug reported: I've just added a testcase to lp:zeitgeist which shows that a template like template = Event.new_for_values(subject_storage="") returns all events, instead of only all events with subject_storage="". There are two ways to fx this bug: 1.) implement searching for subject_storage 2.) raise an ValueError if we do not support such kind of queries suggestions? ** Affects: zeitgeist Importance: Undecided Status: New -- searching with subject_storage in template is not working https://bugs.launchpad.net/bugs/580364 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Framework. Status in Zeitgeist Framework: New Bug description: I've just added a testcase to lp:zeitgeist which shows that a template like template = Event.new_for_values(subject_storage="") returns all events, instead of only all events with subject_storage="". There are two ways to fx this bug: 1.) implement searching for subject_storage 2.) raise an ValueError if we do not support such kind of queries suggestions? ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp
[Zeitgeist] [Bug 579972] Re: Send events to zeitgeist
Thanks for the patch, I just discovered what Zeigeist is :-) I'll try to play with it to make sure everything works correctly with this plugin. ** Changed in: decibel-audio-player Status: New => Confirmed ** Changed in: decibel-audio-player Assignee: (unassigned) => François Ingelrest (athropos) -- Send events to zeitgeist https://bugs.launchpad.net/bugs/579972 You received this bug notification because you are a member of Zeitgeist Framework Team, which is subscribed to Zeitgeist Data-Sources. Status in Decibel Audio Player: Confirmed Status in Zeitgeist Data-Sources: New Bug description: Hi, great job on 1.04! I think it would be great if decibel would send events to the zeitgeist engine. Zeitgeist is an exciting new system and it will probably attract many users in the future. I have already written and attached the plugin. It would be great if you could add it to the program. ___ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp