Nepomuk provides a Query Library which is a part of the nepomuk-core library. It can be user to dynamically create queries. This Query Library eventually compiles the queries into Sparql which is then run on our database - virtuoso.
The entire Query Library resides in the Nepomuk2::Query namespace. It consists of a number of terms which can be combined together to create larger terms. Eventually when you've have created the final term, you can pass it to
Nepomuk2::Query::Query and run the query
The different kinds of terms are -
Imagine we wanted to find all files that are tagged with a certain tag:
Nepomuk::Tag myTag = someFancyMethod(); // term matching the tag Nepomuk::Query::ResourceTerm tagTerm( myTag ); // term matching tagged resource Nepomuk::Query::ComparisonTerm term( Soprano::Vocabulary::NAO::hasTag(), tagTerm, Nepomuk::Query::ComparisonTerm::Equal ); // build the query Nepomuk::Query::Query query( term );