[Nepomuk] Status report of the Nepomk query parser

Denis Steckelmacher steckdenis at yahoo.fr
Tue Jun 18 10:21:28 UTC 2013


On 06/18/2013 12:01 PM, Ignacio Serantes wrote:
 > Hi,
 >
 > I'm a little bit confused. I understood that there are three steps in
 > this process "natural query language"->"formal query language"->SPARQL
 > queries but there is no trace of the "formal query language" syntax.
 >

You are right, there is no "formal query language" syntax. The parser 
works by incrementally translating natural language into 
Nepomuk2::Query::Term objects.

The first parsing step is to split the query in terms (a term is a word 
separated by a space or a punctuation character, or words enclosed into 
quotes). Each term is a Nepomuk2::Query::Term having a string value.

Then, rules are applied on these terms. They are locale-specific and 
parsed from strings that can be translated using i18nc() calls. For 
instance, the rule "sent by %1" transforms the three terms "sent by 
Michel" into the comparison term "nmo:messageFrom=Michel".

When no more rule matches, the third step is to fuse them inside a big 
AND comparison. This big AND is the final query, that will be like

resourceType=nmo:Email AND nmo:messageFrom=Michel AND 
nmo:messageTitle:Holidays



More information about the Nepomuk mailing list