# # Queries as entered by the user with the format as they should be # entered. # # Comments in this file are lines where the first non-whitespace # character is a dash. Empty lines or lines with only whitespace # are ignored. Leading and trailing whitespace characters are # removed before the line is parsed. Also whitespace before and # after the separator is ignored. # # One query per single line of text in this file. # Separate the query and transformed query with the string '-->'. # # Sample: # aaa bbb --> aaa AND bbb # (if the query is 'aaa bbb', it must be transformed into 'aaa AND bbb') # # Replace series of spaces with 'AND': aaa bbb ccc --> aaa AND bbb AND ccc aaa bbb --> aaa AND bbb aaa bbb --> aaa AND bbb # Keep 'AND' and 'OR' intact: aaa AND bbb --> aaa AND bbb aaa AND bbb --> aaa AND bbb aaa AND bbb --> aaa AND bbb aaa OR bbb --> aaa OR bbb # Keep NOT: aaa NOT bbb --> aaa NOT bbb # Trim string within ( AND ): aaa (bbb ccc) --> aaa AND (bbb AND ccc) aaa ( bbb ccc ) --> aaa AND (bbb AND ccc) # Ignore string literals: aaa "bbb ccc" --> aaa AND "bbb ccc" aaa "bbb ccc (ddd OR eee)" --> aaa AND "bbb ccc (ddd OR eee)" # Challenge: aaa AND (bbb OR "ccc (()(" ) --> aaa AND (bbb OR "ccc (()(") # Handle & in queries: TI="Ditjes & Datjes" --> TI="Ditjes & Datjes" # complex stuff PYFROM=2001 --> PYFROM=2001 money PYFROM=2002 --> money AND PYFROM=2002 money crisis PYFROM=2002 --> money AND crisis AND PYFROM=2002 money crisis PYFROM=2002 PYTILL=2009 --> money AND crisis AND PYFROM=2002 AND PYTILL=2009 money crisis JEL=B11 --> money AND crisis AND JEL=B11 money crisis JEL=B11 JEL=A1 --> money AND crisis AND JEL=B11 AND JEL=A1 money crisis PYFROM=2002 PYTILL=2009 JEL=B11 JEL=A1 --> money AND crisis AND PYFROM=2002 AND PYTILL=2009 AND JEL=B11 AND JEL=A1 # complex stuff with ands money AND economics PYFROM=2001 --> money AND economics AND PYFROM=2001 money economics AND PYFROM=2001 --> money AND economics AND PYFROM=2001 money economics AND PYFROM=2001 AND PYTILL=2009 --> money AND economics AND PYFROM=2001 AND PYTILL=2009 # complex stuff with brackets (money AND economics) PYFROM=2001 --> (money AND economics) AND PYFROM=2001 AU=Verbeek AND TI="economy in india" NOT TI=crisis JEL=B11 TYPE=report PYFROM=2007 PYTILL=2009 --> AU=Verbeek AND TI="economy in india" NOT TI=crisis AND TYPE=report AND PYFROM=2007 AND PYTILL=2009 AND JEL=B11 AU=Verbeek AND TI="economy in india" NOT TI=crisis JEL=B11 TYPE=report PYFROM=2007 PYTILL=2009 --> AU=Verbeek AND TI="economy in india" NOT TI=crisis AND TYPE=report AND PYFROM=2007 AND PYTILL=2009 AND JEL=B11 # Another challange: AU="AU=" TI=aaa bbb OR AU="aa bb" --> AU="AU=" AND TI=aaa AND bbb OR AU="aa bb" SRU=aaa bbb ccc --> (aaa and bbb and ccc) #SRU=TI="Ditjes & Datjes" --> (mods.titleInfo.title="Ditjes %26 Datjes") SRU=TI="Ditjes & Datjes" --> (mods.titleInfo.title="Ditjes & Datjes") SRU=(observing OR bail) AND szafarz --> ((observing or bail) and szafarz) (observing OR bail) AND szafarz --> (observing OR bail) AND szafarz