[Nepomuk] Status report of the Nepomk query parser

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


On 06/18/2013 12:25 PM, Ignacio Serantes wrote:> Hi,
 >
 > So, when you need to write complex queries not handled by natural
 > language rules what is the alternative?

Hi,

The parser will support nested queries (I'm working on them right now), 
and nothing prevents me to add a rule "%1 : %2" that converts an 
arbitrary property name and a value to a key:value filter.

I think that what can be expressed in natural language can be expressed 
formally, but only experiments will show if I'm right. I'll keep in mind 
your remark.

Denis.

 >
 > On Tue, Jun 18, 2013 at 12:21 PM, Denis Steckelmacher
 > <steckdenis at yahoo.fr <mailto:steckdenis at yahoo.fr>> wrote:
 >
 >     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