[Nepomuk] Query API - method return types

Ivan Čukić ivan.cukic at kde.org
Sat Mar 10 10:01:03 UTC 2012


Hi,

A RFC regarding the query API for Nepomuk in KF5.

Proposal:

Methods that modify a Term and currently return void should return a
reference to (*this) that is Term &.

Reasoning:

Database query languages are functional in nature, so should be the
query building apis like this one.

By defining the method return type as void, we need to define separate
variables if we want to change some term before inclusion into the
main term (non-functional approach):

        ComparisonTerm related = ComparisonTerm(something, something);
        related.setInverted(true);
        ResourceTypeTerm(NFO::FileDataObject()) && related;

Instead of being able to write it as:

        ResourceTypeTerm(NFO::FileDataObject()) &&
        ComparisonTerm(something, something).setInverted(true)

I'm in a hurry, so this is not really worded properly, but you'll get
the gist I think :)


-- 
Cheerio,
Ivan

--
While you were hanging yourself on someone else's words
Dying to believe in what you heard
I was staring straight into the shining sun


More information about the Nepomuk mailing list