[Nepomuk] Need feedback on new query api

Vishesh Handa handa.vish at gmail.com
Sat Jul 24 23:15:31 CEST 2010


It is kinda confusing, but not that much. I think the main problem is that
it isn't intuitive.

One usually expects the *operator==* to be symmetric, and in this case it
isn't. Moreover spotting bugs would be even harder. Why don't you simply
overload the *operator !=* ?

That way I could come up with queries like -

(Vocabulary::NAO::numericRating() < RATING ) && ( Vocabulary::NAO::hasTag()
!= TAG )


- Vishesh Handa

On Sun, Jul 25, 2010 at 2:00 AM, Artem Serebriyskiy
<v.for.vandal at gmail.com>wrote:

> As for me, it is too confusing.
>
>
> On Sun, Jul 25, 2010 at 12:15 AM, Sebastian Trüg <trueg at kde.org> wrote:
>
>> Hi guys,
>>
>> at the Akademy a very good idea came up: using C++ operator overloads to
>> construct queries. This is very straight-forward for AndTerm and OrTerm:
>>
>>   term1 && term2 && term3
>>
>>   term1 || term2 || term3
>>
>> But it gets nicer (thanks to Vishesh for the tip):
>>
>>   Vocabulary::NIE::contentCreated() > Query::LiteralTerm( dateTime1 );
>>   Vocabulary::NAO::hasTag() == term;
>>
>> which results in the following ComparisonTerms:
>>
>>   ComparisonTerm(
>>        Vocabulary::NIE::contentCreated(),
>>        Query::LiteralTerm( dateTime1 ),
>>        ComparisonTerm::Greater );
>>
>>   ComparisonTerm(
>>        Vocabulary::NAO::hasTag(),
>>        term,
>>        ComparisonTerm::Equal );
>>
>> So far so good. But now let me give you the idea which I would like some
>> feedback on. By interchanging the two parameters of the operator we
>> create an inverted ComparisonTerm:
>>
>>   term == Vocabulary::NAO::hasTag();
>>
>> will create the following term:
>>
>>   ComparisonTerm(
>>        Vocabulary::NAO::hasTag(),
>>        term,
>>        ComparisonTerm::Equal ).inverted();
>>
>> For me this is very convenient. But it might be rather confusing. But
>> then again inverted terms are confusing to begin with.
>>
>> So any opinions?
>>
>> Cheers,
>> Sebastian
>> _______________________________________________
>> Nepomuk mailing list
>> Nepomuk at kde.org
>> https://mail.kde.org/mailman/listinfo/nepomuk
>>
>
>
>
> --
> Sincerely yours,
> Artem
>
> _______________________________________________
> Nepomuk mailing list
> Nepomuk at kde.org
> https://mail.kde.org/mailman/listinfo/nepomuk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/nepomuk/attachments/20100725/f4240acf/attachment.htm 


More information about the Nepomuk mailing list