Variable var = VariableFactory.newVariable( ObjectReferenceType.getInstance(), o );
Variable var = new ObjectReferenceVariable( o );
    public Variable evaluateSelectExpression( SelectExpression se, Context c ) throws LemRuntimeException {        metamodel.Class selectedClass = se.getSelectedClass() ;        RelatedToOperation rto = se.getRelatedToOperation() ;        Expression condition = se.getCondition();        SetVariable set = new SetVariable() ;	Collection list = new LinkedList();        	Context tmp = c;        while (tmp.getParent() != null)		tmp = tmp.getParent();	DomainContext domainContext = (DomainContext)tmp;		        synchronized ( domainContext ) {            Collection objectList = domainContext.getObjectList();                            for ( Iterator i = objectList.iterator(); i.hasNext(); ) {                runtime.Object o = ( runtime.Object ) i.next();                                    for (Iterator j = o.getInstances().iterator(); j.hasNext();) {                    Instance instance = ( Instance ) j.next();                                            if ( instance.getInstanceClass() == selectedClass ) {                        Variable var = VariableFactory.newVariable( ObjectReferenceType.getInstance(), o );                        boolean goodVariable = true;                                                    if ( condition != null ) {                            Variable result;                            Context newContext = new LocalContext( c ) ;                            newContext.addVariable( "selected" , var ) ;                            result = evaluateExpression(condition, newContext);                            if ( result instanceof BooleanVariable ) {                                if (!((Boolean) ((BooleanVariable) result).getValue()).booleanValue()) {                                    goodVariable = false;                                }                            } else {                                throw new LemRuntimeException( "Not a Boolean Expression." ) ;                            }			    newContext.finish() ;                        }                                                    if ( goodVariable && rto != null ) {                            Relationship r = rto.getRelationship() ;                            metamodel.Class relatedClass = rto.getRelatedClass() ;                            metamodel.Class instanceClass = instance.getInstanceClass() ;                            HashMap associations = instanceClass.getAssociations() ;                            if ( ! ( associations.containsKey( r.getName() ) &&                                    ( ( metamodel.Class ) associations.get( r.getName() ) ).getName().equals( relatedClass.getName() ) ) ) {                                goodVariable = false;                            }                        }                                                    if ( goodVariable ) {                            set.addToSet( var ) ;                            list.add(((runtime.Object)var.getValue()).getObjectId());                        }                    }                }            }        }                System.out.println( Thread.currentThread().getName() + " selected " + ((LinkedList)set.getValue()).size() + " references" );        new LemSelectionEvent(expressionToString(condition), list).notifyAll( c );        return set;    }