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
[email protected]
https://mail.kde.org/mailman/listinfo/nepomuk

Reply via email to