# PARA COMPILAR ESTE ARCHIVO: C:\Users\juanma\Documents\NetBeansProjects\ZCrawl Parser\src\parser>java -cp aparse-2.0.jar com.parse2.aparse.Parser -package parser ..\..\zcrawl.abnf
zcrawling	=   ["**" descripcion "**" mspace] space "extraer" mspace "para" mspace "la" mspace "localidad" mspace localidad
                        mspace "mediante" mspace "la" mspace "fuente" mspace fuente                        
                        [mspace "asignando" mspace "los" mspace "tags" mspace tags]
                        [mspace "a" mspace "partir" mspace criterios]
								[extraePublicacionesDeTerceros]
                        [incluyeComentarios]
								[mspace "de" mspace "los" mspace "usuarios:" mspace commenters]
                        [mspace "y" mspace "filtrando" mspace "por" mspace filtros ]
                        [incluyeTagsFuente]
                        [mspace "cada" mspace temporalidad]
                        space "." space;
descripcion     =   cadena;
localidad	=   cadena; # para toda localidad definida en el arbol de localidades de zonales encerrado entre comillas simple 
tags		=   tag *(space comma space tag);
tag		=   cadena; # para todo tag (distinto de la zona) definido en la estructura válida de tags de zonales entre comillas simple 
fuente		=   "facebook" / "twitter" / "feed" mspace "ubicado" mspace "en" mspace uri_fuente [mspace place];
uri_fuente	=   %x22 URI %x22; #  formato uri apuntando al url de definici�n, encerrada entre comilla simples 
criterios	=   criterio *(mspace "y" mspace criterio) [space "pero" mspace "no" mspace nocriterio *(space "ni" mspace nocriterio)];
criterio	=   "de" mspace "los" mspace "usuarios" mspace deLosUsuarios /
                        "de" mspace "amigos" mspace "del" mspace "usuario" mspace amigosDelUsuario /
                        [siosi] "de las palabras " palabras;
nocriterio      =   criterio;
deLosUsuarios   =   usuarios;
amigosDelUsuario =  usuario;
siosi           =   "si" mspace "o" mspace "si" mspace;
usuarios        =   usuario [mspace place] *(space comma space usuario [place]);
place           =   "[" cadena "]";
feedPlace       =   place;
geoFeed         =   geo;
geo             =   "[" latitude comma longitude "]";
latitude        =   num;
longitude       =   num;
num             =   [ "-" ] pnum;
pnum            =   1*DIGIT [ "." 1*DIGIT ];
extraePublicacionesDeTerceros  =   mspace "extrae" mspace "publicaciones" mspace "de" mspace "terceros";
incluyeComentarios  =   mspace "incluye" mspace "comentarios";
commenters      =   usuarios;
usuario		=   cadena; #  string (palabra) que identifica a un usuario en la fuente (facebook, twitter, linkedin, etc) encerrado entre comillas simple
palabras	=   palabra *(space comma space palabra);
palabra		=   cadena; #  cualquier palabra 
filtros		=   filtro *(space "y" mspace filtro);
filtro		=   space "al" mspace "menos" mspace min-num-shuld-match space "de" mspace "las" mspace "palabras" mspace "deben" mspace "estar" space /
                        space "con" mspace "una" mspace "dispercion" mspace "entre" mspace "palabras" mspace "no" mspace "mayor" mspace "a" mspace int /
                        space listaNegraUsuarios /
                        space listaNegraPalabras /
                        space "con" mspace "al" mspace "menos" mspace minActions space "actions";
listaNegraUsuarios  =   "lista" mspace "negra" mspace "de" mspace "usuarios";
listaNegraPalabras  =   "lista" mspace "negra" mspace "de" mspace "palabras";
minActions      =   int;

min-num-shuld-match =   cadena;	# segun la especificación y formato de solr 

incluyeTagsFuente   =   mspace "incluye" mspace "los" mspace "tags" mspace "de" mspace "la" mspace "fuente" space;

