NOODB: Spaces in Queries

I took a brief hiatus to look at MGrammar and ANTLR to see how I can better parse the NOODB queries. I made some progress with MGrammar, but I’m just not very into it at this stage. I don’t have a great desire to learn it. I posted a question on StackOverflow to see if anyone has already written a grammar for query expressions; if that works out, then great. In the meantime, I’m continuing to parse manually.

Queries against string fields were only working if the string didn’t have spaces or quotes. I improved the parsing to work that stuff out. I created a fictional director, O’NEIL, to prove that nested quotes work. Well, at least I think I created him/her. I suppose there could be a director with a name of O’Neil. The fact that I didn’t further qualify the query with a year increases the odds that there could be, in fact, such a director. Wow. The implications are mind bending.

from m in Movie where m.Director='O''Neil'
from m in iMovie where m.Director='George Lucas'
from m in iMovie where m.ReleaseYear = 2005
from m in imovie where (m.ReleaseYear = 2005 && m.Director='George Lucas') || m.ReleaseYear = 1999 || m.ReleaseYear = 2002
from m in Movie where m.Director='George Lucas'
from m in Movie where m.ReleaseYear = 2005
from m in movie where (m.ReleaseYear = 2005 && m.Director='George Lucas') || m.ReleaseYear = 1999 || m.ReleaseYear = 2002
from m in movie where m.Name='StarWars' && m.ReleaseYear=1977

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: