Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Codes.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Codes.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Codes.java	(revision 44738)
@@ -1,5 +1,6 @@
 package org.gvsig.expressionevaluator;
 
+import org.gvsig.tools.util.GetItemByKey;
 import org.gvsig.tools.util.UnmodifiableBasicList;
 import org.gvsig.tools.visitor.Visitable;
 
@@ -7,6 +8,14 @@
  *
  * @author jjdelcerro
  */
-public interface Codes extends Code, Visitable, UnmodifiableBasicList<Code> {
+public interface Codes extends Code, Visitable, UnmodifiableBasicList<Code>, GetItemByKey<String,Code> {
 
+  public boolean useArgNames();
+  
+  public boolean useArgNames(boolean useNames);
+  
+  public boolean contains(String name, int index);
+  
+  public String getName(int index);
+  
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Statement.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Statement.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Statement.java	(revision 44738)
@@ -32,6 +32,7 @@
         
         public boolean isReservedWord(String s);
 
+        public void trace(String msg);
     }
 
     public interface Rule {
@@ -50,6 +51,11 @@
 
         public ConditionalRule addRuleOnFalse(Rule rule);
     }
+    
+    public interface SwichTokenRule extends Rule {
+        public SwichTokenRule addCase(String token, Rule... rules);
+        public SwichTokenRule addDefault(Rule... rules);
+    }   
 
     public interface ArgsBuilder {
 
@@ -74,6 +80,8 @@
 
     public CompoundRule repeat_until_any_tokens(String... token);
 
+    public CompoundRule repeat();
+
     public Rule require_identifier(String id);
 
     public Rule require_literal_string(String id);
@@ -84,6 +92,10 @@
 
     public Rule require_expressions(String id, String separator);
 
+    public Rule break_loop();
+    
+    public SwichTokenRule switch_token();
+
     public ConditionalRule optional_any_token(String... id);
 
     public ConditionalRule optional_identifiers(String id, String separator);
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/spi/AbstractFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/spi/AbstractFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/spi/AbstractFunction.java	(revision 44738)
@@ -131,6 +131,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return false;
+    }
+    
+    @Override
     public boolean useArgumentsInsteadObjects() {
         return false;
     }
@@ -144,6 +149,11 @@
     public boolean allowConstantFolding() {
         return false;
     }
+
+    @Override
+    public boolean allowArgNames() {
+      return false;
+    }
     
     @Override
     public Object call(Interpreter interpreter, Codes args) throws Exception {
@@ -259,6 +269,24 @@
         return value;
     }
     
+    protected Object getObject(Interpreter interpreter, Codes args, String name) {
+        Code arg = args.get(name);
+        if( arg==null ) {
+            return null;
+        }
+        Object value = interpreter.run(arg);
+        return value;
+    }
+    
+    protected Object getObject(Interpreter interpreter, Codes args, String name, int index) {
+        Code arg = args.get(name+index);
+        if( arg==null ) {
+            return null;
+        }
+        Object value = interpreter.run(arg);
+        return value;
+    }
+    
     protected Date getDate(Object[] args, int n) {
         if( args.length < n  ) {
             throw new IllegalArgumentException(I18N.Required_argument_XargnX_and_only_found_XargcX_in_call_to_XIdentifierX(name(), args.length, n));
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/spi/AbstractLexicalAnalyzer.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/spi/AbstractLexicalAnalyzer.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/spi/AbstractLexicalAnalyzer.java	(revision 44738)
@@ -204,11 +204,11 @@
 
     abstract protected Token getToken();
 
-    protected void push_state() {
+    public void push_state() {
         this.states.push(position);
     }
 
-    protected void pop_state() {
+    public void pop_state() {
         position = this.states.pop();
     }
 
@@ -511,4 +511,13 @@
     public boolean getUseBracketsForIdentifiers() {
         return this.useBracketsForIdentifiers;
     }
+    
+    public String getSourceContext() {
+        String s = StringUtils.left(source, position) + "[*]" + StringUtils.mid(source, position, 200);
+        if( s.length()>200 ) {
+            s = "..."+StringUtils.mid(s, position-100, 200)+"...";
+        }
+        return s;
+    }      
+    
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Function.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Function.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Function.java	(revision 44738)
@@ -39,6 +39,8 @@
     
     public boolean isOperator();
     
+    public boolean isHidden();
+    
     public boolean useArgumentsInsteadObjects();
     
     public boolean isSQLCompatible();
@@ -53,4 +55,6 @@
      * @return true if this function allow constant folding optimization.
      */
     public boolean allowConstantFolding();
+    
+    public boolean allowArgNames();
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/LexicalAnalyzer.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/LexicalAnalyzer.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/LexicalAnalyzer.java	(revision 44738)
@@ -86,4 +86,6 @@
     public void setUseBracketsForIdentifiers(boolean useBracketsForIdentifiers);
     
     public boolean getUseBracketsForIdentifiers();
+    
+    public String getSourceContext(); 
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/test/java/org/gvsig/expresionevaluator/impl/TestGrammarCompiler.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/test/java/org/gvsig/expresionevaluator/impl/TestGrammarCompiler.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/test/java/org/gvsig/expresionevaluator/impl/TestGrammarCompiler.java	(revision 44738)
@@ -62,6 +62,10 @@
         interpreter.setSymbolTable(symbolTable);
         return interpreter;
     }
+    
+    private void link(Code code) {
+      code.link(createSymbolTable());
+    }
 
     public void testLet() {
         String source = "LET V1 = 23";
@@ -96,6 +100,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("BLOCK(LET('V1', 11), LET('V2', 22))", code.toString());
     }
 
@@ -105,6 +110,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("BLOCK_EXCEPT(LET('V1', 11), LET('V2', 22), -1)", code.toString());
     }
 
@@ -113,10 +119,12 @@
 
         String source = "BEGIN LET V1 = 11; LET V2 = 22;  END";
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("BLOCK(LET('V1', 11), LET('V2', 22))", code.toString());
 
         source = "BEGIN LET V1 = 11;; LET V2 = 22;;;  END";
         code = compiler.compileExpression(source);
+        link(code);
         assertEquals("BLOCK(LET('V1', 11), LET('V2', 22))", code.toString());
     }
 
@@ -126,6 +134,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("IFF((\"V1\" = 11), LET('V2', 22))", code.toString());
     }
 
@@ -135,6 +144,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("IFF((\"V1\" = 11), LET('V2', 11), LET('V2', 22))", code.toString());
     }
 
@@ -144,6 +154,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("IFF((\"V1\" = 11), BLOCK(LET('V2', 22), LET('V1', 10)))", code.toString());
     }
 
@@ -153,6 +164,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("WHILE((\"n\" < 10), LET('n', (\"n\" + 1)))", code.toString());
     }
 
@@ -162,6 +174,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("WHILE((\"n\" < 10), BLOCK(LET('n', (\"n\" + 1)), print(\"n\")))", code.toString());
     }
 
@@ -171,6 +184,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("CAST(\"V1\", 'INTEGER')", code.toString());
     }
 
@@ -180,6 +194,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("CAST(\"V1\", 'INTEGER')", code.toString());
     }
 
@@ -190,14 +205,17 @@
 
         source = "MATCH 'Hola', '[Hh]ola'";
         code = compiler.compileExpression(source);
+        link(code);
         assertEquals("~('Hola', '[Hh]ola')", code.toString());
 
         source = "MATCH 'Hola' '[Hh]ola'";
         code = compiler.compileExpression(source);
+        link(code);
         assertEquals("~('Hola', '[Hh]ola')", code.toString());
 
         source = "MATCH('Hola', '[Hh]ola')";
         code = compiler.compileExpression(source);
+        link(code);
         assertEquals("~('Hola', '[Hh]ola')", code.toString());
     }
 
@@ -207,6 +225,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("FOREACH('n', RANGE(10), print(\"n\"))", code.toString());
     }
 
@@ -225,6 +244,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("CASE((\"software\" LIKE '%gvSIG%'), 'gvSIG', 'Other')", code.toString());
     }
 
@@ -234,6 +254,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("CASE((\"software\" LIKE '%gvSIG%'), 'gvSIG', 'Other')", code.toString());
     }
 
@@ -243,6 +264,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("CASE(((\"Field_1\" >= 75) AND (\"Field_1\" <= 79)), ((\"Field_1\" >= 80) AND (\"Field_1\" <= 84)), 100, 110)", code.toString());
     }
     
@@ -252,6 +274,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("CASE(((\"Field_1\" >= 75) AND (\"Field_1\" <= 79)), ((\"Field_1\" >= 80) AND (\"Field_1\" <= 84)), 100, 110, 120)", code.toString());
     }
     
@@ -261,7 +284,9 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
-        assertEquals("CREATE_FUNCTION('test1', print('Hola'))", code.toString());
+        link(code);
+        assertEquals("CREATE_FUNCTION(FUNCTION_NAME:'test1', BODY:print('Hola'))", code.toString());
+                     
     }
     
     public void testDef2() {
@@ -270,7 +295,8 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
-        assertEquals("CREATE_FUNCTION('test1', LIST('nombre'), print(('Hola ' + \"nombre\")))", code.toString());
+        link(code);
+        assertEquals("CREATE_FUNCTION(FUNCTION_NAME:'test1', PARAMETERS:LIST('nombre'), BODY:print(('Hola ' + \"nombre\")))", code.toString());
     }
 
     public void testDef3() {
@@ -279,7 +305,8 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
-        assertEquals("CREATE_FUNCTION('test1', LIST('nombre'), RETURN(('Hola ' || \"nombre\")))", code.toString());
+        link(code);
+        assertEquals("CREATE_FUNCTION(FUNCTION_NAME:'test1', PARAMETERS:LIST('nombre'), BODY:RETURN(('Hola ' || \"nombre\")))", code.toString());
     }
     
     public void testCreateFunctionExtern1() {
@@ -288,7 +315,8 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
-        assertEquals("CREATE_FUNCTION('test1', LIST('nombre'), 'addons/test/test', 'test1', 'cosa')", code.toString());
+        link(code);
+        assertEquals("CREATE_FUNCTION(FUNCTION_NAME:'test1', PARAMETERS:LIST('nombre'), SCRIPT_PATH:'addons/test/test', SCRIPT_FUNCTION:'test1', LANGUAGE:'cosa')", code.toString());
     }
     
     public void testList() {
@@ -297,16 +325,28 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("LET('x', LIST('hola', 'adios', 'fin'))", code.toString());
     }
     
+    public void testTuple() {
+        String source = "set x TO TUPLE('hola','adios','fin')";
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source);
+        link(code);
+        assertEquals("LET('x', TUPLE('hola', 'adios', 'fin'))", code.toString());
+    }
+    
     public void testArray() {
-        String source = "set x TO ARRAY['hola','adios','fin']";
+        String source = "set x TO ARRAY('hola','adios','fin')";
 
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
-        assertEquals("LET('x', LIST('hola', 'adios', 'fin'))", code.toString());
+        link(code);
+        assertEquals("LET('x', ARRAY('hola', 'adios', 'fin'))", code.toString());
     }
     
     public void testUseCase1() {
@@ -315,6 +355,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("BLOCK(LET('x', ''), FOREACH('n', list('hola', 'adios', 'fin'), LET('x', ((\"x\" || ' ') || \"n\"))))", code.toString());
     }
 
@@ -324,6 +365,7 @@
         Compiler compiler = createCompiler();
 
         Code code = compiler.compileExpression(source);
+        link(code);
         assertEquals("BLOCK(LET('s', ''), LET('x', LIST('hola', 'adios', 'fin')), FOREACH('n', RANGE(3), LET('s', ((\"s\" || ' ') || GETITEM(\"x\", \"n\")))))", code.toString());
     }
 
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCompiler.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCompiler.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCompiler.java	(revision 44738)
@@ -18,9 +18,14 @@
 import org.gvsig.expressionevaluator.impl.DefaultCodeBuilder.BaseConstant;
 import org.gvsig.expressionevaluator.impl.function.operator.NegOperator;
 import org.gvsig.expressionevaluator.impl.function.programming.CodeBlockFunction;
+import org.gvsig.expressionevaluator.spi.AbstractLexicalAnalyzer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class DefaultCompiler implements Compiler {
 
+    protected static final Logger LOGGER = LoggerFactory.getLogger(DefaultCompiler.class);
+    
     class DefaultStatementContext implements StatementContext {
 
         private String codeClassifier;
@@ -89,9 +94,15 @@
             return DefaultCompiler.this.parse_expressions(separator);
         }
         
+        @Override
         public boolean isReservedWord(String s) {
             return grammars.isReservedWord(s);
         }
+        
+        @Override
+        public void trace(String msg) {
+//          System.out.println(msg+". "+this.getLexicalAnalyzer().getSourceContext());
+        } 
     }
 
     private boolean objectAccessSupported;
@@ -504,7 +515,7 @@
                 Token next = lexer.look();
                 if( next.getType() == Token.PARENTHESIS_OPEN ) {
                     lexer.next();
-                    Codes args = parse_expressions(",");
+                    Codes args = parse_arguments();
                     next = lexer.next();
                     switch(next.getType()) {
                         case Token.PARENTHESIS_CLOSE:
@@ -592,6 +603,40 @@
         }
     }
 
+    public Codes parse_arguments() {
+        String sep = ",";
+        BaseCodes codes = null;
+        while( true ) {
+            ((AbstractLexicalAnalyzer)lexer).push_state();
+            String argName = null;
+            Token tok0 = lexer.next();
+            Token tok1 = lexer.next();
+            if( tok0.getType()==Token.IDENTIFIER && tok1.is(":") ) {
+              argName = (String) tok0.getValue();
+            } else {
+              ((AbstractLexicalAnalyzer)lexer).pop_state();
+            }
+            Code code = parse_expression();
+            if( code!=null ) {
+                if( codes == null ) {
+                    codes = (BaseCodes) codeBuilder.args();
+                }
+                codes.add(argName, code);
+            }
+            Token next = lexer.look();
+            String literal = next.getLiteral();
+            if( literal == null ) {
+                return codes;
+            }
+            literal = literal.trim();
+            if( sep.equals(literal) ) {
+                lexer.next(); // Consume el ",".
+            } else {
+                return codes;
+            }
+        }
+    }
+
     private Code parse_grammars() {
         StatementContext context = new DefaultStatementContext();
         Code code;
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCodeBuilder.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCodeBuilder.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCodeBuilder.java	(revision 44738)
@@ -5,6 +5,8 @@
 import java.util.Iterator;
 import java.util.List;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
 import org.gvsig.expressionevaluator.Code;
 import static org.gvsig.expressionevaluator.Code.CALLER;
 import static org.gvsig.expressionevaluator.Code.CONSTANT;
@@ -90,7 +92,9 @@
                 }
                 if( caller.parameters() != null ) {
                     for( Code arg : caller.parameters() ) {
-                        arg.link(symbolTable);
+                        if( arg!=null ) {
+                          arg.link(symbolTable);
+                        }
                     }
                 }
             }
@@ -236,13 +240,26 @@
 
     public class BaseCodes implements Codes {
 
-        private final List<Code> codes;
+        private final List<Pair<String,Code>> codes;
+        private boolean useNames;
 
         public BaseCodes() {
             this.codes = new ArrayList<>();
+            this.useNames = false;
         }
 
         @Override
+        public boolean useArgNames() {
+          return this.useNames;
+        }
+
+        @Override
+        public boolean useArgNames(boolean useNames) {
+          this.useNames = useNames;
+          return this.useNames;
+        }
+        
+        @Override
         public int code() {
             return CODES;
         }
@@ -255,38 +272,83 @@
             return this.codes.size();
         }
 
+        public void add(String name, Code arg) {
+            this.codes.add(new ImmutablePair<>(name, arg));
+        }
+
         public void add(Code arg) {
-            this.codes.add(arg);
+            this.codes.add(new ImmutablePair<>(null, arg));
         }
 
         public void insert(int pos, Code arg) {
-            this.codes.add(pos, arg);
+            this.codes.add(pos, new ImmutablePair<>(null, arg));
         }
 
         @Override
+        public boolean contains(String name, int index) {
+          String argNameX = name + String.valueOf(index).trim();
+          for (Pair<String, Code> arg : this.codes) {
+            if( StringUtils.equalsIgnoreCase(arg.getKey(), argNameX) ) {
+              return true;
+            }
+          }
+          return false;
+        }
+        
+        @Override
         public Iterator<Code> iterator() {
-            return this.codes.iterator();
+          final Iterator<Pair<String, Code>> it = this.codes.iterator();
+          return new Iterator<Code>() {
+            @Override
+            public boolean hasNext() {
+              return it.hasNext();
+            }
+
+            @Override
+            public Code next() {
+              Pair<String, Code> arg = it.next();
+              return arg.getValue();
+            }
+          };
         }
 
         @Override
         public Code get(int n) {
-            return this.codes.get(n);
+            return this.codes.get(n).getValue();
         }
 
         @Override
+        public Code get(String name) {
+          for (Pair<String, Code> arg : this.codes) {
+            if( StringUtils.equalsIgnoreCase(name, arg.getKey()) ) {
+              return arg.getValue();
+            }
+          }
+          return null;
+        }
+
+        public String getName(int n) {
+            return this.codes.get(n).getKey();
+        }
+
+        @Override
         public boolean isEmpty() {
             return this.codes.isEmpty();
         }
 
         @Override
         public List<Code> toList() {
-            return Collections.unmodifiableList(this.codes);
+            List<Code> l = new ArrayList<>();
+            for (Pair<String, Code> arg : this.codes) {
+              l.add(arg.getValue());
+            }
+            return Collections.unmodifiableList(l);
         }
 
         @Override
         public void accept(Visitor visitor) throws BaseException {
-            for( Code arg : this.codes ) {
-                arg.accept(visitor);
+            for( Pair<String,Code> arg : this.codes ) {
+                arg.getValue().accept(visitor);
             }
         }
 
@@ -313,7 +375,12 @@
             if( codes != null ) {
                 StringBuilder builder = new StringBuilder();
                 boolean skipcoma = true;
-                for( Code code : codes ) {
+                for( Pair<String, Code> arg : codes ) {
+                    if( arg == null ) {
+                      continue;
+                    }
+                    String name = arg.getKey();
+                    Code code = arg.getValue();
                     if( code == null ) {
                         continue;
                     }
@@ -322,7 +389,13 @@
                     } else {
                         builder.append(", ");
                     }
-                    builder.append(code.toString(formatter));
+                    if( name==null || !useNames ) {
+                        builder.append(code.toString(formatter));
+                    } else {
+                        builder.append(name);
+                        builder.append(":");
+                        builder.append(code.toString(formatter));
+                    }
                 }
                 return builder.toString();
             }
@@ -331,8 +404,8 @@
 
         @Override
         public void link(SymbolTable symbolTable) {
-            for (Code code : this.codes) {
-                code.link(symbolTable);
+            for (Pair<String,Code> arg : this.codes) {
+                arg.getValue().link(symbolTable);
             }
         }
 
@@ -377,6 +450,9 @@
         @Override
         public Function function(Function function) {
             this.function = function;
+            if( this.args!=null && this.function!=null ) {
+              this.args.useArgNames(this.function.allowArgNames());
+            }
             return this.function;
         }
 
@@ -472,12 +548,30 @@
                     break;
                 case FUNCTION:
                 default:
-                    builder.append(this.name());
-                    builder.append("(");
-                    if( this.parameters()!=null ) {
-                        builder.append(this.parameters().toString(formatter));
+                    if( StringUtils.equalsIgnoreCase(this.name(),GetattrFunction.NAME) ) {
+                      Code arg0 = this.parameters().get(0);
+                      Code arg1 = this.parameters().get(1);
+                      if( arg0 instanceof Code.Identifier && arg1 instanceof Code.Constant ) {
+                        builder.append(arg0.toString(formatter));
+                        builder.append(".\"");
+                        builder.append(((Code.Constant)arg1).value());
+                        builder.append("\"");
+                      } else {
+                        builder.append(this.name());
+                        builder.append("(");
+                        builder.append(arg0.toString(formatter));
+                        builder.append(", ");
+                        builder.append(arg1.toString(formatter));
+                        builder.append(")");
+                      }
+                    } else {
+                      builder.append(this.name());
+                      builder.append("(");
+                      if( this.parameters()!=null ) {
+                          builder.append(this.parameters().toString(formatter));
+                      }
+                      builder.append(")");
                     }
-                    builder.append(")");
             }
             return builder.toString();
         }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultOptimizer.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultOptimizer.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultOptimizer.java	(revision 44738)
@@ -7,6 +7,7 @@
 import org.gvsig.expressionevaluator.Code;
 import org.gvsig.expressionevaluator.Code.Caller;
 import org.gvsig.expressionevaluator.CodeBuilder;
+import org.gvsig.expressionevaluator.Codes;
 import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
 import org.gvsig.expressionevaluator.Function;
 import org.gvsig.expressionevaluator.Interpreter;
@@ -212,9 +213,11 @@
                             boolean canOptimize = true;
                             if (caller.parameters() != null) {
                                 newArgs = (BaseCodes) this.getCodeBuilder().args();
-                                for (Code arg : caller.parameters()) {
+                                Codes parameters = caller.parameters();
+                                for (int i = 0; i < parameters.size(); i++) {
+                                    Code arg = parameters.get(i);
                                     Code newArg = this.doOptimize(arg);
-                                    newArgs.add(newArg);
+                                    newArgs.add(parameters.getName(i), newArg);
                                     if (newArg.code() != Code.CONSTANT) {
                                         canOptimize = false;
                                     }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/grammars/BasicGrammarFactory.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/grammars/BasicGrammarFactory.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/grammars/BasicGrammarFactory.java	(revision 44738)
@@ -20,6 +20,7 @@
 import org.gvsig.expressionevaluator.impl.function.programming.CodeBlockWithExceptFunction;
 import org.gvsig.expressionevaluator.impl.function.programming.CreateFnFunction;
 import org.gvsig.expressionevaluator.impl.function.programming.ForEachFunction;
+import org.gvsig.expressionevaluator.impl.function.programming.ForFunction;
 import org.gvsig.expressionevaluator.impl.function.programming.ReturnFunction;
 import org.gvsig.expressionevaluator.impl.function.programming.WhileFunction;
 import org.gvsig.expressionevaluator.spi.AbstractGrammarFactory;
@@ -129,16 +130,20 @@
             theGrammar.addStatement(stmt);
 
 //            stmt = theGrammar.createStatement("FOR");
-//            stmt.addRule(stmt.require_token("FOR"));
+//            stmt.addRule(stmt.require_any_token("FOR"));
 //            stmt.addRule(stmt.require_expression("INIT"));
-//            stmt.addRule(stmt.require_token(";"));
+//            stmt.addRule(stmt.require_any_token(";"));
 //            stmt.addRule(stmt.require_expression("CONDITION"));
-//            stmt.addRule(stmt.require_token(";"));
+//            stmt.addRule(stmt.require_any_token(";"));
 //            stmt.addRule(stmt.require_expression("STEP"));
-//            stmt.addRule(stmt.optional_token(":"));
+//            stmt.addRule(stmt.require_any_token("BEGIN", ":"));
 //            stmt.addRule(stmt.require_expression("BODY"));
-//            stmt.addRule(stmt.optional_token("END"));
-//            stmt.code(ForFunction.NAME,"INIT","CONDITION","STEP","BODY"); 
+//            stmt.addRule(stmt.require_any_token("END"));
+//            stmt.addRule(stmt.optional_any_token("FOR"));
+//            stmt.code(
+//                    ForFunction.NAME,
+//                    stmt.args_names("INIT","CONDITION","STEP","BODY")
+//            ); 
 //            theGrammar.addStatement(stmt);
 
             stmt = theGrammar.createStatement("FOREACH");
@@ -182,7 +187,7 @@
             stmt.addRule(stmt.optional_any_token("FUNCTION", "PROCEDURE"));
             stmt.addRule(stmt.require_identifier("FUNCTION_NAME"));
             stmt.addRule(stmt.optional_any_token("("));
-            stmt.addRule(stmt.optional_identifiers("PARAM_NAMES", ","));
+            stmt.addRule(stmt.optional_identifiers("PARAMETERS", ","));
             stmt.addRule(stmt.optional_any_token(")"));
             stmt.addRule(stmt.require_any_token("AS"));
             stmt.addRule(stmt.optional_any_token("$$","BEGIN")
@@ -203,7 +208,7 @@
 //            stmt.addRule(stmt.optional_any_token("FUNCTION", "PROCEDURE"));
             stmt.code(
                     CreateFnFunction.NAME,
-                    stmt.args_names("FUNCTION_NAME","PARAM_NAMES","BODY", "SCRIPT_PATH", "SCRIPT_FUNCTION", "LANGUAGE")
+                    stmt.args_names("FUNCTION_NAME","PARAMETERS","BODY", "SCRIPT_PATH", "SCRIPT_FUNCTION", "LANGUAGE")
             ); 
             theGrammar.addStatement(stmt);
 
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultGrammar.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultGrammar.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultGrammar.java	(revision 44738)
@@ -50,8 +50,10 @@
 
     @Override
     public Statement getApplicableStatement(StatementContext context) {
+        context.trace(this.getName()+".getApplicableStatement");
         for (Statement statement : statements) {
             if( statement.isApplicable(context) ) {
+                context.trace(this.getName()+".getApplicableStatement return "+statement);
                 return statement;
             }
         }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ListFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ListFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ListFunction.java	(revision 44738)
@@ -20,7 +20,6 @@
                 "List",
                 false
         );
-        this.addAlias("array");
     }
 
     @Override
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CaseFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CaseFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CaseFunction.java	(revision 44738)
@@ -26,6 +26,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return true;
+    }
+    
+    @Override
     public boolean useArgumentsInsteadObjects() {
         return true;
     }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/TryFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/TryFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/TryFunction.java	(revision 44738)
@@ -23,6 +23,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return true;
+    }
+    
+    @Override
     public boolean useArgumentsInsteadObjects() {
         return true;
     }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ReturnFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ReturnFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ReturnFunction.java	(revision 44738)
@@ -22,6 +22,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return true;
+    }
+    
+    @Override
     public boolean allowConstantFolding() {
         return false;
     }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CodeBlockFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CodeBlockFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CodeBlockFunction.java	(revision 44738)
@@ -25,6 +25,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return true;
+    }
+    
+    @Override
     public boolean useArgumentsInsteadObjects() {
         return true;
     }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ForFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ForFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ForFunction.java	(revision 44738)
@@ -23,6 +23,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return true;
+    }
+    
+    @Override
     public boolean useArgumentsInsteadObjects() {
         return true;
     }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CreateFnFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CreateFnFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CreateFnFunction.java	(revision 44738)
@@ -4,7 +4,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Objects;
 import org.apache.commons.lang3.Range;
 import org.apache.commons.lang3.StringUtils;
 import org.gvsig.expressionevaluator.Code;
@@ -39,6 +38,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return true;
+    }
+    
+    @Override
     public boolean useArgumentsInsteadObjects() {
         return true;
     }
@@ -47,6 +51,11 @@
     public boolean allowConstantFolding() {
         return false;
     }
+
+    @Override
+    public boolean allowArgNames() {
+      return true;
+    }
     
     @Override
     public Object call(Interpreter interpreter, Object[] args) throws Exception {
@@ -55,52 +64,17 @@
     
     @Override
     public Object call(Interpreter interpreter, Codes args) throws Exception {
-        // FNAME, PARAM-NAMES, BODY
         if( !(interpreter.getSymbolTable() instanceof MutableSymbolTable) ) {
             throw new ExpressionRuntimeException("The use of user functions require a mutable symbol table.");
         }
         MutableSymbolTable symbolTable = (MutableSymbolTable) interpreter.getSymbolTable();
         
-        String name;
-        List<String> argNames;
-        Code body = null;
-        String script_path = null;
-        String script_function = null;
-        String language = null;
-        // name, body
-        // name, args, body
-        // name, script_name, script_func, lang
-        // name, args, script_name, script_func, lang
-        switch(args.size()) {
-            case 2:
-                name = (String) getObject(interpreter, args, 0);
-                argNames = null;
-                body = args.get(1);
-                break;
-            case 3:
-                name = (String) getObject(interpreter, args, 0);
-                if( args.get(1)==null ) {
-                    argNames = null;
-                } else {
-                    argNames = (List<String>) getObject(interpreter, args, 1);
-                }
-                body = args.get(2);
-                break;
-            case 6:
-                name = (String) getObject(interpreter, args, 0);
-                if( args.get(1)==null ) {
-                    argNames = null;
-                } else {
-                    argNames = (List<String>) getObject(interpreter, args, 1);
-                }
-                body = args.get(2);
-                script_path = (args.get(3)==null)? null:((String)((Code.Constant)args.get(3)).value());
-                script_function = (args.get(4)==null)? null:((String)((Code.Constant)args.get(4)).value());
-                language = (args.get(5)==null)? null:((String)((Code.Constant)args.get(5)).value()).toLowerCase();
-                break;
-            default:
-                throw new ExpressionRuntimeException("Incorrect number of arguments");
-        }
+        String name = (String) getObject(interpreter, args, "FUNCTION_NAME");
+        List<String> argNames = (List<String>) getObject(interpreter, args, "PARAMETERS");
+        Code body = args.get("BODY");
+        String script_path = (String) getObject(interpreter, args, "SCRIPT_PATH");
+        String script_function = (String) getObject(interpreter, args, "SCRIPT_FUNCTION");
+        String language = (String) getObject(interpreter, args, "LANGUAGE");
         Function fn;
         if( body!=null ) {
             fn = new UserFunction(name, argNames, body);
@@ -136,8 +110,13 @@
             this.argNames = argNames;
             this.body = body;
         }
-        
+
         @Override
+        public boolean allowArgNames() {
+          return true;
+        }
+
+        @Override
         public Object call(Interpreter interpreter, Object[] args) throws Exception {
             Object value;
             ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/TupleFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/TupleFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/TupleFunction.java	(revision 44738)
@@ -1,13 +1,10 @@
 package org.gvsig.expressionevaluator.impl.function.programming;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import org.apache.commons.lang3.Range;
 import static org.gvsig.expressionevaluator.ExpressionBuilder.FUNCTION_TUPLE;
 import org.gvsig.expressionevaluator.Function;
 import org.gvsig.expressionevaluator.Interpreter;
 import org.gvsig.expressionevaluator.spi.AbstractFunction;
-import org.gvsig.tools.util.UnmodifiableBasicListAdapter;
 
 public class TupleFunction extends AbstractFunction {
     
@@ -21,6 +18,7 @@
                 "TUPLE",
                 false
         );
+        this.addAlias("ARRAY");
     }
 
     @Override
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CodeBlockWithExceptFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CodeBlockWithExceptFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/CodeBlockWithExceptFunction.java	(revision 44738)
@@ -25,6 +25,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return true;
+    }
+    
+    @Override
     public boolean useArgumentsInsteadObjects() {
         return true;
     }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ForEachFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ForEachFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/ForEachFunction.java	(revision 44738)
@@ -25,6 +25,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return true;
+    }
+    
+    @Override
     public boolean useArgumentsInsteadObjects() {
         return true;
     }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/WhileFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/WhileFunction.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/programming/WhileFunction.java	(revision 44738)
@@ -24,6 +24,11 @@
     }
 
     @Override
+    public boolean isHidden() {
+      return true;
+    }
+    
+    @Override
     public boolean useArgumentsInsteadObjects() {
         return true;
     }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultStatement.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultStatement.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultStatement.java	(revision 44738)
@@ -5,6 +5,8 @@
 import java.util.Objects;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
 import org.gvsig.expressionevaluator.Code;
 import org.gvsig.expressionevaluator.Code.Caller;
 import org.gvsig.expressionevaluator.Codes;
@@ -18,6 +20,7 @@
 import org.gvsig.expressionevaluator.Statement.StatementContext;
 import org.gvsig.expressionevaluator.impl.function.programming.CodeBlockFunction;
 import org.gvsig.expressionevaluator.impl.DefaultCodeBuilder.BaseCodes;
+import org.gvsig.expressionevaluator.spi.AbstractLexicalAnalyzer;
 
 /**
  *
@@ -31,12 +34,16 @@
 //    private String codeId;
 //    private ArgsBuilder argsBuilder;
 
+    public interface IsApplicableRule extends Rule {
+      public boolean isApplicable(StatementContext context);
+    }
+    
     public interface RepeatRule extends CompoundRule {
 
         public String getClassifier();
     }
 
-    public class RuleRequireAnyToken implements Rule {
+    public class RuleRequireAnyToken implements IsApplicableRule {
 
         private final String[] required_token;
 
@@ -46,6 +53,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             Token token = context.look_token();
             if (!token.is(this.required_token)) {
                 throw new ExpressionSyntaxException(
@@ -59,9 +67,12 @@
             context.next_token();
         }
 
-        private boolean isApplicable(StatementContext context) {
-            Token token = context.look_token();
-            return token.is(this.required_token);
+        @Override
+        public boolean isApplicable(StatementContext context) {
+            Token token = context.next_token();
+            boolean r = token.is(this.required_token);
+            context.trace(this.toString()+".isApplicable return "+r);
+            return r;
         }
 
         @Override
@@ -71,7 +82,7 @@
 
     }
 
-    public class RuleRequireIdentifier implements Rule {
+    public class RuleRequireIdentifier implements IsApplicableRule {
 
         private final String id;
 
@@ -81,6 +92,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             Token token = context.look_token();
             if (token.getType() != Token.IDENTIFIER) {
                 throw new ExpressionSyntaxException(
@@ -95,6 +107,14 @@
         }
 
         @Override
+        public boolean isApplicable(StatementContext context) {
+            Token token = context.next_token();
+            boolean r = token.getType() == Token.IDENTIFIER;
+            context.trace(this.toString()+".isApplicable return "+r);
+            return r;
+        }
+        
+        @Override
         public String toString() {
             return "require_identifier('" + this.id + "')";
         }
@@ -110,6 +130,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             Token token = context.look_token();
             if (token.getType() != Token.STRING_LITERAL) {
                 throw new ExpressionSyntaxException(
@@ -139,6 +160,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             Code code = context.parse_expression();
             if (code == null) {
                 throw new ExpressionSyntaxException(context.getLexicalAnalyzer());
@@ -165,6 +187,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             if( this.value instanceof Code ) {
                 context.setCode(id, (Code) this.value);
             } else {
@@ -190,6 +213,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             Codes codes = context.parse_expressions(this.separator);
             if (codes == null) {
                 throw new ExpressionSyntaxException(context.getLexicalAnalyzer());
@@ -259,6 +283,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             Token token = context.look_token();
             if (token.is(this.optional_token)) {
                 context.next_token();
@@ -286,10 +311,57 @@
 
         @Override
         public String toString() {
-            return "optional_token(" + StringUtils.join(this.optional_token) + ") rules:" + StringUtils.join(onTrueRules, ",");
+            return "optional_token(" + StringUtils.join(this.optional_token) + ") onTrue:" + StringUtils.join(onTrueRules, ",")+", onFalse:" + StringUtils.join(onFalseRules, ",");
         }
     }
 
+    public class RuleSwitchToken implements SwichTokenRule {
+
+        private final List<Pair<String,Rule[]>> caseRules;
+        private Rule[] defaultRule;
+
+        public RuleSwitchToken() {
+            this.caseRules = new ArrayList<>();
+        }
+
+        @Override
+        public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
+            Token token = context.look_token();
+            for (Pair<String, Rule[]> caseRule : caseRules) {
+              if( token.is(caseRule.getKey()) ) {
+                context.next_token();
+                for (Rule rule : caseRule.getValue()) {
+                  rule.parse(context);
+                }
+                return;
+              }
+            }
+            if( defaultRule!=null ) {
+              for (Rule rule : defaultRule) {
+                rule.parse(context);
+              }
+            }
+        }
+
+        @Override
+        public SwichTokenRule addCase(String token, Rule... rules) {
+            this.caseRules.add(new ImmutablePair(token,rules));
+            return this;
+        }
+
+        @Override
+        public SwichTokenRule addDefault(Rule... rules) {
+            this.defaultRule = rules;
+            return this;
+        }
+
+        @Override
+        public String toString() {
+            return "switch_token() rules:" + StringUtils.join(this.caseRules,",") + " default: " + defaultRule;
+        }
+    }
+
     public class RuleRepeatUntilAnyTokens implements RepeatRule {
 
         private final String[] exit_tokens;
@@ -303,6 +375,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             String save = context.getCodeClassifier();
             try {
                 this.counter = 1;
@@ -340,6 +413,78 @@
         }
     }
 
+    public class RuleRepeat implements RepeatRule {
+
+        private final List<Rule> rules;
+        private int counter;
+
+        public RuleRepeat() {
+            this.rules = new ArrayList<>();
+        }
+
+        @Override
+        public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
+            String save = context.getCodeClassifier();
+            try {
+                this.counter = 1;
+                boolean breakloop = false;
+                while (!breakloop) {
+                    context.setCodeClassifier(String.valueOf(counter).trim());
+                    for (Rule rule : rules) {
+                      try {
+                        rule.parse(context);
+                      } catch(BreakLoopException ex) {
+                        breakloop = true;
+                        break;
+                      }
+                    }
+                    this.counter = this.counter + 1;
+                }
+            } finally {
+                context.setCodeClassifier(save);
+            }
+        }
+
+        @Override
+        public RuleRepeat addRule(Rule rule) {
+            this.rules.add(rule);
+            return this;
+        }
+
+        @Override
+        public String getClassifier() {
+            String s = String.valueOf(counter).trim();
+            return s;
+        }
+
+        @Override
+        public String toString() {
+            return "repeat() rules:" + StringUtils.join(rules, ",");
+        }
+    }
+
+    public static class BreakLoopException extends RuntimeException {
+      
+    }
+    
+    public static class RuleBreakLoop implements Rule {
+
+        public RuleBreakLoop() {
+        }
+
+        @Override
+        public void parse(StatementContext context) {
+          context.trace(this.toString()+".parse");
+          throw new BreakLoopException();
+        }
+
+        @Override
+        public String toString() {
+            return "break_loop()";
+        }
+    }
+
     public class RuleOptionalIdentifiers extends AbstractConditionalRule implements ConditionalRule {
 
         private final String id;
@@ -353,6 +498,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             BaseCodes args = (BaseCodes) context.getCodeBuilder().args();
             Token token = context.look_token();
             while (token.getType() == Token.IDENTIFIER) {
@@ -396,6 +542,7 @@
 
         @Override
         public void parse(StatementContext context) {
+            context.trace(this.toString()+".parse");
             Token token = context.look_token();
             if (token.getType() == Token.STRING_LITERAL) {
                 String s = (String) token.getValue();
@@ -416,14 +563,20 @@
 
     public static class ArgsBuilderFromNames implements ArgsBuilder {
 
-        private final String[] argNames;
+        protected final String[] argNames;
 
         public ArgsBuilderFromNames(String... argNames) {
             this.argNames = argNames;
         }
 
         @Override
+        public String toString() {
+          return "args_names("+StringUtils.join(argNames,",")+")";
+        }
+        
+        @Override
         public Codes build(StatementContext context) {
+            context.trace(this.toString()+".build");
             BaseCodes args = (BaseCodes) context.getCodeBuilder().args();
             for (String argName : argNames) {
                 if (argName.contains("#")) {
@@ -434,7 +587,7 @@
                         if (code == null) {
                             break;
                         }
-                        args.add(code);
+                        args.add(argNameX, code);
                         n++;
                     }
                 } else {
@@ -442,7 +595,7 @@
 //                    if( code == null) {
 //                        code = context.getCodeBuilder().constant(null);
 //                    }
-                    args.add(code);
+                    args.add(argName,code);
                 }
             }
             return args;
@@ -456,6 +609,11 @@
         }
 
         @Override
+        public String toString() {
+          return "args_expand("+StringUtils.join(argNames,",")+")";
+        }
+        
+        @Override
         public Codes build(StatementContext context) {
             BaseCodes args = (BaseCodes) context.getCodeBuilder().args();
             
@@ -595,11 +753,25 @@
         if (this.rules.isEmpty()) {
             return false;
         }
-        Rule rule = this.rules.get(0);
-        if (!(rule instanceof RuleRequireAnyToken)) {
-            return false;
+        context.trace(this.getName()+".isApplicable");
+        AbstractLexicalAnalyzer lexer = (AbstractLexicalAnalyzer) context.getLexicalAnalyzer();
+        lexer.push_state();
+        try {
+          boolean applicable = false;
+          for (Rule rule : rules) {
+            if (!(rule instanceof IsApplicableRule)) {
+                break;
+            }
+            if( !((IsApplicableRule) rule).isApplicable(context) ) {
+              return false;
+            }
+            applicable = true;
+          }
+          context.trace(this.getName()+".isApplicable return "+applicable);
+          return applicable;
+        } finally {
+          lexer.pop_state();
         }
-        return ((RuleRequireAnyToken) rule).isApplicable(context);
     }
 
     @Override
@@ -619,17 +791,19 @@
         this.builder(new StatementBuilderBase(id, argsBuilder));
     }
 
+    @Override
     public void builder(StatementBuilder builder) {
         this.stmtBuilder = builder;
     }
     
     @Override
     public Code parse(StatementContext context) {
-//        System.err.println("start parse "+this.getName());
+        context.trace(this.getName()+".parse");
         for (Rule rule : rules) {
             rule.parse(context);
         }
         Code code = this.stmtBuilder.build(context);
+        context.trace(this.getName()+".return "+code);
         return code;
     }
 
@@ -638,4 +812,20 @@
         return this.getName() + " " + StringUtils.join(this.rules, ";");
 
     }
+
+    @Override
+    public CompoundRule repeat() {
+      return new RuleRepeat();
+    }
+
+    @Override
+    public Rule break_loop() {
+      return new RuleBreakLoop();
+    }
+    
+    @Override
+    public SwichTokenRule switch_token() {
+      return new RuleSwitchToken();
+    }
+
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.swing/org.gvsig.expressionevaluator.swing.impl/src/main/java/org/gvsig/expressionevaluator/swing/impl/DefaultExpressionEvaluatorSwingManager.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.swing/org.gvsig.expressionevaluator.swing.impl/src/main/java/org/gvsig/expressionevaluator/swing/impl/DefaultExpressionEvaluatorSwingManager.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.swing/org.gvsig.expressionevaluator.swing.impl/src/main/java/org/gvsig/expressionevaluator/swing/impl/DefaultExpressionEvaluatorSwingManager.java	(revision 44738)
@@ -60,7 +60,7 @@
         
         for (SymbolTable symbolTable : symbolTables) {
             for (Function function : symbolTable.functions()) {
-                if( isAllowed == null || isAllowed.test(function) ) {
+                if( !function.isHidden() && isAllowed != null && isAllowed.test(function) ) {
                   functions.put(function.name().toUpperCase(), function);
                 }
             }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.time/org.gvsig.expressionevaluator.time.lib/org.gvsig.expressionevaluator.time.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.time/org.gvsig.expressionevaluator.time.lib/org.gvsig.expressionevaluator.time.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.time/org.gvsig.expressionevaluator.time.lib/org.gvsig.expressionevaluator.time.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 44738)
@@ -1 +1 @@
-org.gvsig.expressionevaluator.impl.GeometryExpressionEvaluatorImplLibrary
\ No newline at end of file
+org.gvsig.expressionevaluator.impl.TimeExpressionEvaluatorImplLibrary
\ No newline at end of file
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/resources/org/gvsig/fmap/dal/swing/impl/searchpanel/.directory
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/resources/org/gvsig/fmap/dal/swing/impl/searchpanel/.directory	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/resources/org/gvsig/fmap/dal/swing/impl/searchpanel/.directory	(revision 44738)
@@ -0,0 +1,4 @@
+[Dolphin]
+Timestamp=2020,2,2,10,33,14
+Version=4
+ViewMode=1
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/pom.xml
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/pom.xml	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/pom.xml	(revision 44738)
@@ -93,6 +93,11 @@
             <artifactId>org.gvsig.projection.cresques.ui</artifactId>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-collections4</artifactId>
+            <scope>compile</scope>
+        </dependency>
 
         <dependency>
             <groupId>org.gvsig</groupId>
@@ -159,12 +164,6 @@
             <artifactId>org.gvsig.fmap.dal.file.shp</artifactId>
             <scope>runtime</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-collections4</artifactId>
-            <version>4.1</version>
-            <type>jar</type>
-        </dependency>
     </dependencies>
 
 </project>
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/Feature.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/Feature.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/Feature.java	(revision 44738)
@@ -38,501 +38,452 @@
 import org.gvsig.tools.evaluator.EvaluatorData;
 import org.gvsig.tools.util.GetItemByKey;
 
-
 /**
- * <p>Represents the basic data unit of a tabular structure, equivalent
- * to a record in a data base table. In SIG domain, a Feature is a compound
- * data structure that may contain a geographic component. The conventional term
- * Feature comes from the term cartographic feature and both represent the same
- * concept.
+ * <p>
+ * Represents the basic data unit of a tabular structure, equivalent to a record
+ * in a data base table. In SIG domain, a Feature is a compound data structure
+ * that may contain a geographic component. The conventional term Feature comes
+ * from the term cartographic feature and both represent the same concept.
  * </p>
  * <p>
- * A Feature may contain more than one geometry attribute. In the case there is not any geometry data,
- * the <code>getDefaultGeometry()</code> will return <code>null</code>.
+ * A Feature may contain more than one geometry attribute. In the case there is
+ * not any geometry data, the <code>getDefaultGeometry()</code> will return
+ * <code>null</code>.
  * </p>
  * <p>
  * Features are not editable as such. To edit a Feature you have to obtain an
- * editable instance <code>EditableFeature</code> using the method <code>getEditable()</code>.
- * Modify that editable instance and then apply the changes to the Feature. This
- * mechanism is to avoid ambiguity and loosing track on the Feature internal state.
+ * editable instance <code>EditableFeature</code> using the method
+ * <code>getEditable()</code>. Modify that editable instance and then apply the
+ * changes to the Feature. This mechanism is to avoid ambiguity and loosing
+ * track on the Feature internal state.
  * </p>
  * <br>
- * <p>The Feature:
- *   <ul>
- *     <li>Has an unique identifier <code>FeatureReference</code>
- *     to recognize our Feature from each other from the same data store</li>
- *     <li>Has a <code>FeatureType</code> that describes the Feature characteristics (attributes,
- *     data types, default geometry, validation rules).</li>
- *     <li>Can obtain a copy of itself.</li>
- *     <li>Can obtain its default geometry attribute and also a list with all the geometry attributes.</li>
- *     <li>Can obtain its default Spatial Reference System and also a list with all the SRSs used in the geometry attributes.</li>
- *     <li>Can obtain the envelope (extent) of the default geometry attribute.
- *     <li>Can obtain the editable instance of the Feature.</li>
- *     <li>Has a set of utility methods to read attributes when their type is known, by both index and name.</li>
- *   </ul>
+ * <p>
+ * The Feature:
+ * <ul>
+ * <li>Has an unique identifier <code>FeatureReference</code> to recognize our
+ * Feature from each other from the same data store</li>
+ * <li>Has a <code>FeatureType</code> that describes the Feature characteristics
+ * (attributes, data types, default geometry, validation rules).</li>
+ * <li>Can obtain a copy of itself.</li>
+ * <li>Can obtain its default geometry attribute and also a list with all the
+ * geometry attributes.</li>
+ * <li>Can obtain its default Spatial Reference System and also a list with all
+ * the SRSs used in the geometry attributes.</li>
+ * <li>Can obtain the envelope (extent) of the default geometry attribute.
+ * <li>Can obtain the editable instance of the Feature.</li>
+ * <li>Has a set of utility methods to read attributes when their type is known,
+ * by both index and name.</li>
+ * </ul>
  * </p>
  *
  */
-public interface Feature extends GetItemByKey<String, Object>{
+public interface Feature extends GetItemByKey<String, Object> {
 
-	/**
-	 * Returns a unique identifier for this Feature in the associated store.
-	 *
-	 * @return
-	 * 		a unique FeatureReference in the associated store
-	 */
-	public FeatureReference getReference();
+  /**
+   * Returns a unique identifier for this Feature in the associated store.
+   *
+   * @return a unique FeatureReference in the associated store
+   */
+  public FeatureReference getReference();
 
-	/**
-	 * Returns the FeatureType that describes the structure of this Feature.
-	 *
-	 * @return
-	 * 		a FeatureType describing this Feature structure.
-	 */
-	public FeatureType getType();
+  /**
+   * Returns the FeatureType that describes the structure of this Feature.
+   *
+   * @return a FeatureType describing this Feature structure.
+   */
+  public FeatureType getType();
 
-	/**
-	 * Creates and returns a copy of this
-	 *
-	 * @return
-	 * 		a new instance of Feature which is equal to this
-	 */
-	public Feature getCopy();
+  /**
+   * Creates and returns a copy of this
+   *
+   * @return a new instance of Feature which is equal to this
+   */
+  public Feature getCopy();
 
-	/** Mode that indicates the validation of all FeatureRules */
-	static final int ALL = 0;
+  /**
+   * Mode that indicates the validation of all FeatureRules
+   */
+  static final int ALL = 0;
 
-	/** Mode that indicates the validation of the update FeatureRules */
-	static final int UPDATE = 1;
+  /**
+   * Mode that indicates the validation of the update FeatureRules
+   */
+  static final int UPDATE = 1;
 
-	/** Mode that indicates the validation of the finish editing FeatureRules */
-	static final int FINISH_EDITING = 2;
+  /**
+   * Mode that indicates the validation of the finish editing FeatureRules
+   */
+  static final int FINISH_EDITING = 2;
 
-	/**
-	 * Validates this Feature by applying the <code>FeatureRules</code>
-	 * corresponding to the given mode.
-	 *
-	 * @param mode
-	 * 			one of the constants {ALL, UPDATE, FINISH_EDITING}
-         * @throws DataException on validation errors
-	 */
-	public void validate(int mode) throws DataException;
+  /**
+   * Validates this Feature by applying the <code>FeatureRules</code>
+   * corresponding to the given mode.
+   *
+   * @param mode one of the constants {ALL, UPDATE, FINISH_EDITING}
+   * @throws DataException on validation errors
+   */
+  public void validate(int mode) throws DataException;
 
-	/**
-	 * Returns the editable instance of this Feature.
-	 * EditableFeature offers methods for Feature editing.
-	 *
-	 * @return
-	 * 		EditableFeature of this
-	 */
-	public EditableFeature getEditable();
+  /**
+   * Returns the editable instance of this Feature. EditableFeature offers
+   * methods for Feature editing.
+   *
+   * @return EditableFeature of this
+   */
+  public EditableFeature getEditable();
 
-        public Object getOrDefault(String name, Object defaultValue);
-        public String getStringOrDefault(String name, String defaultValue);
-        public int getIntOrDefault(String name, int defaultValue);
-        public long getLongOrDefault(String name, long defaultValue);
-        public float getFloatOrDefault(String name, float defaultValue);
-        public double getDoubleOrDefault(String name, double defaultValue);
-        public BigDecimal getDecimalOrDefault(String name, BigDecimal defaultValue);
-        public Date getDateOrDefault(String name, Date defaultValue);
-        
-        public Object getOrDefault(int index, Object defaultValue);
-        public String getStringOrDefault(int index, String defaultValue);
-        public int getIntOrDefault(int index, int defaultValue);
-        public long getLongOrDefault(int index, long defaultValue);
-        public float getFloatOrDefault(int index, float defaultValue);
-        public double getDoubleOrDefault(int index, double defaultValue);
-        public BigDecimal getDecimalOrDefault(int index, BigDecimal defaultValue);
-        public Date getDateOrDefault(int index, Date defaultValue);
-        
-        /**
-	 * Returns the value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			a string containing the name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-        @Override
-	public Object   get(String name);
+  public Object getOrDefault(String name, Object defaultValue);
 
-	/**
-	 * Returns the value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public Object   get(int index);
+  public String getStringOrDefault(String name, String defaultValue);
 
-        public boolean isNull(int index);
-        
-        public boolean isNull(String name);
-        
-	/**
-	 * Returns the int value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			a string containing the name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public int      getInt(String name);
+  public int getIntOrDefault(String name, int defaultValue);
 
-	/**
-	 * Returns the int value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public int      getInt(int index);
+  public long getLongOrDefault(String name, long defaultValue);
 
-	/**
-	 * Returns the Boolean value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public boolean  getBoolean(String name);
+  public float getFloatOrDefault(String name, float defaultValue);
 
-	/**
-	 * Returns the Boolean value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public boolean  getBoolean(int index);
+  public double getDoubleOrDefault(String name, double defaultValue);
 
-	/**
-	 * Returns the long value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public long     getLong(String name);
+  public BigDecimal getDecimalOrDefault(String name, BigDecimal defaultValue);
 
-	/**
-	 * Returns the long value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public long     getLong(int index);
+  public Date getDateOrDefault(String name, Date defaultValue);
 
-	/**
-	 * Returns the float value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public float   getFloat(String name);
+  public Object getOrDefault(int index, Object defaultValue);
 
-	/**
-	 * Returns the float value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public float    getFloat(int index);
+  public String getStringOrDefault(int index, String defaultValue);
 
-	/**
-	 * Returns the double value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public double  getDouble(String name);
+  public int getIntOrDefault(int index, int defaultValue);
 
-	/**
-	 * Returns the double value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public double   getDouble(int index);
+  public long getLongOrDefault(int index, long defaultValue);
 
-	/**
-	 * Returns the BigDecimal value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public BigDecimal getDecimal(String name);
+  public float getFloatOrDefault(int index, float defaultValue);
 
-	/**
-	 * Returns the BigDecimal value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public BigDecimal getDecimal(int index);
+  public double getDoubleOrDefault(int index, double defaultValue);
 
-	/**
-	 * Returns the Date value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public Date    getDate(String name);
+  public BigDecimal getDecimalOrDefault(int index, BigDecimal defaultValue);
 
-	/**
-	 * Returns the Date value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public Date     getDate(int index);
+  public Date getDateOrDefault(int index, Date defaultValue);
 
-	/**
-	 * Returns the String value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public String  getString(String name);
+  /**
+   * Returns the value of an attribute given its name.
+   *
+   * @param name a string containing the name of the attribute
+   * @return value of the specified attribute
+   */
+  @Override
+  public Object get(String name);
 
-	/**
-	 * Returns the String value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public String   getString(int index);
+  /**
+   * Returns the value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public Object get(int index);
 
-	/**
-	 * Returns the byte value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public byte    getByte(String name);
+  public boolean isNull(int index);
 
-	/**
-	 * Returns the byte value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public byte     getByte(int index);
+  public boolean isNull(String name);
 
-	/**
-	 * Returns the Geometry value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public Geometry getGeometry(String name);
+  /**
+   * Returns the int value of an attribute given its name.
+   *
+   * @param name a string containing the name of the attribute
+   * @return value of the specified attribute
+   */
+  public int getInt(String name);
 
-	/**
-	 * Returns the Geometry value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public Geometry getGeometry(int index);
+  /**
+   * Returns the int value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public int getInt(int index);
 
-	public byte[] getByteArray(String name);
+  /**
+   * Returns the Boolean value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public boolean getBoolean(String name);
 
-	public byte[] getByteArray(int index);
+  /**
+   * Returns the Boolean value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public boolean getBoolean(int index);
 
-        /**
-	 * Returns the array value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public Object[] getArray(String name);
+  /**
+   * Returns the long value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public long getLong(String name);
 
-	/**
-	 * Returns the array value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public Object[] getArray(int index);
+  /**
+   * Returns the long value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public long getLong(int index);
 
-	/**
-	 * Returns the Feature value of an attribute given its name.
-	 *
-	 * @param name
-	 * 			name of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public Feature  getFeature(String name);
+  /**
+   * Returns the float value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public float getFloat(String name);
 
-	/**
-	 * Returns the Feature value of an attribute given its position.
-	 *
-	 * @param index
-	 * 			position of the attribute
-	 * @return
-	 * 		value of the specified attribute
-	 */
-	public Feature  getFeature(int index);
+  /**
+   * Returns the float value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public float getFloat(int index);
 
+  /**
+   * Returns the double value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public double getDouble(String name);
 
-        public Object getFromProfile(int index);
-        
-        public Object getFromProfile(String name);
-        
-	/**
-	 * Envelope (AKA extent or bounding box) of the default
-	 * geometry attribute.
-	 *
-	 * @return Envelope
-	 * 				of the default geometry attribute
-	 */
-	public Envelope getDefaultEnvelope();
+  /**
+   * Returns the double value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public double getDouble(int index);
 
-	/**
-	 * Returns the value of the default geometry attribute,
-	 * which is a {@link Geometry}.
-	 *
-	 * @return
-	 * 		value of the default geometry attribute
-	 */
-	public Geometry getDefaultGeometry();
+  /**
+   * Returns the BigDecimal value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public BigDecimal getDecimal(String name);
 
-	/**
-	 * Returns a list with the values of this Feature's
-	 * geometry attributes.
-	 *
-	 * @return
-	 * 		a list with the values of this Feature's geometry attributes
-	 */
-	public List getGeometries();
+  /**
+   * Returns the BigDecimal value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public BigDecimal getDecimal(int index);
 
-	/**
-	 * Returns the Spatial Reference System in which is
-	 * expressed the default geometry attribute.
-	 *
-	 * @return
-	 * 		A string containing the default geometry attribute SRS.
-	 */
-	public IProjection getDefaultSRS();
+  /**
+   * Returns the Date value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public Date getDate(String name);
 
-	/**
-	 * Returns a list with the Spatial Reference Systems in which
-	 * are expressed this Feature's geometry attributes.
-	 *
-	 * @return
-	 * 		a list with the Spatial Reference Systems.
-	 */
-	public List getSRSs();
-	
-        
-	public Time getDefaultTime();
-	
-    	public Time getTime(int index);
-        
-    	public Time getTime(String name);
-        
-    /**
-     * Returns the instant value of an attribute given its position.
-     *
-     * @param index
-     *          position of the attribute
-     * @return
-     *      value of the specified attribute
-     */
-	public Instant getInstant(int index);
+  /**
+   * Returns the Date value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public Date getDate(int index);
 
-	/**
-     * Returns the instant value of an attribute given its name.
-     *
-     * @param name
-     *          a string containing the name of the attribute
-     * @return
-     *      value of the specified attribute
-     */
-	public Instant getInstant(String name);
+  /**
+   * Returns the String value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public String getString(String name);
 
-    /**
-     * Returns the interval value of an attribute given its position.
-     *
-     * @param index
-     *          position of the attribute
-     * @return
-     *      value of the specified attribute
-     */
-	public Interval getInterval(int index);
+  /**
+   * Returns the String value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public String getString(int index);
 
-	/**
-     * Returns the interval value of an attribute given its name.
-     *
-     * @param name
-     *          a string containing the name of the attribute
-     * @return
-     *      value of the specified attribute
-     */
-	public Interval getInterval(String name);
+  /**
+   * Returns the byte value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public byte getByte(String name);
 
-	public DynObject getAsDynObject();
-	
-	/**
-	 * This lets Feature be used eaily with {@link Evaluator}
-	 * 
-	 * @return
-	 *     An instance of {@link EvaluatorData} which returns the data
-	 *     of this feature
-	 */
-	public EvaluatorData getEvaluatorData();
-        
-        /**
-         * Return the store associated to this feature.
-         * 
-         * @return the FeatureStore of the feature.
-         */
-        public FeatureStore getStore();
+  /**
+   * Returns the byte value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public byte getByte(int index);
 
-        public String getLabelOfValue(String name);
+  /**
+   * Returns the Geometry value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public Geometry getGeometry(String name);
 
-        public Object getExtraValue(int index);
-        
-        public Object getExtraValue(String name);
+  /**
+   * Returns the Geometry value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public Geometry getGeometry(int index);
 
+  public byte[] getByteArray(String name);
+
+  public byte[] getByteArray(int index);
+
+  /**
+   * Returns the array value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public Object[] getArray(String name);
+
+  /**
+   * Returns the array value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public Object[] getArray(int index);
+
+  /**
+   * Returns the Feature value of an attribute given its name.
+   *
+   * @param name name of the attribute
+   * @return value of the specified attribute
+   */
+  public Feature getFeature(String name);
+
+  /**
+   * Returns the Feature value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public Feature getFeature(int index);
+
+  public Object getFromProfile(int index);
+
+  public Object getFromProfile(String name);
+
+  /**
+   * Envelope (AKA extent or bounding box) of the default geometry attribute.
+   *
+   * @return Envelope of the default geometry attribute
+   */
+  public Envelope getDefaultEnvelope();
+
+  /**
+   * Returns the value of the default geometry attribute, which is a
+   * {@link Geometry}.
+   *
+   * @return value of the default geometry attribute
+   */
+  public Geometry getDefaultGeometry();
+
+  /**
+   * Returns a list with the values of this Feature's geometry attributes.
+   *
+   * @return a list with the values of this Feature's geometry attributes
+   */
+  public List getGeometries();
+
+  /**
+   * Returns the Spatial Reference System in which is expressed the default
+   * geometry attribute.
+   *
+   * @return A string containing the default geometry attribute SRS.
+   */
+  public IProjection getDefaultSRS();
+
+  /**
+   * Returns a list with the Spatial Reference Systems in which are expressed
+   * this Feature's geometry attributes.
+   *
+   * @return a list with the Spatial Reference Systems.
+   */
+  public List getSRSs();
+
+  public Time getDefaultTime();
+
+  public Time getTime(int index);
+
+  public Time getTime(String name);
+
+  /**
+   * Returns the instant value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public Instant getInstant(int index);
+
+  /**
+   * Returns the instant value of an attribute given its name.
+   *
+   * @param name a string containing the name of the attribute
+   * @return value of the specified attribute
+   */
+  public Instant getInstant(String name);
+
+  /**
+   * Returns the interval value of an attribute given its position.
+   *
+   * @param index position of the attribute
+   * @return value of the specified attribute
+   */
+  public Interval getInterval(int index);
+
+  /**
+   * Returns the interval value of an attribute given its name.
+   *
+   * @param name a string containing the name of the attribute
+   * @return value of the specified attribute
+   */
+  public Interval getInterval(String name);
+
+  public DynObject getAsDynObject();
+
+  /**
+   * This lets Feature be used eaily with {@link Evaluator}
+   *
+   * @return An instance of {@link EvaluatorData} which returns the data of this
+   * feature
+   */
+  public EvaluatorData getEvaluatorData();
+
+  /**
+   * Return the store associated to this feature.
+   *
+   * @return the FeatureStore of the feature.
+   */
+  public FeatureStore getStore();
+
+  public String getLabelOfValue(String name);
+
+  public Object getExtraValue(int index);
+
+  public Object getExtraValue(String name);
+
+  public boolean hasExtraValue(String name);
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/DataManager.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/DataManager.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/DataManager.java	(revision 44738)
@@ -107,7 +107,7 @@
      * parameters for the memory provider
      *
      */
-    public DataStoreParameters createStoreParameters(String name)
+    public DataStoreParameters createStoreParameters(String name, Object... arguments)
             throws InitializeException, ProviderNotRegisteredException;
 
     public DataStoreParameters createStoreParameters(byte[] data);
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java	(revision 44738)
@@ -246,5 +246,10 @@
     public void setExtraValueNames(String[] extraValueNames) {
         this.original.setExtraValueNames(extraValueNames);
     }
+
+  @Override
+  public boolean hasExtraValue(String name) {
+    return this.original.hasExtraValue(name);
+  }
     
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java	(revision 44738)
@@ -21,7 +21,6 @@
  * For any additional information, do not hesitate to contact us
  * at info AT gvsig.com, or visit our website www.gvsig.com.
  */
-
 package org.gvsig.fmap.dal.feature.spi;
 
 import org.gvsig.fmap.dal.feature.FeatureType;
@@ -29,7 +28,6 @@
 import org.gvsig.fmap.geom.primitive.Envelope;
 import org.gvsig.timesupport.Time;
 
-
 /**
  * Inteface for feature of feature based data provider
  *
@@ -38,58 +36,59 @@
  */
 public interface FeatureProvider {
 
-        /**
-         * Indicates whether the attributo must be assigned by the provider.
-         * Return true if can be assigned, otherwise return false.
-         * 
-         * @param i
-         *      index of the attribute 
-         * @return True if the attribute i can't be set
-         */
-        public boolean isReadOnly(int i);
-        
-	public void set(int i, Object value);
+  /**
+   * Indicates whether the attributo must be assigned by the provider. Return
+   * true if can be assigned, otherwise return false.
+   *
+   * @param i index of the attribute
+   * @return True if the attribute i can't be set
+   */
+  public boolean isReadOnly(int i);
 
-	public Object get(int i);
+  public void set(int i, Object value);
 
-	public void set(String name, Object value);
+  public Object get(int i);
 
-	public Object get(String name);
+  public void set(String name, Object value);
 
-	public void setOID(Object oid);
+  public Object get(String name);
 
-	public Object getOID();
+  public void setOID(Object oid);
 
-	public FeatureType getType();
+  public Object getOID();
 
-	public FeatureProvider getCopy();
+  public FeatureType getType();
 
-	public Envelope getDefaultEnvelope();
+  public FeatureProvider getCopy();
 
-	public Geometry getDefaultGeometry();
-        
-        public Time getDefaultTime();
+  public Envelope getDefaultEnvelope();
 
-	public void setDefaultEnvelope(Envelope extent);
+  public Geometry getDefaultGeometry();
 
-	public void setDefaultGeometry(Geometry geom);
+  public Time getDefaultTime();
 
-        public void setDefaultTime(Time time);
-        
-	public boolean isNull(int i);
+  public void setDefaultEnvelope(Envelope extent);
 
-	public boolean isNull(String name);
+  public void setDefaultGeometry(Geometry geom);
 
-	public boolean isNew();
+  public void setDefaultTime(Time time);
 
-	public void setNew(boolean isNew);
+  public boolean isNull(int i);
 
-        public void setExtraValue(int index, Object value);
-        
-        public Object getExtraValue(int index);
-        
-        public Object getExtraValue(String name);
+  public boolean isNull(String name);
 
-        public void setExtraValueNames(String[] extraValueNames);
+  public boolean isNew();
 
+  public void setNew(boolean isNew);
+
+  public void setExtraValue(int index, Object value);
+
+  public void setExtraValueNames(String[] extraValueNames);
+
+  public Object getExtraValue(int index);
+
+  public Object getExtraValue(String name);
+
+  public boolean hasExtraValue(String name);
+
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java	(revision 44738)
@@ -310,6 +310,19 @@
     }
 
     @Override
+    public boolean hasExtraValue(String name) {
+        if( this.extraValuesNames == null ) {
+            return false;
+        }
+        for (int i = 0; i < this.extraValuesNames.length; i++) {
+            if( StringUtils.equalsIgnoreCase(this.extraValuesNames[i], name) ) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
     public void setExtraValueNames(String[] extraValueNames) {
         this.extraValuesNames = extraValueNames;
         this.extraValues = new Object[this.extraValuesNames.length];
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/java/org/gvsig/fmap/dal/store/csv/TestUtils.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/java/org/gvsig/fmap/dal/store/csv/TestUtils.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/java/org/gvsig/fmap/dal/store/csv/TestUtils.java	(revision 44738)
@@ -7,6 +7,7 @@
 import org.gvsig.fmap.dal.DALLocator;
 import org.gvsig.fmap.dal.DataManager;
 import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.StoresRepository;
 import org.gvsig.fmap.dal.feature.FeatureStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -23,7 +24,7 @@
     }
     
     public static File getResource(String name) throws Exception {
-        File x = new File(getTargetFolder(), name);
+        File x = FileUtils.getFile(getTargetFolder(), "test-classes", name);
         return x;
     }
     
@@ -41,7 +42,7 @@
 
     public static FeatureStore openSourceStore1() throws Exception {
         DataManager dataManager = DALLocator.getDataManager();
-        File f = getResource("/org/gvsig/fmap/dal/store/testCreateSource1.csv");
+        File f = getResource("/org/gvsig/fmap/dal/store/csv/testCreateSource1.csv");
         FeatureStore store = (FeatureStore) dataManager.openStore(
                 DataStore.CSV_PROVIDER_NAME, 
                 "file=",f,
@@ -51,4 +52,42 @@
         return store;
     }
     
+    public static FeatureStore openSourceCountries() throws Exception {
+        DataManager dataManager = DALLocator.getDataManager();
+        StoresRepository repository = dataManager.getStoresRepository();
+        FeatureStore store = (FeatureStore) repository.getStore("countries");
+        return store;
+    }
+
+    public static FeatureStore openSourceContinents() throws Exception {
+        DataManager dataManager = DALLocator.getDataManager();
+        StoresRepository repository = dataManager.getStoresRepository();
+        FeatureStore store = (FeatureStore) repository.getStore("continents");
+        return store;
+    }
+    
+    public static void initialiceRepository() throws Exception {
+        DataManager dataManager = DALLocator.getDataManager();
+        StoresRepository repository = dataManager.getStoresRepository();
+        repository.add(
+                "continents", 
+                dataManager.createStoreParameters(
+                DataStore.CSV_PROVIDER_NAME, 
+                "file=",getResource("/org/gvsig/fmap/dal/store/csv/continents.csv"),
+                "automaticTypesDetection=", false,
+                "delimiter=",",",
+                "locale=","en"
+                )
+        );
+        repository.add(
+                "countries", 
+                dataManager.createStoreParameters(
+                DataStore.CSV_PROVIDER_NAME, 
+                "file=",getResource("/org/gvsig/fmap/dal/store/csv/countries.csv"),
+                "automaticTypesDetection=", false,
+                "delimiter=",",",
+                "locale=","en"
+                )
+        );
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/java/org/gvsig/fmap/dal/store/csv/TestFilter1.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/java/org/gvsig/fmap/dal/store/csv/TestFilter1.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/java/org/gvsig/fmap/dal/store/csv/TestFilter1.java	(revision 44738)
@@ -0,0 +1,86 @@
+package org.gvsig.fmap.dal.store.csv;
+
+import java.util.List;
+import junit.framework.TestCase;
+import static junit.framework.TestCase.assertEquals;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestFilter1 extends TestCase {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(TestFilter1.class);
+
+  public TestFilter1(String testName) {
+    super(testName);
+  }
+
+  @Override
+  protected void setUp() throws Exception {
+    super.setUp();
+    new DefaultLibrariesInitializer().fullInitialize();
+  }
+
+  @Override
+  protected void tearDown() throws Exception {
+    super.tearDown();
+  }
+
+  // TODO add test methods here. The name must begin with 'test'. For example:
+  // public void testHello() {}
+  
+  public void testSimpleFilter1() throws Exception {
+    TestUtils.initialiceRepository();
+    FeatureStore countries = TestUtils.openSourceCountries();
+    List<Feature> features = countries.getFeatures("LASTCENSUS > 0");
+    assertEquals("Filter: LASTCENSUS > 0", features.size(), 209);
+  }
+
+  public void testSimpleFilter2() throws Exception {
+    TestUtils.initialiceRepository();
+    FeatureStore countries = TestUtils.openSourceCountries();
+    List<Feature> features = countries.getFeatures("countries.LASTCENSUS > 0");
+    assertEquals("Filter: countries.LASTCENSUS > 0", features.size(), 209);
+  }
+
+  public void testSubselectFilter1() throws Exception {
+    TestUtils.initialiceRepository();
+
+    // Sobre la tabla de continentes, para obtener la lista de continentes 
+    // que tienen paises asociados a Gran Breta�a.
+    // Filtramos continentes por un campo del pais.
+    StringBuilder filter = new StringBuilder();
+    filter.append("EXISTS(");
+    filter.append(" SELECT * FROM countries");
+    filter.append("   WHERE ");
+    filter.append("     continents.NAME = countries.CONTINENT AND ");
+    filter.append("     countries.SOV_A3 = 'GB1' "); //FR1=4, GB1=6
+    filter.append("   LIMIT 1; ");
+    filter.append(")");
+
+    FeatureStore continents = TestUtils.openSourceContinents();
+    List<Feature> features = continents.getFeatures(filter.toString());
+    assertEquals("Filter: subselect GB1", features.size(), 6);
+  }
+
+  public void testSubselectFilter2() throws Exception {
+    TestUtils.initialiceRepository();
+
+    // Sobre la tabla de continentes, para obtener la lista de continentes 
+    // que tienen paises asociados a Francia.
+    StringBuilder filter = new StringBuilder();
+    filter.append("EXISTS(");
+    filter.append(" SELECT 1 FROM countries");
+    filter.append("   WHERE ");
+    filter.append("     continents.NAME = countries.CONTINENT AND ");
+    filter.append("     countries.SOV_A3 = 'FR1' "); //FR1=4, GB1=6
+    filter.append("   LIMIT 1; ");
+    filter.append(")");
+
+    FeatureStore continents = TestUtils.openSourceContinents();
+    List<Feature> features = continents.getFeatures(filter.toString());
+    assertEquals("Filter: subselect FR1", features.size(), 4);
+  }
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/resources/org/gvsig/fmap/dal/store/csv/countries.csv
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/resources/org/gvsig/fmap/dal/store/csv/countries.csv	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/resources/org/gvsig/fmap/dal/store/csv/countries.csv	(revision 44738)
@@ -0,0 +1,256 @@
+SOVEREIGNT__String__32,SOV_A3__String__3,NAME__String__36,NAME_LONG__String__40,ABBREV__String__13,POSTAL__String__4,FORMAL_EN__String__52,NAME_SORT__String__36,NAME_ALT__String__38,LASTCENSUS__Double,ECONOMY__String__26,FIPS_10__String__3,ISO_A2__String__5,ISO_A3__String__3,ISO_N3__String__3,CONTINENT__String__23,REGION_UN__String__23,SUBREGION__String__25,REGION_WB__String__26,COATOFARMS__File
+Netherlands,NL1,Aruba,Aruba,Aruba,AW,Aruba,Aruba,xxxx,2.010,6. Developing region,AA,AW,ABW,533,North America,Americas,Caribbean,Latin America & Caribbean,countries/COATOFARMS/Aruba.png
+Afghanistan,AFG,Afghanistan,Afghanistan,Afg.,AF,Islamic State of Afghanistan,Afghanistan,,1.979,7. Least developed region,AF,AF,AFG,004,Asia,Asia,Southern Asia,South Asia,
+Angola,AGO,Angola,Angola,Ang.,AO,People's Republic of Angola,Angola,,1.970,7. Least developed region,AO,AO,AGO,024,Africa,Africa,Middle Africa,Sub-Saharan Africa,
+United Kingdom,GB1,Anguilla,Anguilla,Ang.,AI,,Anguilla,,-99,6. Developing region,AV,AI,AIA,660,North America,Americas,Caribbean,Latin America & Caribbean,
+Albania,ALB,Albania,Albania,Alb.,AL,Republic of Albania,Albania,,2.001,6. Developing region,AL,AL,ALB,008,Europe,Europe,Southern Europe,Europe & Central Asia,
+Finland,FI1,Aland,Aland Islands,Aland,AI,Ãland Islands,Aland,,-99,2. Developed region: nonG7,-99,AX,ALA,248,Europe,Europe,Northern Europe,Europe & Central Asia,
+Andorra,AND,Andorra,Andorra,And.,AND,Principality of Andorra,Andorra,,1.989,2. Developed region: nonG7,AN,AD,AND,020,Europe,Europe,Southern Europe,Europe & Central Asia,
+United Arab Emirates,ARE,United Arab Emirates,United Arab Emirates,U.A.E.,AE,United Arab Emirates,United Arab Emirates,,2.010,6. Developing region,AE,AE,ARE,784,Asia,Asia,Western Asia,Middle East & North Africa,
+Argentina,ARG,Argentina,Argentina,Arg.,AR,Argentine Republic,Argentina,,2.010,5. Emerging region: G20,AR,AR,ARG,032,South America,Americas,South America,Latin America & Caribbean,
+Armenia,ARM,Armenia,Armenia,Arm.,ARM,Republic of Armenia,Armenia,,2.001,6. Developing region,AM,AM,ARM,051,Asia,Asia,Western Asia,Europe & Central Asia,
+United States of America,US1,American Samoa,American Samoa,Am. Samoa,AS,American Samoa,American Samoa,,2.010,6. Developing region,AQ,AS,ASM,016,Oceania,Oceania,Polynesia,East Asia & Pacific,
+Antarctica,ATA,Antarctica,Antarctica,Ant.,AQ,,Antarctica,,-99,6. Developing region,AY,AQ,ATA,010,Antarctica,Antarctica,Antarctica,Antarctica,
+Australia,AU1,Ashmore and Cartier Is.,Ashmore and Cartier Islands,A.C.Is.,AU,Territory of Ashmore and Cartier Islands,Ashmore and Cartier Islands,,-99,7. Least developed region,AT,-99,-99,036,Oceania,Oceania,Australia and New Zealand,East Asia & Pacific,
+France,FR1,Fr. S. Antarctic Lands,French Southern and Antarctic Lands,Fr. S.A.L.,TF,Territory of the French Southern and Antarctic Lands,French Southern and Antarctic Lands,,-99,6. Developing region,FS,TF,ATF,260,Seven seas (open ocean),Seven seas (open ocean),Seven seas (open ocean),Sub-Saharan Africa,
+Antigua and Barbuda,ATG,Antigua and Barb.,Antigua and Barbuda,Ant.B.,AG,Antigua and Barbuda,Antigua and Barbuda,,2.011,6. Developing region,AC,AG,ATG,028,North America,Americas,Caribbean,Latin America & Caribbean,
+Australia,AU1,Australia,Australia,Auz.,AU,Commonwealth of Australia,Australia,,2.006,2. Developed region: nonG7,AS,AU,AUS,036,Oceania,Oceania,Australia and New Zealand,East Asia & Pacific,
+Austria,AUT,Austria,Austria,Aust.,A,Republic of Austria,Austria,,2.011,2. Developed region: nonG7,AU,AT,AUT,040,Europe,Europe,Western Europe,Europe & Central Asia,
+Azerbaijan,AZE,Azerbaijan,Azerbaijan,Aze.,AZ,Republic of Azerbaijan,Azerbaijan,,2.009,6. Developing region,AJ,AZ,AZE,031,Asia,Asia,Western Asia,Europe & Central Asia,
+Burundi,BDI,Burundi,Burundi,Bur.,BI,Republic of Burundi,Burundi,,2.008,7. Least developed region,BY,BI,BDI,108,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Belgium,BEL,Belgium,Belgium,Belg.,B,Kingdom of Belgium,Belgium,,2.011,2. Developed region: nonG7,BE,BE,BEL,056,Europe,Europe,Western Europe,Europe & Central Asia,
+Benin,BEN,Benin,Benin,Benin,BJ,Republic of Benin,Benin,,2.002,7. Least developed region,BN,BJ,BEN,204,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Burkina Faso,BFA,Burkina Faso,Burkina Faso,B.F.,BF,Burkina Faso,Burkina Faso,,2.006,7. Least developed region,UV,BF,BFA,854,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Bangladesh,BGD,Bangladesh,Bangladesh,Bang.,BD,People's Republic of Bangladesh,Bangladesh,,2.011,7. Least developed region,BG,BD,BGD,050,Asia,Asia,Southern Asia,South Asia,
+Bulgaria,BGR,Bulgaria,Bulgaria,Bulg.,BG,Republic of Bulgaria,Bulgaria,,2.011,2. Developed region: nonG7,BU,BG,BGR,100,Europe,Europe,Eastern Europe,Europe & Central Asia,
+Bahrain,BHR,Bahrain,Bahrain,Bahr.,BH,Kingdom of Bahrain,Bahrain,,2.010,6. Developing region,BA,BH,BHR,048,Asia,Asia,Western Asia,Middle East & North Africa,
+The Bahamas,BHS,Bahamas,Bahamas,Bhs.,BS,Commonwealth of the Bahamas,"Bahamas, The",,2.010,6. Developing region,BF,BS,BHS,044,North America,Americas,Caribbean,Latin America & Caribbean,
+Bosnia and Herzegovina,BIH,Bosnia and Herz.,Bosnia and Herzegovina,B.H.,BiH,Bosnia and Herzegovina,Bosnia and Herzegovina,,1.991,6. Developing region,BK,BA,BIH,070,Europe,Europe,Southern Europe,Europe & Central Asia,
+Bajo Nuevo Bank (Petrel Is.),BJN,Bajo Nuevo Bank (Petrel Is.),Bajo Nuevo Bank (Petrel Islands),,,,Bajo Nuevo Bank (Petrel Is.),,-99,7. Least developed region,-99,-99,-99,-99,North America,Americas,Caribbean,Latin America & Caribbean,
+France,FR1,St-BarthÃ©lemy,Saint-BarthÃ©lemy,St. B.,BL,Saint-BarthÃ©lemy,St-BarthÃ©lemy,,-99,2. Developed region: nonG7,TB,BL,BLM,652,North America,Americas,Caribbean,Latin America & Caribbean,
+Belarus,BLR,Belarus,Belarus,Bela.,BY,Republic of Belarus,Belarus,,2.009,6. Developing region,BO,BY,BLR,112,Europe,Europe,Eastern Europe,Europe & Central Asia,
+Belize,BLZ,Belize,Belize,Belize,BZ,Belize,Belize,,2.010,6. Developing region,BH,BZ,BLZ,084,North America,Americas,Central America,Latin America & Caribbean,
+United Kingdom,GB1,Bermuda,Bermuda,Berm.,BM,The Bermudas or Somers Isles,Bermuda,,2.010,2. Developed region: nonG7,BD,BM,BMU,060,North America,Americas,Northern America,North America,
+Bolivia,BOL,Bolivia,Bolivia,Bolivia,BO,Plurinational State of Bolivia,Bolivia,,2.001,5. Emerging region: G20,BL,BO,BOL,068,South America,Americas,South America,Latin America & Caribbean,
+Brazil,BRA,Brazil,Brazil,Brazil,BR,Federative Republic of Brazil,Brazil,,2.010,3. Emerging region: BRIC,BR,BR,BRA,076,South America,Americas,South America,Latin America & Caribbean,
+Barbados,BRB,Barbados,Barbados,Barb.,BB,Barbados,Barbados,,2.010,6. Developing region,BB,BB,BRB,052,North America,Americas,Caribbean,Latin America & Caribbean,
+Brunei,BRN,Brunei,Brunei Darussalam,Brunei,BN,Negara Brunei Darussalam,Brunei,,2.001,6. Developing region,BX,BN,BRN,096,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Bhutan,BTN,Bhutan,Bhutan,Bhutan,BT,Kingdom of Bhutan,Bhutan,,2.005,7. Least developed region,BT,BT,BTN,064,Asia,Asia,Southern Asia,South Asia,
+Botswana,BWA,Botswana,Botswana,Bwa.,BW,Republic of Botswana,Botswana,,2.011,6. Developing region,BC,BW,BWA,072,Africa,Africa,Southern Africa,Sub-Saharan Africa,
+Central African Republic,CAF,Central African Rep.,Central African Republic,C.A.R.,CF,Central African Republic,Central African Republic,,2.003,7. Least developed region,CT,CF,CAF,140,Africa,Africa,Middle Africa,Sub-Saharan Africa,
+Canada,CAN,Canada,Canada,Can.,CA,Canada,Canada,,2.011,1. Developed region: G7,CA,CA,CAN,124,North America,Americas,Northern America,North America,countries/COATOFARMS/Canada.png
+Switzerland,CHE,Switzerland,Switzerland,Switz.,CH,Swiss Confederation,Switzerland,,2.010,2. Developed region: nonG7,SZ,CH,CHE,756,Europe,Europe,Western Europe,Europe & Central Asia,
+Chile,CHL,Chile,Chile,Chile,CL,Republic of Chile,Chile,,2.002,5. Emerging region: G20,CI,CL,CHL,152,South America,Americas,South America,Latin America & Caribbean,
+China,CH1,China,China,China,CN,People's Republic of China,China,,2.010,3. Emerging region: BRIC,CH,CN,CHN,156,Asia,Asia,Eastern Asia,East Asia & Pacific,
+Ivory Coast,CIV,CÃ´te d'Ivoire,CÃ´te d'Ivoire,I.C.,CI,Republic of Ivory Coast,CÃ´te d'Ivoire,,1.998,6. Developing region,IV,CI,CIV,384,Africa,Africa,Western Africa,Sub-Saharan Africa,
+France,FR1,Clipperton I.,Clipperton Island,Clp. I.,CI,,Clipperton Island,,-99,7. Least developed region,IP,-99,-99,-99,Seven seas (open ocean),Americas,Central America,Latin America & Caribbean,
+Cameroon,CMR,Cameroon,Cameroon,Cam.,CM,Republic of Cameroon,Cameroon,,2.005,6. Developing region,CM,CM,CMR,120,Africa,Africa,Middle Africa,Sub-Saharan Africa,
+Cyprus No Mans Area,CNM,Cyprus U.N. Buffer Zone,Cyprus U.N. Buffer Zone,,,Cyprus No Mans Land,Cyprus No Mans Area,,-99,6. Developing region,-99,-99,-99,-99,Asia,Asia,Western Asia,Europe & Central Asia,
+Democratic Republic of the Congo,COD,Dem. Rep. Congo,Democratic Republic of the Congo,D.R.C.,DRC,Democratic Republic of the Congo,"Congo, Dem. Rep.",,1.984,7. Least developed region,CG,CD,COD,180,Africa,Africa,Middle Africa,Sub-Saharan Africa,
+Republic of Congo,COG,Congo,Republic of Congo,Rep. Congo,CG,Republic of Congo,"Congo, Rep.",,2.007,6. Developing region,CF,CG,COG,178,Africa,Africa,Middle Africa,Sub-Saharan Africa,
+New Zealand,NZ1,Cook Is.,Cook Islands,Cook Is.,CK,,Cook Islands,,-99,6. Developing region,CW,CK,COK,184,Oceania,Oceania,Polynesia,East Asia & Pacific,
+Colombia,COL,Colombia,Colombia,Col.,CO,Republic of Colombia,Colombia,,2.006,6. Developing region,CO,CO,COL,170,South America,Americas,South America,Latin America & Caribbean,
+Comoros,COM,Comoros,Comoros,Com.,KM,Union of the Comoros,Comoros,,2.003,7. Least developed region,CN,KM,COM,174,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Cape Verde,CPV,Cape Verde,Cape Verde,C.Vd.,CV,Republic of Cape Verde,Cape Verde,,2.010,6. Developing region,CV,CV,CPV,132,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Costa Rica,CRI,Costa Rica,Costa Rica,C.R.,CR,Republic of Costa Rica,Costa Rica,,2.011,5. Emerging region: G20,CS,CR,CRI,188,North America,Americas,Central America,Latin America & Caribbean,
+Australia,AU1,Coral Sea Is.,Coral Sea Islands,C.S.I.,CS,Coral Sea Islands Territory,Coral Sea Islands,,-99,7. Least developed region,CR,-99,-99,-99,Oceania,Oceania,Australia and New Zealand,East Asia & Pacific,
+Cuba,CUB,Cuba,Cuba,Cuba,CU,Republic of Cuba,Cuba,,2.002,5. Emerging region: G20,CU,CU,CUB,192,North America,Americas,Caribbean,Latin America & Caribbean,
+Netherlands,NL1,CuraÃ§ao,CuraÃ§ao,Cur.,CW,CuraÃ§ao,CuraÃ§ao,,-99,6. Developing region,NT,CW,CUW,531,North America,Americas,Caribbean,Latin America & Caribbean,
+United Kingdom,GB1,Cayman Is.,Cayman Islands,Cym. Is.,KY,Cayman Islands,Cayman Islands,,2.010,5. Emerging region: G20,CJ,KY,CYM,136,North America,Americas,Caribbean,Latin America & Caribbean,
+Northern Cyprus,CYN,N. Cyprus,Northern Cyprus,N. Cy.,CN,Turkish Republic of Northern Cyprus,"Cyprus, Northern",,-99,6. Developing region,-99,-99,-99,-99,Asia,Asia,Western Asia,Europe & Central Asia,
+Cyprus,CYP,Cyprus,Cyprus,Cyp.,CY,Republic of Cyprus,Cyprus,,2.001,6. Developing region,CY,CY,CYP,196,Asia,Asia,Western Asia,Europe & Central Asia,
+Czech Republic,CZE,Czech Rep.,Czech Republic,Cz. Rep.,CZ,Czech Republic,Czech Republic,,2.011,2. Developed region: nonG7,EZ,CZ,CZE,203,Europe,Europe,Eastern Europe,Europe & Central Asia,
+Germany,DEU,Germany,Germany,Ger.,D,Federal Republic of Germany,Germany,,2.011,1. Developed region: G7,GM,DE,DEU,276,Europe,Europe,Western Europe,Europe & Central Asia,
+Djibouti,DJI,Djibouti,Djibouti,Dji.,DJ,Republic of Djibouti,Djibouti,,2.009,7. Least developed region,DJ,DJ,DJI,262,Africa,Africa,Eastern Africa,Middle East & North Africa,
+Dominica,DMA,Dominica,Dominica,D'inca,DM,Commonwealth of Dominica,Dominica,,2.011,6. Developing region,DO,DM,DMA,212,North America,Americas,Caribbean,Latin America & Caribbean,
+Denmark,DN1,Denmark,Denmark,Den.,DK,Kingdom of Denmark,Denmark,,2.011,2. Developed region: nonG7,DA,DK,DNK,208,Europe,Europe,Northern Europe,Europe & Central Asia,
+Dominican Republic,DOM,Dominican Rep.,Dominican Republic,Dom. Rep.,DO,Dominican Republic,Dominican Republic,,2.010,6. Developing region,DR,DO,DOM,214,North America,Americas,Caribbean,Latin America & Caribbean,
+Algeria,DZA,Algeria,Algeria,Alg.,DZ,People's Democratic Republic of Algeria,Algeria,,2.008,6. Developing region,AG,DZ,DZA,012,Africa,Africa,Northern Africa,Middle East & North Africa,
+Ecuador,ECU,Ecuador,Ecuador,Ecu.,EC,Republic of Ecuador,Ecuador,,2.010,6. Developing region,EC,EC,ECU,218,South America,Americas,South America,Latin America & Caribbean,
+Egypt,EGY,Egypt,Egypt,Egypt,EG,Arab Republic of Egypt,"Egypt, Arab Rep.",,2.006,5. Emerging region: G20,EG,EG,EGY,818,Africa,Africa,Northern Africa,Middle East & North Africa,
+Eritrea,ERI,Eritrea,Eritrea,Erit.,ER,State of Eritrea,Eritrea,,1.984,7. Least developed region,ER,ER,ERI,232,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+United Kingdom,GB1,Dhekelia,Dhekelia,Dhek.,DH,,Dhekelia Soverign Base Area,,-99,2. Developed region: nonG7,-99,-99,-99,-99,Asia,Asia,Western Asia,Europe & Central Asia,
+Spain,ESP,Spain,Spain,Sp.,E,Kingdom of Spain,Spain,,2.001,2. Developed region: nonG7,SP,ES,ESP,724,Europe,Europe,Southern Europe,Europe & Central Asia,countries/COATOFARMS/Spain.png
+Estonia,EST,Estonia,Estonia,Est.,EST,Republic of Estonia,Estonia,,2.000,2. Developed region: nonG7,EN,EE,EST,233,Europe,Europe,Northern Europe,Europe & Central Asia,
+Ethiopia,ETH,Ethiopia,Ethiopia,Eth.,ET,Federal Democratic Republic of Ethiopia,Ethiopia,,2.007,7. Least developed region,ET,ET,ETH,231,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Finland,FI1,Finland,Finland,Fin.,FIN,Republic of Finland,Finland,,2.010,2. Developed region: nonG7,FI,FI,FIN,246,Europe,Europe,Northern Europe,Europe & Central Asia,
+Fiji,FJI,Fiji,Fiji,Fiji,FJ,Republic of Fiji,Fiji,,2.007,6. Developing region,FJ,FJ,FJI,242,Oceania,Oceania,Melanesia,East Asia & Pacific,
+United Kingdom,GB1,Falkland Is.,Falkland Islands,Flk. Is.,FK,Falkland Islands,Falkland Islands,Islas Malvinas,-99,2. Developed region: nonG7,FK,FK,FLK,238,South America,Americas,South America,Latin America & Caribbean,
+France,FR1,France,France,Fr.,F,French Republic,France,,-99,1. Developed region: G7,FR,-99,-99,250,Europe,Europe,Western Europe,Europe & Central Asia,
+Denmark,DN1,Faeroe Is.,Faeroe Islands,Faeroe Is.,FO,FÃ¸royar Is. (Faeroe Is.),Faeroe Islands,,2.011,2. Developed region: nonG7,FO,FO,FRO,234,Europe,Europe,Northern Europe,Europe & Central Asia,
+Federated States of Micronesia,FSM,Micronesia,Federated States of Micronesia,F.S.M.,FSM,Federated States of Micronesia,"Micronesia, Federated States of",,2.000,6. Developing region,FM,FM,FSM,583,Oceania,Oceania,Micronesia,East Asia & Pacific,
+Gabon,GAB,Gabon,Gabon,Gabon,GA,Gabonese Republic,Gabon,,2.003,6. Developing region,GB,GA,GAB,266,Africa,Africa,Middle Africa,Sub-Saharan Africa,
+United Kingdom,GB1,United Kingdom,United Kingdom,U.K.,GB,United Kingdom of Great Britain and Northern Ireland,United Kingdom,,2.011,1. Developed region: G7,UK,GB,GBR,826,Europe,Europe,Northern Europe,Europe & Central Asia,
+Georgia,GEO,Georgia,Georgia,Geo.,GE,Georgia,Georgia,,2.002,6. Developing region,GG,GE,GEO,268,Asia,Asia,Western Asia,Europe & Central Asia,
+United Kingdom,GB1,Guernsey,Guernsey,Guern.,GG,Bailiwick of Guernsey,Guernsey,,2.001,2. Developed region: nonG7,GK,GG,GGY,831,Europe,Europe,Northern Europe,Europe & Central Asia,
+Ghana,GHA,Ghana,Ghana,Ghana,GH,Republic of Ghana,Ghana,,2.010,6. Developing region,GH,GH,GHA,288,Africa,Africa,Western Africa,Sub-Saharan Africa,
+United Kingdom,GB1,Gibraltar,Gibraltar,Gib.,GI,,Gibraltar,,-99,2. Developed region: nonG7,GI,GI,GIB,292,Europe,Europe,Southern Europe,Europe & Central Asia,
+Guinea,GIN,Guinea,Guinea,Gin.,GN,Republic of Guinea,Guinea,,1.996,7. Least developed region,GV,GN,GIN,324,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Gambia,GMB,Gambia,The Gambia,Gambia,GM,Republic of the Gambia,"Gambia, The",,2.003,7. Least developed region,GA,GM,GMB,270,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Guinea Bissau,GNB,Guinea-Bissau,Guinea-Bissau,GnB.,GW,Republic of Guinea-Bissau,Guinea-Bissau,,2.009,7. Least developed region,PU,GW,GNB,624,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Equatorial Guinea,GNQ,Eq. Guinea,Equatorial Guinea,Eq. G.,GQ,Republic of Equatorial Guinea,Equatorial Guinea,,2.002,7. Least developed region,EK,GQ,GNQ,226,Africa,Africa,Middle Africa,Sub-Saharan Africa,
+Greece,GRC,Greece,Greece,Greece,GR,Hellenic Republic,Greece,,2.011,2. Developed region: nonG7,GR,GR,GRC,300,Europe,Europe,Southern Europe,Europe & Central Asia,
+Grenada,GRD,Grenada,Grenada,Gren.,GD,Grenada,Grenada,,2.011,6. Developing region,GJ,GD,GRD,308,North America,Americas,Caribbean,Latin America & Caribbean,
+Denmark,DN1,Greenland,Greenland,Grlnd.,GL,Greenland,Greenland,,2.010,2. Developed region: nonG7,GL,GL,GRL,304,North America,Americas,Northern America,Europe & Central Asia,
+Guatemala,GTM,Guatemala,Guatemala,Guat.,GT,Republic of Guatemala,Guatemala,,2.002,6. Developing region,GT,GT,GTM,320,North America,Americas,Central America,Latin America & Caribbean,
+United States of America,US1,Guam,Guam,Guam,GU,Territory of Guam,Guam,,2.010,6. Developing region,GQ,GU,GUM,316,Oceania,Oceania,Micronesia,East Asia & Pacific,
+Guyana,GUY,Guyana,Guyana,Guy.,GY,Co-operative Republic of Guyana,Guyana,,2.002,6. Developing region,GY,GY,GUY,328,South America,Americas,South America,Latin America & Caribbean,
+China,CH1,Hong Kong,Hong Kong,H.K.,HK,"Hong Kong Special Administrative Region, PRC","Hong Kong SAR, China",,2.006,6. Developing region,HK,HK,HKG,344,Asia,Asia,Eastern Asia,East Asia & Pacific,
+Australia,AU1,Heard I. and McDonald Is.,Heard I. and McDonald Islands,H.M.Is.,HM,Territory of Heard Island and McDonald Islands,Heard Island and McDonald Islands,,-99,7. Least developed region,HM,HM,HMD,334,Seven seas (open ocean),Seven seas (open ocean),Seven seas (open ocean),Sub-Saharan Africa,
+Honduras,HND,Honduras,Honduras,Hond.,HN,Republic of Honduras,Honduras,,2.001,6. Developing region,HO,HN,HND,340,North America,Americas,Central America,Latin America & Caribbean,
+Croatia,HRV,Croatia,Croatia,Cro.,HR,Republic of Croatia,Croatia,,2.011,2. Developed region: nonG7,HR,HR,HRV,191,Europe,Europe,Southern Europe,Europe & Central Asia,
+Haiti,HTI,Haiti,Haiti,Haiti,HT,Republic of Haiti,Haiti,,2.003,7. Least developed region,HA,HT,HTI,332,North America,Americas,Caribbean,Latin America & Caribbean,
+Hungary,HUN,Hungary,Hungary,Hun.,HU,Republic of Hungary,Hungary,,2.001,2. Developed region: nonG7,HU,HU,HUN,348,Europe,Europe,Eastern Europe,Europe & Central Asia,
+Indonesia,IDN,Indonesia,Indonesia,Indo.,INDO,Republic of Indonesia,Indonesia,,2.010,4. Emerging region: MIKT,ID,ID,IDN,360,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+United Kingdom,GB1,Isle of Man,Isle of Man,IoMan,IM,,Isle of Man,,2.006,2. Developed region: nonG7,IM,IM,IMN,833,Europe,Europe,Northern Europe,Europe & Central Asia,
+India,IND,India,India,India,IND,Republic of India,India,,2.011,3. Emerging region: BRIC,IN,IN,IND,356,Asia,Asia,Southern Asia,South Asia,
+Australia,AU1,Indian Ocean Ter.,Indian Ocean Territories,Ind. Oc. Ter.,IOT,,Indian Ocean Territories,,-99,2. Developed region: nonG7,-99,-99,-99,-99,Asia,Seven seas (open ocean),Seven seas (open ocean),East Asia & Pacific,
+United Kingdom,GB1,Br. Indian Ocean Ter.,British Indian Ocean Territory,I.O.T.,IO,,British Indian Ocean Territory,,-99,2. Developed region: nonG7,IO,IO,IOT,086,Seven seas (open ocean),Seven seas (open ocean),Seven seas (open ocean),Sub-Saharan Africa,
+Ireland,IRL,Ireland,Ireland,Ire.,IRL,Ireland,Ireland,,2.011,2. Developed region: nonG7,EI,IE,IRL,372,Europe,Europe,Northern Europe,Europe & Central Asia,
+Iran,IRN,Iran,Iran,Iran,IRN,Islamic Republic of Iran,"Iran, Islamic Rep.",,2.006,5. Emerging region: G20,IR,IR,IRN,364,Asia,Asia,Southern Asia,Middle East & North Africa,
+Iraq,IRQ,Iraq,Iraq,Iraq,IRQ,Republic of Iraq,Iraq,,1.997,6. Developing region,IZ,IQ,IRQ,368,Asia,Asia,Western Asia,Middle East & North Africa,
+Iceland,ISL,Iceland,Iceland,Iceland,IS,Republic of Iceland,Iceland,,-99,2. Developed region: nonG7,IC,IS,ISL,352,Europe,Europe,Northern Europe,Europe & Central Asia,
+Israel,IS1,Israel,Israel,Isr.,IS,State of Israel,Israel,,2.009,2. Developed region: nonG7,-99,IL,ISR,376,Asia,Asia,Western Asia,Middle East & North Africa,
+Italy,ITA,Italy,Italy,Italy,I,Italian Republic,Italy,,2.012,1. Developed region: G7,IT,IT,ITA,380,Europe,Europe,Southern Europe,Europe & Central Asia,
+Jamaica,JAM,Jamaica,Jamaica,Jam.,J,Jamaica,Jamaica,,2.011,6. Developing region,JM,JM,JAM,388,North America,Americas,Caribbean,Latin America & Caribbean,
+United Kingdom,GB1,Jersey,Jersey,Jey.,JE,Bailiwick of Jersey,Jersey,,2.001,2. Developed region: nonG7,JE,JE,JEY,832,Europe,Europe,Northern Europe,Europe & Central Asia,
+Jordan,JOR,Jordan,Jordan,Jord.,J,Hashemite Kingdom of Jordan,Jordan,,2.004,6. Developing region,JO,JO,JOR,400,Asia,Asia,Western Asia,Middle East & North Africa,
+Japan,JPN,Japan,Japan,Japan,J,Japan,Japan,,2.010,1. Developed region: G7,JA,JP,JPN,392,Asia,Asia,Eastern Asia,East Asia & Pacific,
+Kazakhstan,KAZ,Baikonur,Baikonur Cosmodrome,Bayk.,BK,,Baikonur Cosmodrome,Baykonur Cosmodrome,-99,2. Developed region: nonG7,-99,-99,-99,-99,Asia,Asia,Central Asia,Europe & Central Asia,
+Kashmir,KAS,Siachen Glacier,Siachen Glacier,Siachen,SG,,Kashmir,,-99,6. Developing region,-99,-99,-99,-99,Asia,Asia,Southern Asia,South Asia,
+Kazakhstan,KAZ,Kazakhstan,Kazakhstan,Kaz.,KZ,Republic of Kazakhstan,Kazakhstan,,2.009,6. Developing region,KZ,KZ,KAZ,398,Asia,Asia,Central Asia,Europe & Central Asia,
+Kenya,KEN,Kenya,Kenya,Ken.,KE,Republic of Kenya,Kenya,,2.009,5. Emerging region: G20,KE,KE,KEN,404,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Kyrgyzstan,KGZ,Kyrgyzstan,Kyrgyzstan,Kgz.,KG,Kyrgyz Republic,Kyrgyz Republic,,2.009,6. Developing region,KG,KG,KGZ,417,Asia,Asia,Central Asia,Europe & Central Asia,
+Cambodia,KHM,Cambodia,Cambodia,Camb.,KH,Kingdom of Cambodia,Cambodia,,2.008,7. Least developed region,CB,KH,KHM,116,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Kiribati,KIR,Kiribati,Kiribati,Kir.,KI,Republic of Kiribati,Kiribati,,2.005,7. Least developed region,KR,KI,KIR,296,Oceania,Oceania,Micronesia,East Asia & Pacific,
+Saint Kitts and Nevis,KNA,St. Kitts and Nevis,Saint Kitts and Nevis,St.K.N.,KN,Federation of Saint Kitts and Nevis,St. Kitts and Nevis,,2.011,6. Developing region,SC,KN,KNA,659,North America,Americas,Caribbean,Latin America & Caribbean,
+South Korea,KOR,Korea,Republic of Korea,S.K.,KR,Republic of Korea,"Korea, Rep.",,2.010,4. Emerging region: MIKT,KS,KR,KOR,410,Asia,Asia,Eastern Asia,East Asia & Pacific,
+Kosovo,KOS,Kosovo,Kosovo,Kos.,KO,Republic of Kosovo,Kosovo,,1.981,6. Developing region,KV,-99,-99,-99,Europe,Europe,Southern Europe,Europe & Central Asia,
+Kuwait,KWT,Kuwait,Kuwait,Kwt.,KW,State of Kuwait,Kuwait,,2.010,6. Developing region,KU,KW,KWT,414,Asia,Asia,Western Asia,Middle East & North Africa,
+Laos,LAO,Lao PDR,Lao PDR,Laos,LA,Lao People's Democratic Republic,Lao PDR,,2.005,7. Least developed region,LA,LA,LAO,418,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Lebanon,LBN,Lebanon,Lebanon,Leb.,LB,Lebanese Republic,Lebanon,,1.970,6. Developing region,LE,LB,LBN,422,Asia,Asia,Western Asia,Middle East & North Africa,
+Liberia,LBR,Liberia,Liberia,Liberia,LR,Republic of Liberia,Liberia,,2.008,7. Least developed region,LI,LR,LBR,430,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Libya,LBY,Libya,Libya,Libya,LY,Libya,Libya,,2.006,6. Developing region,LY,LY,LBY,434,Africa,Africa,Northern Africa,Middle East & North Africa,
+Saint Lucia,LCA,Saint Lucia,Saint Lucia,S.L.,LC,Saint Lucia,St. Lucia,,2.010,6. Developing region,ST,LC,LCA,662,North America,Americas,Caribbean,Latin America & Caribbean,
+Liechtenstein,LIE,Liechtenstein,Liechtenstein,Liech.,FL,Principality of Liechtenstein,Liechtenstein,,2.010,2. Developed region: nonG7,LS,LI,LIE,438,Europe,Europe,Western Europe,Europe & Central Asia,
+Sri Lanka,LKA,Sri Lanka,Sri Lanka,Sri L.,LK,Democratic Socialist Republic of Sri Lanka,Sri Lanka,,2.001,6. Developing region,CE,LK,LKA,144,Asia,Asia,Southern Asia,South Asia,
+Lesotho,LSO,Lesotho,Lesotho,Les.,LS,Kingdom of Lesotho,Lesotho,,2.006,7. Least developed region,LT,LS,LSO,426,Africa,Africa,Southern Africa,Sub-Saharan Africa,
+Lithuania,LTU,Lithuania,Lithuania,Lith.,LT,Republic of Lithuania,Lithuania,,2.011,2. Developed region: nonG7,LH,LT,LTU,440,Europe,Europe,Northern Europe,Europe & Central Asia,
+Luxembourg,LUX,Luxembourg,Luxembourg,Lux.,L,Grand Duchy of Luxembourg,Luxembourg,,2.011,2. Developed region: nonG7,LU,LU,LUX,442,Europe,Europe,Western Europe,Europe & Central Asia,
+Latvia,LVA,Latvia,Latvia,Lat.,LV,Republic of Latvia,Latvia,,2.011,2. Developed region: nonG7,LG,LV,LVA,428,Europe,Europe,Northern Europe,Europe & Central Asia,
+China,CH1,Macao,Macao,Mac.,MO,"Macao Special Administrative Region, PRC","Macao SAR, China",,2.011,6. Developing region,MC,MO,MAC,446,Asia,Asia,Eastern Asia,East Asia & Pacific,
+France,FR1,St-Martin,Saint-Martin,St. M.,MF,Saint-Martin (French part),St. Martin (French part),,-99,6. Developing region,RN,MF,MAF,663,North America,Americas,Caribbean,Latin America & Caribbean,
+Morocco,MAR,Morocco,Morocco,Mor.,MA,Kingdom of Morocco,Morocco,,2.004,6. Developing region,MO,MA,MAR,504,Africa,Africa,Northern Africa,Middle East & North Africa,countries/COATOFARMS/Morocco.png
+Monaco,MCO,Monaco,Monaco,Mco.,MC,Principality of Monaco,Monaco,,2.008,2. Developed region: nonG7,MN,MC,MCO,492,Europe,Europe,Western Europe,Europe & Central Asia,
+Moldova,MDA,Moldova,Moldova,Mda.,MD,Republic of Moldova,Moldova,,2.004,6. Developing region,MD,MD,MDA,498,Europe,Europe,Eastern Europe,Europe & Central Asia,
+Madagascar,MDG,Madagascar,Madagascar,Mad.,MG,Republic of Madagascar,Madagascar,,1.993,7. Least developed region,MA,MG,MDG,450,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Maldives,MDV,Maldives,Maldives,Mald.,MV,Republic of Maldives,Maldives,,2.011,6. Developing region,MV,MV,MDV,462,Seven seas (open ocean),Asia,Southern Asia,South Asia,
+Mexico,MEX,Mexico,Mexico,Mex.,MX,United Mexican States,Mexico,,2.010,4. Emerging region: MIKT,MX,MX,MEX,484,North America,Americas,Central America,Latin America & Caribbean,countries/COATOFARMS/Mexico.png
+Marshall Islands,MHL,Marshall Is.,Marshall Islands,M. Is.,MH,Republic of the Marshall Islands,Marshall Islands,,2.011,6. Developing region,RM,MH,MHL,584,Oceania,Oceania,Micronesia,East Asia & Pacific,
+Macedonia,MKD,Macedonia,Macedonia,Mkd.,MK,Former Yugoslav Republic of Macedonia,"Macedonia, FYR",,2.010,6. Developing region,MK,MK,MKD,807,Europe,Europe,Southern Europe,Europe & Central Asia,
+Mali,MLI,Mali,Mali,Mali,ML,Republic of Mali,Mali,,2.009,7. Least developed region,ML,ML,MLI,466,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Malta,MLT,Malta,Malta,Malta,M,Republic of Malta,Malta,,2.005,2. Developed region: nonG7,MT,MT,MLT,470,Europe,Europe,Southern Europe,Middle East & North Africa,
+Myanmar,MMR,Myanmar,Myanmar,Myan.,MM,Republic of the Union of Myanmar,Myanmar,,1.983,7. Least developed region,BM,MM,MMR,104,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Montenegro,MNE,Montenegro,Montenegro,Mont.,ME,Montenegro,Montenegro,,2.011,6. Developing region,MJ,ME,MNE,499,Europe,Europe,Southern Europe,Europe & Central Asia,
+Mongolia,MNG,Mongolia,Mongolia,Mong.,MN,Mongolia,Mongolia,,2.010,6. Developing region,MG,MN,MNG,496,Asia,Asia,Eastern Asia,East Asia & Pacific,
+United States of America,US1,N. Mariana Is.,Northern Mariana Islands,N.M.I.,MP,Commonwealth of the Northern Mariana Islands,Northern Mariana Islands,,2.010,6. Developing region,CQ,MP,MNP,580,Oceania,Oceania,Micronesia,East Asia & Pacific,
+Mozambique,MOZ,Mozambique,Mozambique,Moz.,MZ,Republic of Mozambique,Mozambique,,2.007,7. Least developed region,MZ,MZ,MOZ,508,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Mauritania,MRT,Mauritania,Mauritania,Mrt.,MR,Islamic Republic of Mauritania,Mauritania,,2.000,7. Least developed region,MR,MR,MRT,478,Africa,Africa,Western Africa,Sub-Saharan Africa,
+United Kingdom,GB1,Montserrat,Montserrat,Monts.,MS,,Montserrat,,-99,6. Developing region,MH,MS,MSR,500,North America,Americas,Caribbean,Latin America & Caribbean,
+Mauritius,MUS,Mauritius,Mauritius,Mus.,MU,Republic of Mauritius,Mauritius,,2.011,6. Developing region,MP,MU,MUS,480,Seven seas (open ocean),Africa,Eastern Africa,Sub-Saharan Africa,
+Malawi,MWI,Malawi,Malawi,Mal.,MW,Republic of Malawi,Malawi,,2.008,7. Least developed region,MI,MW,MWI,454,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Malaysia,MYS,Malaysia,Malaysia,Malay.,MY,Malaysia,Malaysia,,2.010,6. Developing region,MY,MY,MYS,458,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Namibia,NAM,Namibia,Namibia,Nam.,NA,Republic of Namibia,Namibia,,2.001,6. Developing region,WA,NA,NAM,516,Africa,Africa,Southern Africa,Sub-Saharan Africa,
+France,FR1,New Caledonia,New Caledonia,New C.,NC,New Caledonia,New Caledonia,,2.009,6. Developing region,NC,NC,NCL,540,Oceania,Oceania,Melanesia,East Asia & Pacific,
+Niger,NER,Niger,Niger,Niger,NE,Republic of Niger,Niger,,2.001,7. Least developed region,NG,NE,NER,562,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Australia,AU1,Norfolk Island,Norfolk Island,Nfk. I.,NF,Territory of Norfolk Island,Norfolk Island,,-99,6. Developing region,NF,NF,NFK,574,Oceania,Oceania,Australia and New Zealand,East Asia & Pacific,
+Nigeria,NGA,Nigeria,Nigeria,Nigeria,NG,Federal Republic of Nigeria,Nigeria,,2.006,5. Emerging region: G20,NI,NG,NGA,566,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Nicaragua,NIC,Nicaragua,Nicaragua,Nic.,NI,Republic of Nicaragua,Nicaragua,,2.005,6. Developing region,NU,NI,NIC,558,North America,Americas,Central America,Latin America & Caribbean,
+New Zealand,NZ1,Niue,Niue,Niue,NU,,Niue,,-99,6. Developing region,NE,NU,NIU,570,Oceania,Oceania,Polynesia,East Asia & Pacific,
+Netherlands,NL1,Netherlands,Netherlands,Neth.,NL,Kingdom of the Netherlands,Netherlands,,2.011,2. Developed region: nonG7,NL,NL,NLD,528,Europe,Europe,Western Europe,Europe & Central Asia,
+Norway,NOR,Norway,Norway,Nor.,N,Kingdom of Norway,Norway,,2.001,2. Developed region: nonG7,-99,-99,-99,-99,Europe,Europe,Northern Europe,Europe & Central Asia,
+Nepal,NPL,Nepal,Nepal,Nepal,NP,Nepal,Nepal,,2.001,7. Least developed region,NP,NP,NPL,524,Asia,Asia,Southern Asia,South Asia,
+Nauru,NRU,Nauru,Nauru,Nauru,NR,Republic of Nauru,Nauru,,-99,6. Developing region,NR,NR,NRU,520,Oceania,Oceania,Micronesia,East Asia & Pacific,
+New Zealand,NZ1,New Zealand,New Zealand,N.Z.,NZ,New Zealand,New Zealand,,2.006,2. Developed region: nonG7,NZ,NZ,NZL,554,Oceania,Oceania,Australia and New Zealand,East Asia & Pacific,
+Oman,OMN,Oman,Oman,Oman,OM,Sultanate of Oman,Oman,,2.010,6. Developing region,MU,OM,OMN,512,Asia,Asia,Western Asia,Middle East & North Africa,
+Pakistan,PAK,Pakistan,Pakistan,Pak.,PK,Islamic Republic of Pakistan,Pakistan,,1.998,5. Emerging region: G20,PK,PK,PAK,586,Asia,Asia,Southern Asia,South Asia,
+Panama,PAN,Panama,Panama,Pan.,PA,Republic of Panama,Panama,,2.010,6. Developing region,PM,PA,PAN,591,North America,Americas,Central America,Latin America & Caribbean,
+United Kingdom,GB1,Pitcairn Is.,Pitcairn Islands,Pit. Is.,PN,"Pitcairn, Henderson, Ducie and Oeno Islands",Pitcairn Islands,,-99,7. Least developed region,PC,PN,PCN,612,Oceania,Oceania,Polynesia,East Asia & Pacific,
+Peru,PER,Peru,Peru,Peru,PE,Republic of Peru,Peru,,2.007,5. Emerging region: G20,PE,PE,PER,604,South America,Americas,South America,Latin America & Caribbean,
+Spratly Islands,PGA,Spratly Is.,Spratly Islands,Spratly Is.,SP,,Spratly Islands,,-99,7. Least developed region,PG,-99,-99,-99,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Philippines,PHL,Philippines,Philippines,Phil.,PH,Republic of the Philippines,Philippines,,2.010,5. Emerging region: G20,RP,PH,PHL,608,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Palau,PLW,Palau,Palau,Palau,PW,Republic of Palau,Palau,,2.010,6. Developing region,PS,PW,PLW,585,Oceania,Oceania,Micronesia,East Asia & Pacific,
+Papua New Guinea,PNG,Papua New Guinea,Papua New Guinea,P.N.G.,PG,Independent State of Papua New Guinea,Papua New Guinea,,2.000,6. Developing region,PP,PG,PNG,598,Oceania,Oceania,Melanesia,East Asia & Pacific,
+Poland,POL,Poland,Poland,Pol.,PL,Republic of Poland,Poland,,2.011,2. Developed region: nonG7,PL,PL,POL,616,Europe,Europe,Eastern Europe,Europe & Central Asia,
+United States of America,US1,Puerto Rico,Puerto Rico,P.R.,PR,Commonwealth of Puerto Rico,Puerto Rico,,2.010,6. Developing region,RQ,PR,PRI,630,North America,Americas,Caribbean,Latin America & Caribbean,
+North Korea,PRK,Dem. Rep. Korea,Dem. Rep. Korea,N.K.,KP,Democratic People's Republic of Korea,"Korea, Dem. Rep.",,2.009,7. Least developed region,KN,KP,PRK,408,Asia,Asia,Eastern Asia,East Asia & Pacific,
+Portugal,PRT,Portugal,Portugal,Port.,P,Portuguese Republic,Portugal,,2.011,2. Developed region: nonG7,PO,PT,PRT,620,Europe,Europe,Southern Europe,Europe & Central Asia,
+Paraguay,PRY,Paraguay,Paraguay,Para.,PY,Republic of Paraguay,Paraguay,,2.002,5. Emerging region: G20,PA,PY,PRY,600,South America,Americas,South America,Latin America & Caribbean,
+Israel,IS1,Palestine,Palestine,Pal.,PAL,West Bank and Gaza,Palestine (West Bank and Gaza),,2.007,6. Developing region,-99,PS,PSE,275,Asia,Asia,Western Asia,Middle East & North Africa,
+France,FR1,Fr. Polynesia,French Polynesia,Fr. Poly.,PF,French Polynesia,French Polynesia,,2.007,6. Developing region,FP,PF,PYF,258,Oceania,Oceania,Polynesia,East Asia & Pacific,
+Qatar,QAT,Qatar,Qatar,Qatar,QA,State of Qatar,Qatar,,2.010,6. Developing region,QA,QA,QAT,634,Asia,Asia,Western Asia,Middle East & North Africa,
+Romania,ROU,Romania,Romania,Rom.,RO,Romania,Romania,,2.011,2. Developed region: nonG7,RO,RO,ROU,642,Europe,Europe,Eastern Europe,Europe & Central Asia,
+Russia,RUS,Russia,Russian Federation,Rus.,RUS,Russian Federation,Russian Federation,,2.010,3. Emerging region: BRIC,RS,RU,RUS,643,Europe,Europe,Eastern Europe,Europe & Central Asia,countries/COATOFARMS/Russian_Federation.png
+Rwanda,RWA,Rwanda,Rwanda,Rwa.,RW,Republic of Rwanda,Rwanda,,2.002,7. Least developed region,RW,RW,RWA,646,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Western Sahara,SAH,W. Sahara,Western Sahara,W. Sah.,WS,Sahrawi Arab Democratic Republic,Western Sahara,,-99,7. Least developed region,WI,EH,ESH,732,Africa,Africa,Northern Africa,Middle East & North Africa,
+Saudi Arabia,SAU,Saudi Arabia,Saudi Arabia,Saud.,SA,Kingdom of Saudi Arabia,Saudi Arabia,,2.010,2. Developed region: nonG7,SA,SA,SAU,682,Asia,Asia,Western Asia,Middle East & North Africa,
+Scarborough Reef,SCR,Scarborough Reef,Scarborough Reef,S.R.,SR,,,,-99,7. Least developed region,-99,-99,-99,-99,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Sudan,SDN,Sudan,Sudan,Sudan,SD,Republic of the Sudan,Sudan,,2.008,6. Developing region,SU,SD,SDN,729,Africa,Africa,Northern Africa,Sub-Saharan Africa,
+South Sudan,SDS,S. Sudan,South Sudan,S. Sud.,SS,Republic of South Sudan,South Sudan,,2.008,7. Least developed region,-99,SS,SSD,728,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Senegal,SEN,Senegal,Senegal,Sen.,SN,Republic of Senegal,Senegal,,2.002,7. Least developed region,SG,SN,SEN,686,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Serranilla Bank,SER,Serranilla Bank,Serranilla Bank,S.B.,SB,,Serranilla Bank,,-99,7. Least developed region,-99,-99,-99,-99,North America,Americas,Caribbean,Latin America & Caribbean,
+Singapore,SGP,Singapore,Singapore,Sing.,SG,Republic of Singapore,Singapore,,2.010,6. Developing region,SN,SG,SGP,702,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+United Kingdom,GB1,S. Geo. and S. Sandw. Is.,South Georgia and South Sandwich Islands,S.G. S.S. Is.,GS,South Georgia and South Sandwich Islands,South Georgia and the Islands,,-99,7. Least developed region,SX,GS,SGS,239,Seven seas (open ocean),Seven seas (open ocean),Seven seas (open ocean),Antarctica,
+United Kingdom,GB1,Saint Helena,Saint Helena,St.H.,SH,,St. Helena,,-99,6. Developing region,SH,SH,SHN,654,Seven seas (open ocean),Africa,Western Africa,Sub-Saharan Africa,
+Solomon Islands,SLB,Solomon Is.,Solomon Islands,S. Is.,SB,,Solomon Islands,,2.009,7. Least developed region,BP,SB,SLB,090,Oceania,Oceania,Melanesia,East Asia & Pacific,
+Sierra Leone,SLE,Sierra Leone,Sierra Leone,S.L.,SL,Republic of Sierra Leone,Sierra Leone,,2.004,7. Least developed region,SL,SL,SLE,694,Africa,Africa,Western Africa,Sub-Saharan Africa,
+El Salvador,SLV,El Salvador,El Salvador,El. S.,SV,Republic of El Salvador,El Salvador,,2.007,6. Developing region,ES,SV,SLV,222,North America,Americas,Central America,Latin America & Caribbean,
+San Marino,SMR,San Marino,San Marino,S.M.,RSM,Republic of San Marino,San Marino,,2.010,2. Developed region: nonG7,SM,SM,SMR,674,Europe,Europe,Southern Europe,Europe & Central Asia,
+Somaliland,SOL,Somaliland,Somaliland,Solnd.,SL,Republic of Somaliland,Somaliland,,-99,6. Developing region,-99,-99,-99,-99,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Somalia,SOM,Somalia,Somalia,Som.,SO,Federal Republic of Somalia,Somalia,,1.987,7. Least developed region,SO,SO,SOM,706,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+France,FR1,St. Pierre and Miquelon,Saint Pierre and Miquelon,St. P.M.,PM,Saint Pierre and Miquelon,St. Pierre and Miquelon,,-99,2. Developed region: nonG7,SB,PM,SPM,666,North America,Americas,Northern America,North America,
+Republic of Serbia,SRB,Serbia,Serbia,Serb.,RS,Republic of Serbia,Serbia,,2.011,6. Developing region,RI,RS,SRB,688,Europe,Europe,Southern Europe,Europe & Central Asia,
+Sao Tome and Principe,STP,SÃ£o TomÃ© and Principe,SÃ£o TomÃ© and Principe,S.T.P.,ST,Democratic Republic of SÃ£o TomÃ© and Principe,SÃ£o TomÃ© and Principe,,2.001,7. Least developed region,TP,ST,STP,678,Africa,Africa,Middle Africa,Sub-Saharan Africa,
+Suriname,SUR,Suriname,Suriname,Sur.,SR,Republic of Suriname,Suriname,,2.004,6. Developing region,NS,SR,SUR,740,South America,Americas,South America,Latin America & Caribbean,
+Slovakia,SVK,Slovakia,Slovakia,Svk.,SK,Slovak Republic,Slovak Republic,,2.011,2. Developed region: nonG7,LO,SK,SVK,703,Europe,Europe,Eastern Europe,Europe & Central Asia,
+Slovenia,SVN,Slovenia,Slovenia,Slo.,SLO,Republic of Slovenia,Slovenia,,2.011,2. Developed region: nonG7,SI,SI,SVN,705,Europe,Europe,Southern Europe,Europe & Central Asia,
+Sweden,SWE,Sweden,Sweden,Swe.,S,Kingdom of Sweden,Sweden,,-99,2. Developed region: nonG7,SW,SE,SWE,752,Europe,Europe,Northern Europe,Europe & Central Asia,
+Swaziland,SWZ,Swaziland,Swaziland,Swz.,SW,Kingdom of Swaziland,Swaziland,,2.007,6. Developing region,WZ,SZ,SWZ,748,Africa,Africa,Southern Africa,Sub-Saharan Africa,
+Netherlands,NL1,Sint Maarten,Sint Maarten,St. M.,SX,Sint Maarten (Dutch part),St. Maarten (Dutch part),,-99,6. Developing region,NT,SX,SXM,534,North America,Americas,Caribbean,Latin America & Caribbean,
+Seychelles,SYC,Seychelles,Seychelles,Syc.,SC,Republic of Seychelles,Seychelles,,2.010,6. Developing region,SE,SC,SYC,690,Seven seas (open ocean),Africa,Eastern Africa,Sub-Saharan Africa,
+Syria,SYR,Syria,Syria,Syria,SYR,Syrian Arab Republic,Syrian Arab Republic,,2.004,6. Developing region,SY,SY,SYR,760,Asia,Asia,Western Asia,Middle East & North Africa,
+United Kingdom,GB1,Turks and Caicos Is.,Turks and Caicos Islands,T.C. Is.,TC,Turks and Caicos Islands,Turks and Caicos Islands,,2.001,6. Developing region,TK,TC,TCA,796,North America,Americas,Caribbean,Latin America & Caribbean,
+Chad,TCD,Chad,Chad,Chad,TD,Republic of Chad,Chad,,2.009,7. Least developed region,CD,TD,TCD,148,Africa,Africa,Middle Africa,Sub-Saharan Africa,
+Togo,TGO,Togo,Togo,Togo,TG,Togolese Republic,Togo,,2.010,7. Least developed region,TO,TG,TGO,768,Africa,Africa,Western Africa,Sub-Saharan Africa,
+Thailand,THA,Thailand,Thailand,Thai.,TH,Kingdom of Thailand,Thailand,,2.010,5. Emerging region: G20,TH,TH,THA,764,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Tajikistan,TJK,Tajikistan,Tajikistan,Tjk.,TJ,Republic of Tajikistan,Tajikistan,,2.010,6. Developing region,TI,TJ,TJK,762,Asia,Asia,Central Asia,Europe & Central Asia,
+Turkmenistan,TKM,Turkmenistan,Turkmenistan,Turkm.,TM,Turkmenistan,Turkmenistan,,1.995,6. Developing region,TX,TM,TKM,795,Asia,Asia,Central Asia,Europe & Central Asia,
+East Timor,TLS,Timor-Leste,Timor-Leste,T.L.,TL,Democratic Republic of Timor-Leste,Timor-Leste,East Timor,2.010,7. Least developed region,TT,TL,TLS,626,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Tonga,TON,Tonga,Tonga,Tongo,TO,Kingdom of Tonga,Tonga,,2.006,6. Developing region,TN,TO,TON,776,Oceania,Oceania,Polynesia,East Asia & Pacific,
+Trinidad and Tobago,TTO,Trinidad and Tobago,Trinidad and Tobago,Tr.T.,TT,Republic of Trinidad and Tobago,Trinidad and Tobago,,2.011,6. Developing region,TD,TT,TTO,780,North America,Americas,Caribbean,Latin America & Caribbean,
+Tunisia,TUN,Tunisia,Tunisia,Tun.,TN,Republic of Tunisia,Tunisia,,2.004,6. Developing region,TS,TN,TUN,788,Africa,Africa,Northern Africa,Middle East & North Africa,
+Turkey,TUR,Turkey,Turkey,Tur.,TR,Republic of Turkey,Turkey,,2.000,4. Emerging region: MIKT,TU,TR,TUR,792,Asia,Asia,Western Asia,Europe & Central Asia,countries/COATOFARMS/Turkey.png
+Tuvalu,TUV,Tuvalu,Tuvalu,Tuv.,TV,Tuvalu,Tuvalu,,2.002,7. Least developed region,TV,TV,TUV,798,Oceania,Oceania,Polynesia,East Asia & Pacific,
+Taiwan,TWN,Taiwan,Taiwan,Taiwan,TW,,Taiwan,,-99,2. Developed region: nonG7,TW,TW,TWN,158,Asia,Asia,Eastern Asia,East Asia & Pacific,
+United Republic of Tanzania,TZA,Tanzania,Tanzania,Tanz.,TZ,United Republic of Tanzania,Tanzania,,2.002,7. Least developed region,TZ,TZ,TZA,834,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Uganda,UGA,Uganda,Uganda,Uga.,UG,Republic of Uganda,Uganda,,2.002,7. Least developed region,UG,UG,UGA,800,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Ukraine,UKR,Ukraine,Ukraine,Ukr.,UA,Ukraine,Ukraine,,2.001,6. Developing region,UP,UA,UKR,804,Europe,Europe,Eastern Europe,Europe & Central Asia,
+United States of America,US1,U.S. Minor Outlying Is.,United States Minor Outlying Islands,U.S. MOI,UM,,United States Minor Outlying Islands,,-99,7. Least developed region,-99,UM,UMI,581,North America,Seven seas (open ocean),Seven seas (open ocean),East Asia & Pacific,
+Uruguay,URY,Uruguay,Uruguay,Ury.,UY,Oriental Republic of Uruguay,Uruguay,,2.004,5. Emerging region: G20,UY,UY,URY,858,South America,Americas,South America,Latin America & Caribbean,
+United States of America,US1,United States,United States,U.S.A.,US,United States of America,United States of America,,2.010,1. Developed region: G7,US,US,USA,840,North America,Americas,Northern America,North America,countries/COATOFARMS/UUSS.png
+Cuba,CUB,USNB Guantanamo Bay,US Naval Base Guantanamo Bay,Guantan.,GB,,Guantanamo Bay USNB,"Gitmo, GTMO",-99,2. Developed region: nonG7,-99,-99,-99,-99,North America,Americas,Caribbean,Latin America & Caribbean,
+Uzbekistan,UZB,Uzbekistan,Uzbekistan,Uzb.,UZ,Republic of Uzbekistan,Uzbekistan,,1.989,6. Developing region,UZ,UZ,UZB,860,Asia,Asia,Central Asia,Europe & Central Asia,
+Vatican,VAT,Vatican,Vatican,Vat.,V,State of the Vatican City,Vatican (Holy Sea),Holy Sea,-99,2. Developed region: nonG7,VT,VA,VAT,336,Europe,Europe,Southern Europe,Europe & Central Asia,
+Saint Vincent and the Grenadines,VCT,St. Vin. and Gren.,Saint Vincent and the Grenadines,St.V.G.,VC,Saint Vincent and the Grenadines,St. Vincent and the Grenadines,,2.011,6. Developing region,VC,VC,VCT,670,North America,Americas,Caribbean,Latin America & Caribbean,
+Venezuela,VEN,Venezuela,Venezuela,Ven.,VE,Bolivarian Republic of Venezuela,"Venezuela, RB",,2.001,5. Emerging region: G20,VE,VE,VEN,862,South America,Americas,South America,Latin America & Caribbean,
+United Kingdom,GB1,British Virgin Is.,British Virgin Islands,V.I. (Br.),VG,British Virgin Islands,British Virgin Islands,,-99,2. Developed region: nonG7,VI,VG,VGB,092,North America,Americas,Caribbean,Latin America & Caribbean,
+United States of America,US1,U.S. Virgin Is.,United States Virgin Islands,V.I. (U.S.),VI,Virgin Islands of the United States,Virgin Islands (U.S.),,2.010,6. Developing region,VQ,VI,VIR,850,North America,Americas,Caribbean,Latin America & Caribbean,
+Vietnam,VNM,Vietnam,Vietnam,Viet.,VN,Socialist Republic of Vietnam,Vietnam,,2.009,5. Emerging region: G20,VM,VN,VNM,704,Asia,Asia,South-Eastern Asia,East Asia & Pacific,
+Vanuatu,VUT,Vanuatu,Vanuatu,Van.,VU,Republic of Vanuatu,Vanuatu,,2.009,7. Least developed region,NH,VU,VUT,548,Oceania,Oceania,Melanesia,East Asia & Pacific,
+France,FR1,Wallis and Futuna Is.,Wallis and Futuna Islands,Wlf.,WF,Wallis and Futuna Islands,Wallis and Futuna,,-99,6. Developing region,WF,WF,WLF,876,Oceania,Oceania,Polynesia,East Asia & Pacific,
+United Kingdom,GB1,Akrotiri,Akrotiri,Akr.,AK,,Akrotiri Sovereign Base Area,,-99,2. Developed region: nonG7,-99,-99,-99,-99,Asia,Asia,Western Asia,Europe & Central Asia,
+Samoa,WSM,Samoa,Samoa,Samoa,WS,Independent State of Samoa,Samoa,,2.006,7. Least developed region,WS,WS,WSM,882,Oceania,Oceania,Polynesia,East Asia & Pacific,
+Yemen,YEM,Yemen,Yemen,Yem.,YE,Republic of Yemen,"Yemen, Rep.",,2.004,7. Least developed region,YM,YE,YEM,887,Asia,Asia,Western Asia,Middle East & North Africa,
+South Africa,ZAF,South Africa,South Africa,S.Af.,ZA,Republic of South Africa,South Africa,,2.001,5. Emerging region: G20,SF,ZA,ZAF,710,Africa,Africa,Southern Africa,Sub-Saharan Africa,
+Zambia,ZMB,Zambia,Zambia,Zambia,ZM,Republic of Zambia,Zambia,,2.010,7. Least developed region,ZA,ZM,ZMB,894,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
+Zimbabwe,ZWE,Zimbabwe,Zimbabwe,Zimb.,ZW,Republic of Zimbabwe,Zimbabwe,,2.002,5. Emerging region: G20,ZI,ZW,ZWE,716,Africa,Africa,Eastern Africa,Sub-Saharan Africa,
\ No newline at end of file
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/resources/org/gvsig/fmap/dal/store/csv/continents.csv
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/resources/org/gvsig/fmap/dal/store/csv/continents.csv	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/resources/org/gvsig/fmap/dal/store/csv/continents.csv	(revision 44738)
@@ -0,0 +1,9 @@
+"ID__Long","NAME__String__100"
+"1","Africa"
+"2","Asia"
+"3","Europe"
+"4","North America"
+"5","South America"
+"6","Oceania"
+"7","Seven seas (open ocean)"
+"8","Antarctica"
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/resources/org/gvsig/fmap/dal/store/csv/testCreateSource1.csv
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/resources/org/gvsig/fmap/dal/store/csv/testCreateSource1.csv	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/test/resources/org/gvsig/fmap/dal/store/csv/testCreateSource1.csv	(revision 44738)
@@ -0,0 +1,20 @@
+ID/Integer;Byte/Byte;Bool1/Boolean;Long/Long;Timestamp/TimeStamp;Date/Date;Time/Time;Bool2/Boolean;String/String/set/size=30;Bool3/Boolean;Double/Double;Bool4/Boolean;Float/Float;Bool5/Boolean;Geometry/Geometry/set/geomtype=Point:2D/set/srs=EPSG:4326
+1;10;T;1000;20191229121314;20191229;121314;T;Yo yo1;F;12345.54321;T;123.21;T;"POINT (-3.8945156972987958 42.01053743584765)"
+2;20;T;2000;20191129121314;20191129;131314;T;Yo yo2;F;12100.54321;T;100.21;T;"POINT (-2.1079618220646115 41.983079082675474)"
+3;30;T;3000;20191029121314;20191029;141314;T;Yo yo3;F;12101.54321;T;101.21;T;"POINT (-2.57249737803327 41.35372113353277)"
+4;40;T;4000;20190929121314;20190929;151314;T;Yo yo4;F;12102.54321;T;102.21;T;"POINT (-4.061822048036304 41.35877680235475)"
+5;50;T;5000;20190829121314;20190829;161314;T;Yo yo5;F;12103.54321;T;103.21;T;"POINT (-3.974317066986988 40.78701209315094)"
+6;60;T;6000;20190729121314;20190729;171314;T;Yo yo6;F;12104.54321;T;104.21;T;"POINT (-2.510509736717547 40.69847453392384)"
+7;70;T;7000;20190629121314;20190629;181314;T;Yo yo7;F;12105.54321;T;105.21;T;"POINT (-0.5317736981843011 40.66396082637622)"
+8;80;T;8000;20190529121314;20190529;191314;T;Yo yo8;F;12106.54321;T;106.21;T;"POINT (-0.3626917259170671 41.13652386601604)"
+9;90;T;9000;20190429121314;20190429;201314;T;Yo yo9;F;12107.54321;T;107.21;T;"POINT (-1.2461823078608523 41.84950010180092)"
+10;;T;1001;20191229121314;20191229;121314;T;Yo yo1;F;12345.54321;T;123.21;T;"POINT (-1.2145405488596532 41.22158511004416)"
+11;22; ;2002;20191129121314;20191129;131314;T;Yo yo2;F;12100.54321;T;100.21;T;"POINT (-0.7699089544899235 41.630581204431756)"
+12;33;T; ;20190929121314;20191029;141314;T;Yo yo3;F;12101.54321;T;101.21;T;"POINT (0.4821915816701051 41.75970939133133)"
+12;41;T;4001; ;20190929;151314;T;Yo yo4;F;12102.54321;T;102.21;T;"POINT (0.7912661147227479 41.919324620992036)"
+14;52;T;5002;20190829121314; ;161314;T;Yo yo5;F;12103.54321;T;103.21;T;"POINT (1.052534629531243 41.493736996249545)"
+15;63;T;6003;20190729121314;20190729; ;T;Yo yo6;F;12104.54321;T;104.21;T;"POINT (0.8097002367335026 41.0899480235613)"
+16;74;T;7004;20190629121314;20190629;181314;T; ;F;12105.54321;T;105.21;T;"POINT (-0.4883960310112362 41.17597288081971)"
+17;85;T;8005;20190529121314;20190529;191314;T;Yo yo8;F; ;T;106.21;T;"POINT (-0.6439030698437881 40.89530766155764)"
+18;96;T;9006;20190429121314;20190429;201314;T;Yo yo9;F;12107.54321;T; ;T;"POINT (-1.3061826868199504 40.72372835570524)"
+19;97;T;1001;20191229121314;20191229;121314;T;Yo yo1;F;12345.54321;T;123.21;T;"POINT (-1.4673843010413785 40.51985891271157)"
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVStoreProvider.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVStoreProvider.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVStoreProvider.java	(revision 44738)
@@ -577,6 +577,14 @@
                             break;
                         }
                     default:
+                        if( StringUtils.isNumeric(option) && this.size == 0 ) {
+                          try {
+                              this.size = Integer.parseInt(option);
+                          } catch (Exception ex) {
+                              LOGGER.warn("Ignore incorrect field size for field " + value + " in '"+getProviderName()+"' file '" + getFullFileName() + "'.", ex);
+                          }
+                          break;
+                        }
                         LOGGER.warn("Illegal argumente '"+option+"' for field '"+this.name+"' in '"+getProviderName()+"' file '" + getFullFileName() + "' ("+value+").");
                 }
             }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/ForeingValueFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/ForeingValueFunction.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/ForeingValueFunction.java	(revision 44738)
@@ -0,0 +1,113 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.function.dataaccess;
+
+import java.util.Arrays;
+import java.util.List;
+import org.apache.commons.lang3.Range;
+import org.apache.commons.lang3.StringUtils;
+import org.gvsig.expressionevaluator.ExpressionBuilder;
+import org.gvsig.expressionevaluator.ExpressionRuntimeException;
+import org.gvsig.expressionevaluator.ExpressionUtils;
+import org.gvsig.expressionevaluator.Interpreter;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.spi.AbstractFunction;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.ForeingKey;
+import org.gvsig.tools.util.UnmodifiableBasicList;
+import org.gvsig.tools.util.UnmodifiableBasicListAdapter;
+
+public class ForeingValueFunction extends AbstractFunction {
+
+  public ForeingValueFunction() {
+    super(
+            DALFunctions.GROUP_DATA_ACCESS, 
+            DALFunctions.FUNCTION_FOREING_VALUE, 
+            Range.is(1), 
+            "Return the value of a field throw a relation from other tables.", 
+            DALFunctions.FUNCTION_FOREING_VALUE + "({{field_name}})", 
+            new String[]{
+              "fieldName - dot separated field path or list of strings with field names."
+            }, 
+            "OBJECT"
+    );
+  }
+
+  private Feature current_row(Interpreter interpreter) {
+    try {
+      Feature f = (Feature) interpreter.call(DALFunctions.FUNCTION_CURRENT_ROW);
+      return f;
+    } catch (Exception ex) {
+      return null;
+    }
+  }
+  
+  @Override
+  public Object call(Interpreter interpreter, Object[] args) throws Exception {
+    ExpressionBuilder builder = ExpressionUtils.createExpressionBuilder();
+    UnmodifiableBasicList<String> fieldNames;
+    Object fields_o = getObject(args, 0);
+    if (fields_o instanceof List) {
+      fieldNames = new UnmodifiableBasicListAdapter<>((List<String>) fields_o);
+    } else if (fields_o instanceof String) {
+      fieldNames = new UnmodifiableBasicListAdapter<>(Arrays.asList(((String) fields_o).split("[.]")));
+    } else if (fields_o instanceof UnmodifiableBasicList) {
+      fieldNames = (UnmodifiableBasicList<String>) fields_o;
+    } else {
+      throw new ExpressionRuntimeException("Problems calling '" + DataManager.FUNCTION_FOREING_VALUE + "' function, type of parameter '" + fields_o.getClass().getSimpleName() + "' not supported, use string or list.");
+    }
+    Feature feature = this.current_row(interpreter);
+    Feature currentFeature = feature;
+    try {
+      String fieldName;
+      Object value;
+      value = feature.getExtraValue(StringUtils.join(fieldNames, "."));
+      if (value != null) {
+        return value;
+      }
+      for (int i = 0; i < fieldNames.size() - 1; i++) {
+        fieldName = fieldNames.get(i);
+        value = currentFeature.get(fieldName);
+        FeatureAttributeDescriptor attrdesc = currentFeature.getType().getAttributeDescriptor(fieldName);
+        ForeingKey foreingKey = attrdesc.getForeingKey();
+        // ContextForeingKey context = foreingKey.createContext();
+        currentFeature = foreingKey.getFeature(null, value);
+        // DisposeUtils.disposeQuietly(context);
+        if (currentFeature == null) {
+          return null;
+        }
+      }
+      fieldName = fieldNames.get(fieldNames.size() - 1);
+      value = currentFeature.get(fieldName);
+      return value;
+    } catch (ExpressionRuntimeException ex) {
+      throw ex;
+    } catch (Exception ex) {
+      throw new ExpressionRuntimeException("Problems calling '" + DataManager.FUNCTION_FOREING_VALUE + "' function", ex);
+    }
+  }
+  
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/SelectCountFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/SelectCountFunction.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/SelectCountFunction.java	(revision 44738)
@@ -0,0 +1,130 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.function.dataaccess;
+
+import java.util.Objects;
+import org.apache.commons.lang3.Range;
+import org.gvsig.expressionevaluator.Codes;
+import org.gvsig.expressionevaluator.ExpressionRuntimeException;
+import org.gvsig.expressionevaluator.Interpreter;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.spi.AbstractFunction;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.tools.dispose.DisposeUtils;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+@SuppressWarnings("UseSpecificCatch")
+public class SelectCountFunction extends AbstractFunction {
+
+  public SelectCountFunction() {
+    super(DALFunctions.GROUP_DATA_ACCESS,
+            DALFunctions.FUNCTION_SELECT_COUNT,
+            Range.between(1,4),
+            "Returns the number of features of the indicated table by applying the filter indicated.",
+            DALFunctions.FUNCTION_SELECT_COUNT + "({{table_name}},filter)",
+            new String[]{
+              "table_name - Name of the table",
+              "filter - filter to apply",
+            },
+            "Long",
+            true
+    );
+  }
+
+  @Override
+  public boolean isHidden() {
+    return true;
+  }
+
+  @Override
+  public boolean allowConstantFolding() {
+    return false;
+  }
+
+  @Override
+  public boolean allowArgNames() {
+    return true;
+  }
+
+  @Override
+  public boolean useArgumentsInsteadObjects() {
+    return true;
+  }
+
+  @Override
+  public Object call(Interpreter interpreter, Object[] args) throws Exception {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public Object call(Interpreter interpreter, Codes args) throws Exception {
+
+    String storeName =  (String) getObject(interpreter, args, "TABLE");
+    String where = Objects.toString(args.get("WHERE"),null);
+    
+    FeatureStore featureStore = null;
+    FeatureSet set = null;
+    try {
+      DataStore store = this.getStore(storeName);
+      if (store == null ) {
+        throw new ExpressionRuntimeException("Cant locate the store '" + storeName + "' in function '" + DALFunctions.FUNCTION_SELECT + "'.");
+      }
+      if (!(store instanceof FeatureStore)) {
+        throw new ExpressionRuntimeException("The store'" + storeName + "' is not valid for function '" + DALFunctions.FUNCTION_SELECT + "', a FeatureStore is required.");
+      }
+      featureStore = (FeatureStore) store;
+      if (where == null ) {
+        set = featureStore.getFeatureSet();
+      } else {
+        FeatureQuery query = featureStore.createFeatureQuery();
+        query.addFilter(where);
+        query.retrievesAllAttributes();
+        set = featureStore.getFeatureSet(query);
+      }
+      return set.getSize();
+    } catch (ExpressionRuntimeException ex) {
+      throw ex;
+    } catch (Exception ex) {
+      throw new ExpressionRuntimeException("Problems calling '" + DALFunctions.FUNCTION_SELECT + "' function", ex);
+    } finally {
+      DisposeUtils.disposeQuietly(set);
+      DisposeUtils.disposeQuietly(featureStore);
+    }
+  }
+
+  protected DataStore getStore(String storeName) {
+    DataManager dataManager = DALLocator.getDataManager();
+    DataStore store = dataManager.getStoresRepository().getStore(storeName);
+    return store;
+  }
+
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/CurrentRowFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/CurrentRowFunction.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/CurrentRowFunction.java	(revision 44738)
@@ -0,0 +1,60 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.function.dataaccess;
+
+import org.apache.commons.lang3.Range;
+import org.gvsig.expressionevaluator.Interpreter;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.spi.AbstractFunction;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public class CurrentRowFunction extends AbstractFunction {
+
+  public CurrentRowFunction() {
+    super(
+            DALFunctions.GROUP_DATA_ACCESS,
+            DALFunctions.FUNCTION_CURRENT_ROW,
+            Range.is(0),
+            "Return the current row when used in a table filter.\n"
+            + "Return null if used outer a table filter.",
+            DALFunctions.FUNCTION_CURRENT_ROW + "()",
+            null,
+            "Feature"
+    );
+  }
+
+  @Override
+  public boolean allowConstantFolding() {
+    return false;
+  }
+
+  @Override
+  public Object call(Interpreter interpreter, Object[] args) throws Exception {
+    return null;
+  }
+
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/CurrentStoreFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/CurrentStoreFunction.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/CurrentStoreFunction.java	(revision 44738)
@@ -0,0 +1,70 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.function.dataaccess;
+
+import org.apache.commons.lang3.Range;
+import org.gvsig.expressionevaluator.Interpreter;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.spi.AbstractFunction;
+import org.gvsig.fmap.dal.feature.Feature;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public class CurrentStoreFunction extends AbstractFunction {
+
+  public CurrentStoreFunction() {
+    super(
+            DALFunctions.GROUP_DATA_ACCESS, 
+            DALFunctions.FUNCTION_CURRENT_STORE, 
+            Range.is(0), 
+            "Return the current store when used in a table filter.\n" 
+                    + "Return null if used outer a table filter.", 
+            DALFunctions.FUNCTION_CURRENT_STORE+"()", 
+            null, 
+            "FeatureStore",
+            false
+    );
+  }
+
+  private Feature current_row(Interpreter interpreter) {
+    try {
+      Feature f = (Feature) interpreter.call(DALFunctions.FUNCTION_CURRENT_ROW);
+      return f;
+    } catch (Exception ex) {
+      return null;
+    }
+  }
+
+  @Override
+  public Object call(Interpreter interpreter, Object[] args) throws Exception {
+    Feature feature = this.current_row(interpreter);
+    if (feature == null) {
+      return null;
+    }
+    return feature.getStore();
+  }
+
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/ExistsFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/ExistsFunction.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/ExistsFunction.java	(revision 44738)
@@ -0,0 +1,116 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.function.dataaccess;
+
+import java.util.List;
+import org.apache.commons.lang3.Range;
+import org.gvsig.expressionevaluator.Codes;
+import org.gvsig.expressionevaluator.ExpressionRuntimeException;
+import org.gvsig.expressionevaluator.Interpreter;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.spi.AbstractFunction;
+import org.gvsig.tools.util.UnmodifiableBasicCollection;
+import org.gvsig.tools.util.UnmodifiableBasicCollection64;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public class ExistsFunction extends AbstractFunction {
+
+  public static final String NAME = "EXISTS";
+
+  public ExistsFunction() {
+    //
+    // https://www.postgresql.org/docs/current/functions-subquery.html
+    //
+    // Nota:
+    // En H2 no existe la funcion EXISTS, pero muy probablemente se pueda
+    // trasladar a:
+    //   NVL2(COALESCE(lista-subselect),FALSE,TRUE)
+    //
+    super(DALFunctions.SYMBOLTABLE_NAME,
+            DALFunctions.FUNCTION_EXISTS,
+            Range.between(1, 2),
+            "Receive a list as an argument. Returns true if the list has some value and false if the list is empty.",
+            DALFunctions.FUNCTION_EXISTS + "({{list}})",
+            new String[]{
+              "list - a list of values or null"
+            },
+            "Boolean",
+            true
+    );
+  }
+
+  @Override
+  public boolean allowConstantFolding() {
+    return false;
+  }
+
+  @Override
+  public boolean useArgumentsInsteadObjects() {
+    return true;
+  }
+
+  @Override
+  public Object call(Interpreter interpreter, Object[] args) throws Exception {
+    throw new UnsupportedOperationException("Not supported yet.");
+  }
+
+  @Override
+  public Object call(Interpreter interpreter, Codes args) throws Exception {
+    if (args.size() == 2) {
+      Object id = this.getObject(interpreter, args, 1);
+      if (id instanceof CharSequence) {
+        if (interpreter.getSymbolTable().exists(id.toString())) {
+          Object value = interpreter.getSymbolTable().value(id.toString());
+          if (value == null) {
+            return false;
+          }
+          if (value instanceof Boolean) {
+            return value;
+          }
+        }
+      }
+    }
+
+    Object list = this.getObject(interpreter, args, 0);
+    if (list == null) {
+      return false;
+    }
+    boolean isEmpty = true;
+    if (list instanceof List) {
+      isEmpty = ((List) list).isEmpty();
+    } else if (list instanceof UnmodifiableBasicCollection) {
+      isEmpty = ((UnmodifiableBasicCollection) list).isEmpty();
+    } else if (list instanceof UnmodifiableBasicCollection64) {
+      isEmpty = ((UnmodifiableBasicCollection64) list).isEmpty();
+    } else {
+      throw new ExpressionRuntimeException("Invalid argument. List or null expected.");
+    }
+//    System.out.println("EXISTS: "+ interpreter.getSymbolTable().value("NAME")+", "+isEmpty);
+    return !isEmpty;
+  }
+
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/IsSelectedCurrentRowFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/IsSelectedCurrentRowFunction.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/IsSelectedCurrentRowFunction.java	(revision 44738)
@@ -0,0 +1,74 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.function.dataaccess;
+
+import org.apache.commons.lang3.Range;
+import org.gvsig.expressionevaluator.Interpreter;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.spi.AbstractFunction;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public class IsSelectedCurrentRowFunction extends AbstractFunction {
+  
+  public IsSelectedCurrentRowFunction() {
+    super(
+            DALFunctions.GROUP_DATA_ACCESS, 
+            DALFunctions.FUNCTION_ISSELECTED_CURRENT_ROW, 
+            Range.is(0), 
+            "Return if the current feature is selected in the store when used in a filter.\n" 
+                    + "Return false if used outer a filter.", 
+            DALFunctions.FUNCTION_ISSELECTED_CURRENT_ROW+"()", 
+            null, 
+            "Boolean",
+            false
+    );
+  }
+
+  private Feature current_row(Interpreter interpreter) {
+    try {
+      Feature f = (Feature) interpreter.call(DALFunctions.FUNCTION_CURRENT_ROW);
+      return f;
+    } catch (Exception ex) {
+      return null;
+    }
+  }
+
+  @Override
+  public Object call(Interpreter interpreter, Object[] args) throws Exception {
+    Feature feature = current_row(interpreter);
+    if (feature == null) {
+      return false;
+    }
+    FeatureStore store = feature.getStore();
+    FeatureSelection selection = store.getFeatureSelection();
+    return selection.isSelected(feature);
+  }
+  
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/SelectFunction.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/SelectFunction.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/function/dataaccess/SelectFunction.java	(revision 44738)
@@ -0,0 +1,150 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.function.dataaccess;
+
+import java.util.List;
+import java.util.Objects;
+import org.apache.commons.lang3.Range;
+import org.gvsig.expressionevaluator.Codes;
+import org.gvsig.expressionevaluator.Expression;
+import org.gvsig.expressionevaluator.ExpressionRuntimeException;
+import org.gvsig.expressionevaluator.ExpressionUtils;
+import org.gvsig.expressionevaluator.Interpreter;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.spi.AbstractFunction;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public class SelectFunction extends AbstractFunction {
+
+  public SelectFunction() {
+    super(DALFunctions.GROUP_DATA_ACCESS,
+            DALFunctions.FUNCTION_SELECT,
+            Range.between(1,1000),
+            "Returns a list of features of the indicated table by applying the filter and order indicated..",
+            DALFunctions.FUNCTION_SELECT + "({{table_name}},filter, order, limit)",
+            new String[]{
+              "table_name - Name of the table",
+              "filter - filter to apply",
+              "order - the order used to retrieve the features",
+              "limit - Maximum number of features to return"
+            },
+            "List",
+            true
+    );
+  }
+
+  @Override
+  public boolean isHidden() {
+    return true;
+  }
+
+  @Override
+  public boolean allowConstantFolding() {
+    return false;
+  }
+
+  @Override
+  public boolean allowArgNames() {
+    return true;
+  }
+
+  @Override
+  public boolean useArgumentsInsteadObjects() {
+    return true;
+  }
+
+  @Override
+  public Object call(Interpreter interpreter, Object[] args) throws Exception {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public Object call(Interpreter interpreter, Codes args) throws Exception {
+
+    String storeName =  (String) getObject(interpreter, args, "TABLE");
+    String where = Objects.toString(args.get("WHERE"),null);
+    Number limit = (Number) getObject(interpreter, args, "LIMIT");
+    FeatureQueryOrder order = null;
+    for( int n=0 ; args.contains("ORDER", n); n++) {
+      String member = (String) getObject(interpreter, args, "ORDER", n);
+      Boolean mode = (Boolean) getObject(interpreter, args, "ORDER_MODE", n);
+      if( order == null ) {
+        order = new FeatureQueryOrder();
+      }
+      order.add(member, mode);
+    }
+    
+    try {
+      DataStore store = this.getStore(storeName);
+      if (store == null ) {
+        throw new ExpressionRuntimeException("Cant locate the store '" + storeName + "' in function '" + DALFunctions.FUNCTION_SELECT + "'.");
+      }
+      if (!(store instanceof FeatureStore)) {
+        throw new ExpressionRuntimeException("The store'" + storeName + "' is not valid for function '" + DALFunctions.FUNCTION_SELECT + "', a FeatureStore is required.");
+      }
+      FeatureStore featureStore = (FeatureStore) store;
+      List<Feature> features;
+      if (where == null && order == null && limit==null ) {
+        features = featureStore.getFeatures();
+      } else {
+        FeatureQuery query = featureStore.createFeatureQuery();
+        if (where != null) {
+          Expression filter = ExpressionUtils.createExpression(where);
+          filter.getSymbolTable().addSymbolTable(interpreter.getSymbolTable());
+          query.addFilter(filter);
+        }
+        if (order != null) {
+          query.getOrder().copyFrom(order);
+        }
+        if( limit!=null ) {
+          query.setLimit(limit.longValue());
+        }
+        query.retrievesAllAttributes();
+        features = featureStore.getFeatures(query);
+      }
+      return features;
+    } catch (ExpressionRuntimeException ex) {
+      throw ex;
+    } catch (Exception ex) {
+      throw new ExpressionRuntimeException("Problems calling '" + DALFunctions.FUNCTION_SELECT + "' function", ex);
+    }
+  }
+
+  protected DataStore getStore(String storeName) {
+    DataManager dataManager = DALLocator.getDataManager();
+    DataStore store = dataManager.getStoresRepository().getStore(storeName);
+    return store;
+  }
+
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/DALFunctions.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/DALFunctions.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/DALFunctions.java	(revision 44738)
@@ -0,0 +1,46 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public interface DALFunctions {
+
+  public static final String SYMBOLTABLE_NAME = "DataAccess";
+  public static final String GRAMMAR_NAME = "DataAccess";
+
+  public static final String GROUP_DATA_ACCESS = "Data access";
+
+  public static final String FUNCTION_CURRENT_ROW = "CURRENT_ROW";
+  public static final String FUNCTION_CURRENT_STORE = "CURRENT_STORE";
+  public static final String FUNCTION_ISSELECTED_CURRENT_ROW = "ISSELECTED_CURRENT_ROW";
+
+  public static final String FUNCTION_SELECT = "SELECT";
+  public static final String FUNCTION_SELECT_COUNT = "SELECT_COUNT";
+  public static final String FUNCTION_EXISTS = "EXISTS";
+  public static final String FUNCTION_FOREING_VALUE = "FOREING_VALUE";
+
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/grammars/DataAccessGrammarFactory.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/grammars/DataAccessGrammarFactory.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/grammars/DataAccessGrammarFactory.java	(revision 44738)
@@ -0,0 +1,168 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.grammars;
+
+import java.util.UUID;
+import org.gvsig.expressionevaluator.Code;
+import org.gvsig.expressionevaluator.Code.Caller;
+import org.gvsig.expressionevaluator.CodeBuilder;
+import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
+import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
+import org.gvsig.expressionevaluator.Grammar;
+import org.gvsig.expressionevaluator.Statement;
+import org.gvsig.expressionevaluator.Statement.StatementContext;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.impl.DefaultCodeBuilder.BaseCodes;
+import org.gvsig.expressionevaluator.impl.DefaultStatement;
+import org.gvsig.expressionevaluator.impl.DefaultStatement.ArgsBuilderFromNames;
+import org.gvsig.expressionevaluator.impl.function.dataaccess.ExistsFunction;
+import org.gvsig.expressionevaluator.spi.AbstractGrammarFactory;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public class DataAccessGrammarFactory extends AbstractGrammarFactory {
+
+    private Grammar grammar;
+
+    private class ExistsStatementBuilder extends DefaultStatement.StatementBuilderBase {
+
+        private final String ListID;
+
+        public ExistsStatementBuilder(String ListID) {
+            super(ExistsFunction.NAME, new ArgsBuilderFromNames(ListID));
+            this.ListID = ListID;
+        }
+
+        @Override
+        public Code build(StatementContext context) {
+            UUID x = UUID.randomUUID();
+            String exists_id = x.toString().replaceAll("-", "");
+
+            CodeBuilder codeBuilder = context.getCodeBuilder();
+            Caller code = (Caller) super.build(context);
+            BaseCodes args = (BaseCodes) code.parameters();
+            args.add("EXISTS_ID", codeBuilder.constant(exists_id));
+            code = codeBuilder.function(ExistsFunction.NAME, args);
+            return code;
+        }
+        
+    }
+    public DataAccessGrammarFactory() {
+        super(DALFunctions.GRAMMAR_NAME, true);
+    }
+    
+    @Override
+    public Grammar create(Object... parameters) {
+        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
+        if( this.grammar==null ) {
+            Grammar theGrammar = manager.createGrammar(this.getName());
+            Statement stmt;
+        
+            theGrammar.addReservedWord("EXISTS");
+            theGrammar.addReservedWord("SELECT");
+            theGrammar.addReservedWord("FROM");
+            theGrammar.addReservedWord("WHERE");
+            theGrammar.addReservedWord("ORDER");
+            theGrammar.addReservedWord("DESC");
+            theGrammar.addReservedWord("ASC");
+            theGrammar.addReservedWord("BY");
+            
+            stmt = theGrammar.createStatement("EXISTS");
+            stmt.addRule(stmt.require_any_token("EXISTS"));
+            stmt.addRule(stmt.require_expression("LIST"));
+            stmt.builder(new ExistsStatementBuilder("LIST"));
+            theGrammar.addStatement(stmt);
+
+
+            stmt = theGrammar.createStatement("SELECT");
+            stmt.addRule(stmt.require_any_token("SELECT"));
+            stmt.addRule(stmt.require_any_token("*","1"));
+            stmt.addRule(stmt.require_any_token("FROM"));
+            stmt.addRule(stmt.require_identifier("TABLE"));
+            stmt.addRule(stmt.optional_any_token("WHERE")
+                    .addRuleOnTrue(stmt.require_expression("WHERE"))
+            );
+            
+            stmt.addRule(stmt.optional_any_token("ORDER")
+                    .addRuleOnTrue(stmt.require_any_token("BY"))
+                    .addRuleOnTrue(
+                      stmt.repeat()
+                          .addRule(stmt.require_expression("ORDER#"))
+                          .addRule(stmt.switch_token()
+                                  .addCase("ASC", 
+                                          stmt.set_expression("ORDER_MODE#", true)
+                                  )
+                                  .addCase("DESC", 
+                                          stmt.set_expression("ORDER_MODE#", false)
+                                  )
+                                  .addDefault(
+                                          stmt.set_expression("ORDER_MODE#", true)
+                                  )
+                          )
+                          .addRule(
+                              stmt.optional_any_token(",")
+                                  .addRuleOnFalse(stmt.break_loop())
+                          )
+                    )
+            );    
+            stmt.addRule(stmt.optional_any_token("LIMIT")
+                    .addRuleOnTrue(stmt.require_expression("LIMIT"))
+            );
+            stmt.addRule(stmt.require_any_token(";"));
+            stmt.code(
+                    DALFunctions.FUNCTION_SELECT,
+                    stmt.args_names("TABLE","WHERE","ORDER#","ORDER_MODE#","LIMIT")
+            ); 
+            theGrammar.addStatement(stmt);
+
+            stmt = theGrammar.createStatement("SELECT_COUNT");
+            stmt.addRule(stmt.require_any_token("SELECT"));
+            stmt.addRule(stmt.require_any_token("COUNT"));
+            stmt.addRule(stmt.require_any_token("("));
+            stmt.addRule(stmt.require_any_token("*"));
+            stmt.addRule(stmt.require_any_token(")"));
+            stmt.addRule(stmt.require_any_token("FROM"));
+            stmt.addRule(stmt.require_identifier("TABLE"));
+            stmt.addRule(stmt.optional_any_token("WHERE")
+                    .addRuleOnTrue(stmt.require_expression("WHERE"))
+            );
+            stmt.addRule(stmt.require_any_token(";"));
+            stmt.code(
+                    DALFunctions.FUNCTION_SELECT_COUNT,
+                    stmt.args_names("TABLE","WHERE")
+            ); 
+            theGrammar.addStatement(stmt);
+
+            this.grammar = theGrammar;
+        }
+        return grammar;
+    }
+ 
+    public static final void selfRegister() {
+        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
+        manager.registerGrammar(new DataAccessGrammarFactory());
+    }
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/DALExpressionEvaluatorImplLibrary.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/DALExpressionEvaluatorImplLibrary.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/DALExpressionEvaluatorImplLibrary.java	(revision 44738)
@@ -0,0 +1,51 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl;
+
+import org.gvsig.expressionevaluator.ExpressionEvaluatorLibrary;
+import org.gvsig.expressionevaluator.impl.symboltable.DALSymbolTableFactory;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class DALExpressionEvaluatorImplLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsServiceOf(ExpressionEvaluatorLibrary.class);
+        require(ToolsLibrary.class);
+        require(DALLibrary.class);
+    }
+
+    @Override
+    protected void doInitialize() throws LibraryException {
+    }
+
+    @Override
+    protected void doPostInitialize() throws LibraryException {
+        DALSymbolTableFactory.selfRegister();
+    }
+}
+
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/symboltable/DALSymbolTable.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/symboltable/DALSymbolTable.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/symboltable/DALSymbolTable.java	(revision 44738)
@@ -0,0 +1,59 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.symboltable;
+
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.impl.function.dataaccess.CurrentRowFunction;
+import org.gvsig.expressionevaluator.impl.function.dataaccess.CurrentStoreFunction;
+import org.gvsig.expressionevaluator.impl.function.dataaccess.ExistsFunction;
+import org.gvsig.expressionevaluator.impl.function.dataaccess.ForeingValueFunction;
+import org.gvsig.expressionevaluator.impl.function.dataaccess.IsSelectedCurrentRowFunction;
+import org.gvsig.expressionevaluator.impl.function.dataaccess.SelectCountFunction;
+import org.gvsig.expressionevaluator.impl.function.dataaccess.SelectFunction;
+import org.gvsig.expressionevaluator.spi.AbstractSymbolTable;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public class DALSymbolTable 
+        extends AbstractSymbolTable
+    {   
+
+    public DALSymbolTable() {
+        super(DALFunctions.SYMBOLTABLE_NAME);
+        this.initFunctions();
+    }
+    
+    private void initFunctions() {
+        this.addFunction(new ExistsFunction());
+        this.addFunction(new SelectFunction());
+        this.addFunction(new SelectCountFunction());
+        this.addFunction(new CurrentRowFunction());
+        this.addFunction(new CurrentStoreFunction());
+        this.addFunction(new ForeingValueFunction());
+        this.addFunction(new IsSelectedCurrentRowFunction());
+        this.addFunction(new ForeingValueFunction());
+    }    
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/symboltable/DALSymbolTableFactory.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/symboltable/DALSymbolTableFactory.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/symboltable/DALSymbolTableFactory.java	(revision 44738)
@@ -0,0 +1,57 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.symboltable;
+
+import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
+import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
+import org.gvsig.expressionevaluator.SymbolTable;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.spi.AbstractSymbolTableFactory;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public class DALSymbolTableFactory extends AbstractSymbolTableFactory {
+
+    private SymbolTable symbolTable;
+    
+    public DALSymbolTableFactory() {
+        super(DALFunctions.SYMBOLTABLE_NAME, true);
+    }
+    
+    @Override
+    public SymbolTable create(Object... args) {
+        if( this.symbolTable==null ) {
+            this.symbolTable = new DALSymbolTable();
+        }
+        return this.symbolTable;
+    }
+    
+    public static final void selfRegister() {
+        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
+        
+        manager.registerSymbolTable(new DALSymbolTableFactory());
+    }
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/symboltable/FeatureSymbolTableImpl.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/symboltable/FeatureSymbolTableImpl.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/expressionevaluator/impl/symboltable/FeatureSymbolTableImpl.java	(revision 44738)
@@ -0,0 +1,183 @@
+/**
+ * gvSIG. Desktop Geographic Information System.
+ *
+ * Copyright (C) 2007-2020 gvSIG Association.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * For any additional information, do not hesitate to contact us
+ * at info AT gvsig.com, or visit our website www.gvsig.com.
+ */
+package org.gvsig.expressionevaluator.impl.symboltable;
+
+import org.apache.commons.lang3.Range;
+import org.apache.commons.lang3.StringUtils;
+import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
+import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
+import org.gvsig.expressionevaluator.Function;
+import org.gvsig.expressionevaluator.Interpreter;
+import org.gvsig.expressionevaluator.MutableSymbolTable;
+import org.gvsig.expressionevaluator.impl.DALFunctions;
+import org.gvsig.expressionevaluator.spi.AbstractFunction;
+import org.gvsig.expressionevaluator.spi.AbstractSymbolTable;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectAdapter;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+@SuppressWarnings("UseSpecificCatch")
+public class FeatureSymbolTableImpl extends AbstractSymbolTable implements FeatureSymbolTable {
+
+  private final Function current_row;
+  private Feature feature;
+  private FeatureType type;
+  private String storeName;
+  private DynObject storeAdapter;
+
+  @SuppressWarnings("OverridableMethodCallInConstructor")
+  public FeatureSymbolTableImpl() {
+    super(DataManager.DAL_SYMBOL_TABLE_FEATURE);
+    this.current_row = new AbstractFunction(
+            DALFunctions.GROUP_DATA_ACCESS,
+            DALFunctions.FUNCTION_CURRENT_ROW,
+            Range.is(0),
+            "Return the current row when used in a table filter.\n"
+            + "Return null if used outer a table filter.",
+            DALFunctions.FUNCTION_CURRENT_ROW + "()",
+            null,
+            "Feature"
+    ) {
+      @Override
+      public Object call(Interpreter interpreter, Object[] args) throws Exception {
+        return feature;
+      }
+    };
+    this.storeAdapter = new DynObjectAdapter() {
+        @Override
+        public Object getDynValue(String name) throws DynFieldNotFoundException {
+          try {
+            return feature.get(name);
+          } catch (Exception ex) {
+            return feature.getExtraValue(name);
+          }
+        }
+
+        @Override
+        public boolean hasDynValue(String name) {
+          if( feature.getType().get(name)!=null ) {
+            return true;
+          }
+          return feature.hasExtraValue(name);
+        }
+        
+      };
+  }
+
+  @Override
+  public FeatureSymbolTableImpl clone() throws CloneNotSupportedException {
+    FeatureSymbolTableImpl other = (FeatureSymbolTableImpl) super.clone();
+    return other;
+  }
+
+  @Override
+  public Function function(String name) {
+    if (StringUtils.equalsIgnoreCase(name, DALFunctions.FUNCTION_CURRENT_ROW)) {
+      return this.current_row;
+    }
+    return super.function(name);
+  }
+
+  @Override
+  public boolean exists(String name) {
+    if (type == null) {
+      return false;
+    }
+    if ( type.get(name) != null) {
+      return true;
+    }
+    if (StringUtils.equalsIgnoreCase(name, this.storeName)) {
+      return true;
+    }
+    if( feature==null ) {
+      return false;
+    }
+    if (this.feature.hasExtraValue(name)) {
+      return true;
+    }
+    return false;
+  }
+
+  @Override
+  public Object value(String name) {
+    if (feature == null) {
+      return null;
+    }
+    if (StringUtils.equalsIgnoreCase(name, this.storeName)) {
+      return this.storeAdapter;
+    }
+    try {
+      return this.feature.get(name);
+    } catch (Exception ex) {
+      return this.feature.getExtraValue(name);
+    }
+  }
+
+  @Override
+  public boolean isSQLCompatible(String name) {
+    if (this.type == null) {
+      return super.isSQLCompatible(name);
+    }
+    FeatureAttributeDescriptor attrdesc = this.type.getAttributeDescriptor(name);
+    if (attrdesc == null) {
+      return true;
+    }
+    if (attrdesc.isComputed()) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public void setFeature(Feature feature) {
+    this.feature = feature;
+    if (this.type == null) {
+      this.type = feature.getType();
+      FeatureStore store = feature.getStore();
+      if (store != null) {
+        this.storeName = store.getName();
+      }
+    }
+  }
+
+  @Override
+  public MutableSymbolTable createParent() {
+    ExpressionEvaluatorManager expManager = ExpressionEvaluatorLocator.getManager();
+
+    MutableSymbolTable symbolTable = expManager.createSymbolTable();
+    symbolTable.addSymbolTable(this);
+    return symbolTable;
+  }
+
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java	(revision 44738)
@@ -1176,6 +1176,10 @@
         return this.data.getExtraValue(name);
     }
 
+    public boolean hasExtraValue(String name) {
+        return this.data.hasExtraValue(name);
+    }
+    
     @Override
     public Object getExtraValue(int index) {
         return this.data.getExtraValue(index);
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/FeatureTypeToStoreProviderAdapter.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/FeatureTypeToStoreProviderAdapter.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/FeatureTypeToStoreProviderAdapter.java	(revision 44738)
@@ -259,7 +259,13 @@
             @Override
             public void setExtraValueNames(String[] extraValueNames) {
             }
+
+            @Override
+            public boolean hasExtraValue(String name) {
+              return false;
+            }
             
+            
         }
         
         private final FeatureType featureType;
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultDataManager.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultDataManager.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultDataManager.java	(revision 44738)
@@ -18,6 +18,7 @@
 import org.gvsig.expressionevaluator.ExpressionBuilder;
 import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
 import org.gvsig.expressionevaluator.MutableSymbolTable;
+import org.gvsig.expressionevaluator.impl.symboltable.FeatureSymbolTableImpl;
 import org.gvsig.fmap.dal.BaseStoresRepository;
 import org.gvsig.fmap.dal.DALLocator;
 
@@ -71,7 +72,6 @@
 import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProviderServices;
 import org.gvsig.fmap.dal.impl.expressionevaluator.DefaultExpressionEvaluator;
 import org.gvsig.fmap.dal.impl.expressionevaluator.DefaultFeatureAttributeEmulatorExpression;
-import org.gvsig.fmap.dal.impl.expressionevaluator.DefaultFeatureSymbolTable;
 import org.gvsig.fmap.dal.raster.impl.RasterStoreFactory;
 import org.gvsig.fmap.dal.raster.impl.RasterStoreOldFactory;
 import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider;
@@ -315,19 +315,45 @@
     }
 
     @Override
-    public DataStoreParameters createStoreParameters(String providerName) throws InitializeException, ProviderNotRegisteredException {
+    public DataStoreParameters createStoreParameters(String providerName, Object... arguments) throws InitializeException, ProviderNotRegisteredException {
         if( providerName == null ) {
             String msg = "Provider name can't be null.";
             LOGGER.warn(msg);
             throw new IllegalArgumentException(msg);
         }
+        if( arguments.length == 1 ) { 
+            // Desde jython entra por este metodo en lugar de los especificos
+            // de DataStoreParameters o DynObject
+            if( arguments[0] instanceof DataStoreParameters ) {
+                return this.createStoreParameters(providerName, (DataStoreParameters)(arguments[0]));
+            } else if( arguments[0] instanceof DynObject ) {
+                return this.createStoreParameters(providerName, (DynObject)(arguments[0]));
+            }
+        }
+        if( (arguments.length % 2)!= 0 ) {
+            throw new IllegalArgumentException("The number of arguments must be even.");
+        }
+        if( providerName == null ) {
+            String msg = "Provider name can't be null.";
+            LOGGER.warn(msg);
+            throw new IllegalArgumentException(msg);
+        }
         DataFactory providerFactory = this.getStoreProviderRegister().getFactory(providerName);
         if( providerFactory == null ) {
             String msg = "Can't locate provider factory for '"+providerName+"'.";
             LOGGER.warn(msg);
             throw new IllegalArgumentException(msg);
         }
-        return (DataStoreParameters) providerFactory.createParameters();
+        DataStoreParameters parameters = (DataStoreParameters) providerFactory.createParameters();
+        for( int i=0; i<arguments.length; i+=2 ) {
+            String name = (String) arguments[i];
+            if( name.endsWith("=") ) {
+                name = name.substring(0, name.length()-1);
+            }
+            Object value = arguments[i+1];
+            parameters.setDynValue(name, value);
+        }
+        return parameters;
     }
 
     @Override
@@ -989,7 +1015,7 @@
 
     @Override
     public FeatureSymbolTable createFeatureSymbolTable() {
-        FeatureSymbolTable symbolTable = new DefaultFeatureSymbolTable();
+        FeatureSymbolTable symbolTable = new FeatureSymbolTableImpl();
         return symbolTable;
     }
 
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java	(revision 44738)
@@ -28,12 +28,13 @@
 import java.util.List;
 import java.util.Map;
 import org.gvsig.expressionevaluator.ExpressionEvaluatorLibrary;
+import org.gvsig.expressionevaluator.impl.grammars.DataAccessGrammarFactory;
+import org.gvsig.expressionevaluator.impl.symboltable.DALSymbolTableFactory;
 
 import org.gvsig.fmap.dal.DALLibrary;
 import org.gvsig.fmap.dal.DALLocator;
 import org.gvsig.fmap.dal.DataManager;
 import org.gvsig.fmap.dal.DataTypes;
-import org.gvsig.fmap.dal.complements.Search;
 import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform;
 import org.gvsig.fmap.dal.feature.impl.DALFile;
 import org.gvsig.fmap.dal.feature.impl.DefaultFeatureAttributeDescriptor;
@@ -58,9 +59,7 @@
 import org.gvsig.fmap.dal.feature.impl.indexes.memorybasictypes.MemoryStringIndexProviderFactory;
 import org.gvsig.fmap.dal.feature.spi.memory.MemoryResource;
 import org.gvsig.fmap.dal.feature.spi.memory.MemoryResourceParameters;
-import org.gvsig.fmap.dal.impl.expressionevaluator.DALSymbolTable;
 import org.gvsig.fmap.dal.impl.expressionevaluator.DefaultFeatureAttributeEmulatorExpression;
-import org.gvsig.fmap.dal.impl.expressionevaluator.DefaultFeatureSymbolTable;
 import org.gvsig.fmap.dal.resource.impl.DefaultResourceManager;
 import org.gvsig.fmap.dal.resource.spi.MultiResource;
 import org.gvsig.fmap.dal.resource.spi.MultiResourceParameters;
@@ -192,10 +191,10 @@
         dynObjectmanager.registerDynMethod(new ComputeAvailableValuesFromTable("getAvailableValuesFromTable", "Retrieve available values from the elements of a table."));
 
         registerTags();
-        DALSymbolTable.selfRegister();
-        DefaultFeatureSymbolTable.selfRegister();
         DefaultFeatureAttributeDescriptor.registerPersistenceDefinition();
         DefaultFeatureType.registerPersistenceDefinition();
+        DataAccessGrammarFactory.selfRegister();
+        DALSymbolTableFactory.selfRegister();
         
         if (exs.size() > 0) {
             throw new LibraryException(this.getClass(), exs);
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DALSymbolTable.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DALSymbolTable.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DALSymbolTable.java	(revision 44738)
@@ -1,109 +0,0 @@
-package org.gvsig.fmap.dal.impl.expressionevaluator;
-
-import java.util.List;
-import org.apache.commons.lang3.Range;
-import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
-import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
-import org.gvsig.expressionevaluator.ExpressionRuntimeException;
-import org.gvsig.expressionevaluator.Interpreter;
-import org.gvsig.expressionevaluator.spi.AbstractFunction;
-import org.gvsig.expressionevaluator.spi.AbstractSymbolTable;
-import org.gvsig.fmap.dal.DALLocator;
-import org.gvsig.fmap.dal.DataManager;
-import org.gvsig.fmap.dal.DataStore;
-import org.gvsig.fmap.dal.feature.Feature;
-import org.gvsig.fmap.dal.feature.FeatureQuery;
-import org.gvsig.fmap.dal.feature.FeatureStore;
-
-/**
- *
- * @author jjdelcerro
- */
-@SuppressWarnings("UseSpecificCatch")
-public class DALSymbolTable extends AbstractSymbolTable {
-
-    public static final String FUNCTION_FEATURES = "FEATURES";
-
-    public static class FeaturesFunction extends AbstractFunction {
-
-        public FeaturesFunction() {
-            super(
-                    "Data access",
-                    FUNCTION_FEATURES,
-                    Range.between(1, 3),
-                    "Return a list of the features selecteds with filter in the store.",
-                    FUNCTION_FEATURES + "({{store_name}}, filter, order)",
-                    new String[]{
-                        "store - data store name to be used",
-                        "where - Optional. String value with a filter expression",
-                        "order - Optional. String value with the order. must be a string with the names of separate fields with commas"
-                    },
-                    "LIST"
-            );
-        }
-
-        @Override
-        public Object call(Interpreter interpreter, Object[] args) throws Exception {
-            String storeName = getStr(args, 0);
-            String where = null;
-            String order = null;
-            switch (args.length) {
-                case 2:
-                    where = getStr(args, 1);
-                    break;
-                case 3:
-                    where = getStr(args, 1);
-                    order = getStr(args, 2);
-                    break;
-            }
-            try {
-                DataStore store = this.getStore(storeName);
-                if (store == null || !(store instanceof FeatureStore)) {
-                    throw new ExpressionRuntimeException("Cant locate the store '" + storeName + "' in function '" + FUNCTION_FEATURES + "'.");
-                }
-                if (!(store instanceof FeatureStore)) {
-                    throw new ExpressionRuntimeException("The store'" + storeName + "' is not valid for function '" + FUNCTION_FEATURES + "', a FeatureStore is required.");
-                }
-                FeatureStore featureStore = (FeatureStore) store;
-                List<Feature> features;
-                if (where == null && order == null) {
-                    features = featureStore.getFeatures();
-                } else {
-                    FeatureQuery query = featureStore.createFeatureQuery();
-                    if (where != null) {
-                        query.addFilter(where);
-                    }
-                    if (order != null) {
-                        query.getOrder().add(order);
-                    }
-                    query.retrievesAllAttributes();
-                    features = featureStore.getFeatures(query);
-                }
-                return features;
-            } catch (ExpressionRuntimeException ex) {
-                throw ex;
-            } catch (Exception ex) {
-                throw new ExpressionRuntimeException("Problems calling '" + FUNCTION_FEATURES + "' function", ex);
-            }
-        }
-
-        protected DataStore getStore(String storeName) {
-            DataManager dataManager = DALLocator.getDataManager();
-            DataStore store = dataManager.getStoresRepository().getStore(storeName);
-            return store;
-        }
-    }
-
-    @SuppressWarnings("OverridableMethodCallInConstructor")
-    public DALSymbolTable() {
-        super(DataManager.DAL_SYMBOL_TABLE);
-
-        this.addFunction(new FeaturesFunction());
-    }
-
-    public static void selfRegister() {
-        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
-        manager.registerSymbolTable(new DALSymbolTableFactory());
-    }
-
-}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultFeatureSymbolTable.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultFeatureSymbolTable.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultFeatureSymbolTable.java	(revision 44738)
@@ -1,381 +0,0 @@
-package org.gvsig.fmap.dal.impl.expressionevaluator;
-
-import java.util.Arrays;
-import java.util.List;
-import org.apache.commons.lang3.Range;
-import org.apache.commons.lang3.StringUtils;
-import org.gvsig.expressionevaluator.ExpressionBuilder;
-import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
-import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
-import org.gvsig.expressionevaluator.ExpressionRuntimeException;
-import org.gvsig.expressionevaluator.ExpressionUtils;
-import org.gvsig.expressionevaluator.Interpreter;
-import org.gvsig.expressionevaluator.MutableSymbolTable;
-import org.gvsig.expressionevaluator.spi.AbstractFunction;
-import org.gvsig.expressionevaluator.spi.AbstractSymbolTable;
-import org.gvsig.fmap.dal.DALLocator;
-import org.gvsig.fmap.dal.DataManager;
-import static org.gvsig.fmap.dal.DataManager.FUNCTION_FOREING_VALUE;
-import org.gvsig.fmap.dal.DataStore;
-import org.gvsig.fmap.dal.StoresRepository;
-import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable;
-import org.gvsig.fmap.dal.feature.Feature;
-import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
-import org.gvsig.fmap.dal.feature.FeatureSelection;
-import org.gvsig.fmap.dal.feature.FeatureStore;
-import org.gvsig.fmap.dal.feature.FeatureType;
-import org.gvsig.fmap.dal.feature.ForeingKey;
-import org.gvsig.fmap.dal.impl.expressionevaluator.DALSymbolTable.FeaturesFunction;
-import org.gvsig.tools.dynobject.DynObjectAdapter;
-import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
-import org.gvsig.tools.script.Script;
-import org.gvsig.tools.util.UnmodifiableBasicList;
-import org.gvsig.tools.util.UnmodifiableBasicListAdapter;
-
-/**
- *
- * @author jjdelcerro
- */
-    @SuppressWarnings("UseSpecificCatch")
-public class DefaultFeatureSymbolTable extends AbstractSymbolTable implements FeatureSymbolTable {
-
-//    public static final String FUNCTION_FEATURES = "FEATURES";
-//
-//    public class FeaturesFunction extends AbstractFunction {
-//
-//        public FeaturesFunction() {
-//            super(
-//                    "Data access",
-//                    FUNCTION_FEATURES,
-//                    Range.between(1, 3),
-//                    "Return a list of the features selecteds with filter in the store.",
-//                    FUNCTION_FEATURES + "({{store_name}}, filter, order)",
-//                    new String[]{
-//                        "store - data store name to be used",
-//                        "where - Optional. String value with a filter expression",
-//                        "order - Optional. String value with the order. must be a string with the names of separate fields with commas"
-//                    },
-//                    "LIST"
-//            );
-//        }
-//
-//        @Override
-//        public Object call(Interpreter interpreter, Object[] args) throws Exception {
-//            String storeName = getStr(args, 0);
-//            String where = null;
-//            String order = null;
-//            switch (args.length) {
-//                case 2:
-//                    where = getStr(args, 1);
-//                    break;
-//                case 3:
-//                    where = getStr(args, 1);
-//                    order = getStr(args, 2);
-//                    break;
-//            }
-//            try {
-//                DataStore store = getStore(storeName);
-//                if (store == null || !(store instanceof FeatureStore)) {
-//                    throw new ExpressionRuntimeException("Cant locate the store '" + storeName + "' in function '" + FUNCTION_FEATURES + "'.");
-//                }
-//                if (!(store instanceof FeatureStore)) {
-//                    throw new ExpressionRuntimeException("The store'" + storeName + "' is not valid for function '" + FUNCTION_FEATURES + "', a FeatureStore is required.");
-//                }
-//                FeatureStore featureStore = (FeatureStore) store;
-//                List<Feature> features;
-//                if (where == null && order == null) {
-//                    features = featureStore.getFeatures();
-//                } else {
-//                    FeatureQuery query = featureStore.createFeatureQuery();
-//                    if (where != null) {
-//                        query.addFilter(where);
-//                    }
-//                    if (order != null) {
-//                        query.getOrder().add(order);
-//                    }
-//                    query.retrievesAllAttributes();
-//                    features = featureStore.getFeatures(query);
-//                }
-//                return features;
-//            } catch (ExpressionRuntimeException ex) {
-//                throw ex;
-//            } catch (Exception ex) {
-//                throw new ExpressionRuntimeException("Problems calling '" + FUNCTION_FEATURES + "' function", ex);
-//            }
-//        }
-//
-//        protected DataStore getStore(String storeName) {
-//            DataStore store = feature.getStore();
-////            DataManager dataManager = DALLocator.getDataManager();
-////            DataStore store = dataManager.getStoresRepository().getStore(storeName);
-//            return store;
-//        }
-//    }
-
-    public class ForeingValueFunction extends AbstractFunction {
-
-        public ForeingValueFunction() {
-            super(
-                    "Data access",
-                    FUNCTION_FOREING_VALUE,
-                    Range.is(1),
-                    "Return the value of a field throw a relation from other tables.",
-                    FUNCTION_FOREING_VALUE + "({{field_name}})",
-                    new String[]{
-                        "fieldName - dot separated field path or list of strings with field names."
-                    },
-                    "OBJECT"
-            );
-        }
-
-        @Override
-        public Object call(Interpreter interpreter, Object[] args) throws Exception {
-            ExpressionBuilder builder = ExpressionUtils.createExpressionBuilder();
-            UnmodifiableBasicList<String> fieldNames;
-            Object fields_o = getObject(args, 0);
-            if( fields_o instanceof List ) {
-                fieldNames = new UnmodifiableBasicListAdapter<>((List<String>) fields_o);
-            } else if( fields_o instanceof String ) {
-                fieldNames =  new UnmodifiableBasicListAdapter<>(Arrays.asList(((String)fields_o).split("[.]")));
-            } else if( fields_o instanceof UnmodifiableBasicList ) {
-                fieldNames = (UnmodifiableBasicList<String>) fields_o;
-            } else {
-                throw new ExpressionRuntimeException(
-                    "Problems calling '" + FUNCTION_FOREING_VALUE + 
-                    "' function, type of parameter '"+fields_o.getClass().getSimpleName()+
-                    "' not supported, use string or list.");
-            }
-            
-            Feature currentFeature = feature;
-            try {
-                String fieldName;
-                Object value;
-                
-                value = feature.getExtraValue(StringUtils.join(fieldNames, "."));
-                if( value != null ) {
-                    return value;
-                }
-                for (int i = 0; i < fieldNames.size()-1; i++) {
-                    fieldName = fieldNames.get(i);
-                    value = currentFeature.get(fieldName);
-                    
-                    FeatureAttributeDescriptor attrdesc = currentFeature.getType().getAttributeDescriptor(fieldName);
-                    ForeingKey foreingKey = attrdesc.getForeingKey();
-//                    ContextForeingKey context = foreingKey.createContext();
-                    currentFeature = foreingKey.getFeature(null, value);
-//                    DisposeUtils.disposeQuietly(context);
-                    if( currentFeature==null ) {
-                        return null;
-                    }
-                }
-                fieldName = fieldNames.get(fieldNames.size()-1);
-                value = currentFeature.get(fieldName);
-                return value;
-            } catch (ExpressionRuntimeException ex) {
-                throw ex;
-            } catch (Exception ex) {
-                throw new ExpressionRuntimeException("Problems calling '" + FUNCTION_FOREING_VALUE + "' function", ex);
-            }
-        }
-        
-    }
-
-    private class LocalFeaturesFunction extends FeaturesFunction {
-
-        public LocalFeaturesFunction() {
-            super();
-        }
-
-        @Override
-        protected DataStore getStore(String storeName) {
-            DataManager dataManager = DALLocator.getDataManager();
-            DataStore store = null;
-            if (feature != null) {
-                store = feature.getStore();
-                store = store.getStoresRepository().getStore(storeName);
-            }
-            if (store == null) {
-                StoresRepository repository = dataManager.getStoresRepository();
-                if (repository.containsKey(storeName)) {
-                    store = repository.getStore(storeName);
-                }
-            }
-            return store;
-        }
-    }
-
-    private class FeatureFunction extends AbstractFunction {
-
-        public FeatureFunction() {
-            super(
-                    "Data access",
-                    "feature",
-                    Range.is(0),
-                    "Access to the current feature object when used in a filter.\n"
-                    + "Return null if used outer a filter.",
-                    "feature()",
-                    null,
-                    "Feature"
-            );
-        }
-
-        @Override
-        public Object call(Interpreter interpreter, Object[] args) throws Exception {
-            return feature;
-        }
-
-    }
-
-    public class FeatureStoreFunction extends AbstractFunction {
-
-        public FeatureStoreFunction() {
-            super(
-                    "Data access",
-                    "store",
-                    Range.is(0),
-                    "Access to the current store object when used in a filter.\n"
-                    + "Return null if used outer a filter.",
-                    "store()",
-                    null,
-                    "FeatureStore"
-            );
-        }
-
-        @Override
-        public Object call(Interpreter interpreter, Object[] args) throws Exception {
-            if (feature == null) {
-                return null;
-            }
-            return feature.getStore();
-        }
-
-    }
-
-    public class IsSelectedFunction extends AbstractFunction {
-
-        public IsSelectedFunction() {
-            super(
-                    "Data access",
-                    "isSelected",
-                    Range.is(0),
-                    "Return if the current feature is selected in the store when used in a filter.\n"
-                    + "Return false if used outer a filter.",
-                    "isSelected()",
-                    null,
-                    "Boolean"
-            );
-        }
-
-        @Override
-        public Object call(Interpreter interpreter, Object[] args) throws Exception {
-            if (feature == null) {
-                return false;
-            }
-            FeatureStore store = feature.getStore();
-            FeatureSelection selection = store.getFeatureSelection();
-            return selection.isSelected(feature);
-        }
-
-    }
-
-    private Feature feature;
-    private FeatureType type;
-    private String storeName;
-
-    @SuppressWarnings("OverridableMethodCallInConstructor")
-    public DefaultFeatureSymbolTable() {
-        super(DataManager.DAL_SYMBOL_TABLE_FEATURE);
-
-
-//        this.addFunction(new FeaturesFunction());
-        this.addFunction(new FeatureFunction());
-        this.addFunction(new FeatureStoreFunction());
-        this.addFunction(new IsSelectedFunction());
-        this.addFunction(new LocalFeaturesFunction());
-        this.addFunction(new ForeingValueFunction());
-    }
-
-//    @SuppressWarnings("OverridableMethodCallInConstructor")
-//    public DefaultFeatureSymbolTable(Script userScript, UnmodifiableBasicList<Script> scripts) {
-//        this();
-//        if (userScript != null) {
-//            this.getScripts().add(userScript);
-//        }
-//        if (scripts != null && !scripts.isEmpty()) {
-//            for (Script script : scripts) {
-//                this.getScripts().add(script);
-//            }
-//        }
-//    }
-
-    @Override
-    public FeatureSymbolTable clone() throws CloneNotSupportedException {
-        DefaultFeatureSymbolTable other = (DefaultFeatureSymbolTable) super.clone();
-        return other;
-    }
-
-    @Override
-    public boolean exists(String name) {
-        if (type != null && type.get(name) != null) {
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public Object value(String name) {
-        if (feature == null) {
-            return null;
-        }
-        if( StringUtils.equalsIgnoreCase(name, this.storeName) ) {
-            return new DynObjectAdapter() {
-                @Override
-                public Object getDynValue(String string) throws DynFieldNotFoundException {
-                    return feature.get(string);
-                }
-            };
-        }
-        return this.feature.get(name);
-    }
-
-    @Override
-    public boolean isSQLCompatible(String name) {
-        if (this.type == null) {
-            return super.isSQLCompatible(name);
-        }
-        FeatureAttributeDescriptor attrdesc = this.type.getAttributeDescriptor(name);
-        if (attrdesc == null) {
-            return true;
-        }
-        if (attrdesc.isComputed()) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public void setFeature(Feature feature) {
-        this.feature = feature;
-        if( this.type == null ) {
-            this.type = feature.getType();
-            FeatureStore store = feature.getStore();
-            if( store!=null ) {
-                this.storeName = store.getName();
-            }
-        }
-    }
-
-    @Override
-    public MutableSymbolTable createParent() {
-        ExpressionEvaluatorManager expManager = ExpressionEvaluatorLocator.getManager();
-
-        MutableSymbolTable symbolTable = expManager.createSymbolTable();
-        symbolTable.addSymbolTable(this);
-        return symbolTable;
-    }
-
-    public static void selfRegister() {
-        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
-        manager.registerSymbolTable(new DefaultfeatureSymbolTableFactory());
-    }
-}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DALSymbolTableFactory.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DALSymbolTableFactory.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DALSymbolTableFactory.java	(revision 44738)
@@ -1,23 +0,0 @@
-package org.gvsig.fmap.dal.impl.expressionevaluator;
-
-import org.gvsig.expressionevaluator.SymbolTable;
-import org.gvsig.expressionevaluator.spi.AbstractSymbolTableFactory;
-import org.gvsig.fmap.dal.DataManager;
-
-/**
- *
- * @author jjdelcerro
- */
-public class DALSymbolTableFactory extends AbstractSymbolTableFactory {
-
-    public DALSymbolTableFactory() {
-        super(DataManager.DAL_SYMBOL_TABLE, true);
-    }
-    
-    @Override
-    public SymbolTable create(Object... args) {
-        DALSymbolTable symbolTable = new DALSymbolTable();
-        return symbolTable;
-    }
-    
-}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultfeatureSymbolTableFactory.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultfeatureSymbolTableFactory.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultfeatureSymbolTableFactory.java	(revision 44738)
@@ -1,24 +0,0 @@
-package org.gvsig.fmap.dal.impl.expressionevaluator;
-
-import org.gvsig.expressionevaluator.SymbolTable;
-import org.gvsig.expressionevaluator.spi.AbstractSymbolTableFactory;
-import org.gvsig.fmap.dal.DataManager;
-import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable;
-
-/**
- *
- * @author jjdelcerro
- */
-public class DefaultfeatureSymbolTableFactory extends AbstractSymbolTableFactory {
-
-    public DefaultfeatureSymbolTableFactory() {
-        super(DataManager.DAL_SYMBOL_TABLE_FEATURE, false);
-    }
-    
-    @Override
-    public SymbolTable create(Object... args) {
-        FeatureSymbolTable symbolTable = new DefaultFeatureSymbolTable();
-        return symbolTable;
-    }
-    
-}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultExpressionEvaluator.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultExpressionEvaluator.java	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultExpressionEvaluator.java	(revision 44738)
@@ -10,6 +10,7 @@
 import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
 import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
 import org.gvsig.expressionevaluator.Function;
+import org.gvsig.expressionevaluator.impl.symboltable.FeatureSymbolTableImpl;
 import org.gvsig.fmap.dal.expressionevaluator.ExpressionEvaluator;
 import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable;
 import org.gvsig.fmap.dal.feature.Feature;
@@ -19,8 +20,6 @@
 import org.gvsig.tools.evaluator.EvaluatorException;
 import org.gvsig.tools.evaluator.EvaluatorFieldsInfo;
 import org.gvsig.tools.exception.BaseException;
-import org.gvsig.tools.visitor.VisitCanceledException;
-import org.gvsig.tools.visitor.Visitor;
 import org.gvsig.tools.lang.Cloneable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -85,7 +84,7 @@
     public DefaultExpressionEvaluator(String source) {
         ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
         this.symbolTable = manager.createSymbolTable();
-        this.featureSymbolTable = new DefaultFeatureSymbolTable();
+        this.featureSymbolTable = new FeatureSymbolTableImpl();
         this.symbolTable.addSymbolTable(this.featureSymbolTable);
         
         this.expression = manager.createExpression();
@@ -96,7 +95,7 @@
         ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
         this.expression = expression;
         this.symbolTable = manager.createSymbolTable();
-        this.featureSymbolTable = new DefaultFeatureSymbolTable(
+        this.featureSymbolTable = new FeatureSymbolTableImpl(
 //                expression.getUserScript(), 
 //                expression.getScripts()
         );
@@ -140,14 +139,11 @@
     public EvaluatorFieldsInfo getFieldsInfo() {
         final Set<String> names = new HashSet<>();
         try {
-            this.expression.getCode().accept(new Visitor() {
-                @Override
-                public void visit(Object code) throws VisitCanceledException, BaseException {
-                    if (code instanceof Code.Identifier) {
-                        Code.Identifier identifier = (Code.Identifier) code;
-                        names.add(identifier.name());
-                    }
-                }
+            this.expression.getCode().accept((Object code) -> {
+              if (code instanceof Code.Identifier) {
+                Code.Identifier identifier = (Code.Identifier) code;
+                names.add(identifier.name());
+              }
             });
             EvaluatorFieldsInfo info = new EvaluatorFieldsInfo();
             for (String name : names) {
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/test/resources/org.gvsig.expressionevaluator/testData1.csv
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/test/resources/org.gvsig.expressionevaluator/testData1.csv	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/test/resources/org.gvsig.expressionevaluator/testData1.csv	(revision 44738)
@@ -0,0 +1,21 @@
+ID/Integer;Byte/Byte;Bool1/Boolean;Long/Long;Timestamp/TimeStamp;Date/Date;Time/Time;Bool2/Boolean;String/String/set/size=30;Bool3/Boolean;Double/Double;Bool4/Boolean;Float/Float;Bool5/Boolean;Decimal/Decimal/set/precision=6/set/scale=3
+ ;  ; ;    ;              ;        ;      ; ;      ; ;           ; ;      ;T;
+1;10;T;1000;20191229121314;20191229;121314;T;Yo yo1;F;12345.54321;T;123.21;T;456.123
+2;20;T;2000;20191129121314;20191129;131314;T;Yo yo2;F;12100.54321;T;100.21;T;456.123
+3;30;T;3000;20191029121314;20191029;141314;T;Yo yo3;F;12101.54321;T;101.21;T;456.123
+4;40;T;4000;20190929121314;20190929;151314;T;Yo yo4;F;12102.54321;T;102.21;T;456.123
+5;50;T;5000;20190829121314;20190829;161314;T;Yo yo5;F;12103.54321;T;103.21;T;456.123
+6;60;T;6000;20190729121314;20190729;171314;T;Yo yo6;F;12104.54321;T;104.21;T;456.123
+7;70;T;7000;20190629121314;20190629;181314;T;Yo yo7;F;12105.54321;T;105.21;T;456.123
+8;80;T;8000;20190529121314;20190529;191314;T;Yo yo8;F;12106.54321;T;106.21;T;456.123
+9;90;T;9000;20190429121314;20190429;201314;T;Yo yo9;F;12107.54321;T;107.21;T;456.123
+10; ;T;1001;20191229121314;20191229;121314;T;Yo yo1;F;12345.54321;T;123.21;T;456.123
+11;22; ;2002;20191129121314;20191129;131314;T;Yo yo2;F;12100.54321;T;100.21;T;456.123
+12;33;T; ;20190929121314;20191029;141314;T;Yo yo3;F;12101.54321;T;101.21;T;456.123
+12;41;T;4001; ;20190929;151314;T;Yo yo4;F;12102.54321;T;102.21;T;456.123
+14;52;T;5002;20190829121314; ;161314;T;Yo yo5;F;12103.54321;T;103.21;T;456.123
+15;63;T;6003;20190729121314;20190729; ;T;Yo yo6;F;12104.54321;T;104.21;T;456.123
+16;74;T;7004;20190629121314;20190629;181314;T; ;F;12105.54321;T;105.21;T;456.123
+17;85;T;8005;20190529121314;20190529;191314;T;Yo yo8;F; ;T;106.21;T;456.123
+18;96;T;9006;20190429121314;20190429;201314;T;Yo yo9;F;12107.54321;T; ;T;456.123
+19;97;T;1001;20191229121314;20191229;121314;T;Yo yo1;F;12345.54321;T;123.21;T;456.123
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/test/java/org/gvsig/expressionevaluator/TestGrammarCompiler.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/test/java/org/gvsig/expressionevaluator/TestGrammarCompiler.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/test/java/org/gvsig/expressionevaluator/TestGrammarCompiler.java	(revision 44738)
@@ -0,0 +1,251 @@
+package org.gvsig.expressionevaluator;
+
+import junit.framework.TestCase;
+import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+public class TestGrammarCompiler extends TestCase {
+
+    public TestGrammarCompiler(String testName) {
+        super(testName);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        new DefaultLibrariesInitializer().fullInitialize();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    // TODO add test methods here. The name must begin with 'test'. For example:
+    // public void testHello() {}
+    
+    protected LexicalAnalyzer createLexicalAnalyzer() {
+        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
+        LexicalAnalyzer lexer = manager.createLexicalAnalyzer();
+        return lexer;
+    }
+
+    protected org.gvsig.expressionevaluator.Compiler createCompiler() {
+        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
+        Compiler compiler = manager.createCompiler();
+        compiler.setLexicalAnalyzer(createLexicalAnalyzer());
+        return compiler;
+    }
+
+    protected SymbolTable createSymbolTable() {
+        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
+        MutableSymbolTable symbolTable = manager.createSymbolTable();
+        symbolTable.setVar("precio", 200);
+        symbolTable.setVar("1990", 0.168873933773767);
+        return symbolTable;
+    }
+
+    protected Interpreter createInterpreter(SymbolTable symbolTable) {
+        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
+        Interpreter interpreter = manager.createInterpreter();
+        interpreter.setSymbolTable(symbolTable);
+        return interpreter;
+    }
+    
+    private void link(Code code) {
+      code.link(createSymbolTable());
+    }
+
+    public void testSelect() {
+        StringBuilder source = new StringBuilder();
+        source.append("SELECT * FROM countries;");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        assertEquals("SELECT(TABLE:'countries')", code.toString());
+    }
+
+    public void testSelect2() {
+        StringBuilder source = new StringBuilder();
+        source.append("BEGIN ");
+        source.append("  SET X = 0; ");
+        source.append("  FOR row in (SELECT * FROM countries;) ");
+        source.append("    BEGIN ");
+        source.append("      IF row.LASTCENSUS > 0 THEN ");
+        source.append("        SET X = X + row.LASTCENSUS ");
+        source.append("      END IF ");
+        source.append("    END FOR ");
+        source.append("END");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        assertEquals("BLOCK(LET('X', 0), FOREACH('row', SELECT(TABLE:'countries'), IFF((\"row\".\"LASTCENSUS\" > 0), LET('X', (\"X\" + \"row\".\"LASTCENSUS\")))))", code.toString());
+    }
+
+    public void testSelectWhere() {
+        StringBuilder source = new StringBuilder();
+        source.append("SELECT * FROM countries  ");
+        source.append("  WHERE LASTCENSUS > 0;  ");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        assertEquals("SELECT(TABLE:'countries', WHERE:(\"LASTCENSUS\" > 0))", code.toString());
+    }
+
+    public void testSelectCountWhere() {
+        StringBuilder source = new StringBuilder();
+        source.append("SELECT COUNT(*) FROM countries  ");
+        source.append("  WHERE LASTCENSUS > 0 ; ");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        assertEquals("SELECT_COUNT(TABLE:'countries', WHERE:(\"LASTCENSUS\" > 0))", code.toString());
+    }
+
+    public void testSelectWhere2() {
+        StringBuilder source = new StringBuilder();
+        source.append("SELECT * FROM countries  ");
+        source.append("  WHERE countries.LASTCENSUS > 0 ; ");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        assertEquals("SELECT(TABLE:'countries', WHERE:(\"countries\".\"LASTCENSUS\" > 0))", code.toString());
+    }
+
+    public void testSelectOrder() {
+        StringBuilder source = new StringBuilder();
+        source.append("SELECT * FROM countries  ");
+        source.append("  ORDER BY CONTINENT ASC, LASTCENSUS DESC; ");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        assertEquals("SELECT(TABLE:'countries', ORDER1:\"CONTINENT\", ORDER2:\"LASTCENSUS\", ORDER_MODE1:TRUE, ORDER_MODE2:FALSE)", code.toString());
+    }
+
+    public void testSelectWhereOrder() {
+        StringBuilder source = new StringBuilder();
+        source.append("SELECT * FROM countries  ");
+        source.append("  WHERE LASTCENSUS > 0  ");
+        source.append("  ORDER BY ID ; ");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        assertEquals("SELECT(TABLE:'countries', WHERE:(\"LASTCENSUS\" > 0), ORDER1:\"ID\", ORDER_MODE1:TRUE)", code.toString());
+    }
+
+    public void testSelectWhereOrderLimit() {
+        StringBuilder source = new StringBuilder();
+        source.append("SELECT * FROM countries  ");
+        source.append("  WHERE LASTCENSUS > 0  ");
+        source.append("  ORDER BY LASTCENSUS DESC");
+        source.append("  LIMIT 3 ;");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        assertEquals("SELECT(TABLE:'countries', WHERE:(\"LASTCENSUS\" > 0), ORDER1:\"LASTCENSUS\", ORDER_MODE1:FALSE, LIMIT:3)", code.toString());
+    }
+
+    public void testSelectLimit() {
+        StringBuilder source = new StringBuilder();
+        source.append("SELECT * FROM countries  ");
+        source.append("  LIMIT 3; ");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        assertEquals("SELECT(TABLE:'countries', LIMIT:3)", code.toString());
+    }
+
+    public void testExists() {
+        StringBuilder source = new StringBuilder();
+        source.append("EXISTS(NULL)");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        String id = "????????????????????????????????";
+        String s = code.toString();
+        s = s.substring(0, s.length()-id.length()-2)+id+s.substring(s.length()-2);
+        assertEquals("EXISTS(NULL, '????????????????????????????????')", s);
+    }
+
+    public void testExistsSelect1() {
+        StringBuilder source = new StringBuilder();
+        source.append("EXISTS(");
+        source.append(" SELECT 1 FROM countries");
+        source.append("   WHERE countries.LASTCENSUS > 0 ; ");
+        source.append(")");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        String id = "????????????????????????????????";
+        String s = code.toString();
+        s = s.substring(0, s.length()-id.length()-2)+id+s.substring(s.length()-2);
+        assertEquals("EXISTS(SELECT(TABLE:'countries', WHERE:(\"countries\".\"LASTCENSUS\" > 0)), '????????????????????????????????')", s);
+    }
+
+    public void testExistsSelectLimit1() {
+        StringBuilder source = new StringBuilder();
+        source.append("EXISTS(");
+        source.append(" SELECT 1 FROM countries  ");
+        source.append("   WHERE countries.LASTCENSUS > 0  ");
+        source.append("   LIMIT 1; ");
+        source.append(")");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        String id = "????????????????????????????????";
+        String s = code.toString();
+        s = s.substring(0, s.length()-id.length()-2)+id+s.substring(s.length()-2);
+        assertEquals("EXISTS(SELECT(TABLE:'countries', WHERE:(\"countries\".\"LASTCENSUS\" > 0), LIMIT:1), '????????????????????????????????')", s);
+    }
+
+    public void testExistsSelectLimit2() {
+        // Sobre la tabla de continentes, para obtener la lista de continentes 
+        // que tienen paises sin censo.
+        // Filtramos continentes por un campo del pais.
+        StringBuilder source = new StringBuilder();
+        source.append("EXISTS(");
+        source.append(" SELECT 1 FROM countries");
+        source.append("   WHERE ");
+        source.append("     continents.NAME = countries.CONTINENT AND ");
+        source.append("     countries.LASTCENSUS < 0 ");
+        source.append("   LIMIT 1; ");
+        source.append(")");
+
+        Compiler compiler = createCompiler();
+
+        Code code = compiler.compileExpression(source.toString());
+        link(code);
+        String id = "????????????????????????????????";
+        String s = code.toString();
+        s = s.substring(0, s.length()-id.length()-2)+id+s.substring(s.length()-2);
+        assertEquals("EXISTS(SELECT(TABLE:'countries', WHERE:((\"continents\".\"NAME\" = \"countries\".\"CONTINENT\") AND (\"countries\".\"LASTCENSUS\" < 0)), LIMIT:1), '????????????????????????????????')", s);
+    }
+
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/pom.xml
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/pom.xml	(revision 44737)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/pom.xml	(revision 44738)
@@ -104,6 +104,11 @@
             <artifactId>org.gvsig.expressionevaluator.lib.api</artifactId>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.expressionevaluator.lib.impl</artifactId>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
 