temporalidad    =   cantTiempo mspace unidadTiempo;

cantTiempo      =   int;

unidadTiempo    =   "minutos" /
                    "horas" /
                    "dias";

minutos         =   int;

horas         =   int;

dias         =   int;

cadena          =   DQUOTE *(ALPHA / %x23-7E / %x20) DQUOTE; # quoted string of SP and VCHAR without DQUOTE

ALPHA           =   %x41-5A / %x61-7A / "a" / "e" / "i" / "o" / "u" / "A" / "E" / "I" / "O" / "U" ; # A-Z / a-z

DQUOTE          =   %x22;

QUOTE           =   "'";

mspace          =   1*(%x09-20);

space           =   *(%x09-20);

comma           =   ",";

DIGIT		=   %x30-39; #0-9

HEXDIG		=   DIGIT / "A" / "B" / "C" / "D" / "E" / "F"; 
								
int		=   1*(%x30-39);

URI           = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ;

hier-part     = "//" authority path-abempty
               / path-absolute
               / path-rootless
               / path-empty ;

 URI-reference = URI / relative-ref ;

 absolute-URI  = scheme ":" hier-part [ "?" query ] ;

 relative-ref  = relative-part [ "?" query ] [ "#" fragment ] ;

 relative-part = "//" authority path-abempty
               / path-absolute
               / path-noscheme
               / path-empty ;

 scheme        = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ;

 authority     = [ userinfo "@" ] host [ ":" port ] ;
 userinfo      = *( unreserved / pct-encoded / sub-delims / ":" ) ;
 host          = IP-literal / IPv4address / reg-name ;
 port          = *DIGIT ;

 IP-literal    = "[" ( IPv6address / IPvFuture  ) "]" ;

 IPvFuture     = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) ;

 IPv6address   =                            6( h16 ":" ) ls32
               /                       "::" 5( h16 ":" ) ls32
               / [               h16 ] "::" 4( h16 ":" ) ls32
               / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
               / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
               / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
               / [ *4( h16 ":" ) h16 ] "::"              ls32
               / [ *5( h16 ":" ) h16 ] "::"              h16
               / [ *6( h16 ":" ) h16 ] "::" ;

 h16           = 1*4HEXDIG ;
 ls32          = ( h16 ":" h16 ) / IPv4address ;

 IPv4address   = dec-octet "." dec-octet "." dec-octet "." dec-octet ;

 dec-octet     = DIGIT                 # 0-9
               / %x31-39 DIGIT         # 10-99
               / "1" 2DIGIT            # 100-199
               / "2" %x30-34 DIGIT     # 200-249
               / "25" %x30-35;          # 250-255

 reg-name      = *( unreserved / pct-encoded / sub-delims ) ;

 path          = path-abempty    # begins with "/" or is empty
               / path-absolute   # begins with "/" but not "//"
               / path-noscheme   # begins with a non-colon segment
               / path-rootless   # begins with a segment
               / path-empty ;     # zero characters

 path-abempty  = *( "/" segment ) ;
 path-absolute = "/" [ segment-nz *( "/" segment ) ] ;
 path-noscheme = segment-nz-nc *( "/" segment ) ;
 path-rootless = segment-nz *( "/" segment ) ;
 path-empty    = 0*(pchar) ;

 segment       = *pchar ;
 segment-nz    = 1*pchar ;
 segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" ); 
               # non-zero-length segment without any colon ":" ;

 pchar         = unreserved / pct-encoded / sub-delims / ":" / "@" ;

 query         = *( pchar / "/" / "?" ) ;

 fragment      = *( pchar / "/" / "?" ) ;

 pct-encoded   = "%" HEXDIG HEXDIG ;

 unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~" ;
 reserved      = gen-delims / sub-delims ;
 gen-delims    = ":" / "/" / "?" / "#" / "[" / "]" / "@" ;
 sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
               / "*" / "+" / "," / ";" / "=" ;
