Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2009 Mysema Ltd.
  * All rights reserved.
  * 
  */
 package com.mysema.rdfbean.sesame.query;
 
import  org.openrdf.query.algebra.Bound;
import  org.openrdf.query.algebra.Not;
import  org.openrdf.query.algebra.ValueExpr;
import  org.openrdf.query.algebra.Var;
IsNullTransformer provides

Author(s):
tiwe
Version:
$Id$
public class IsNullTransformer implements OperationTransformer{
    @Override
    public Collection<? extends Operator<?>> getSupportedOperations() {
        return Arrays.<Operator<?>>asList(..);
    }
    @SuppressWarnings("unchecked")
    @Override
    public ValueExpr transform(Operation<?, ?> operationTransformerContext context) {
        if (operation.getArg(0) instanceof Path){
            Var arg = context.toVar((Path)operation.getArg(0));
            if (operation.getOperator() == .){
                return new Not(new Bound(arg));
                
            }else{
                return new Bound(arg);
            }
            
        }else{
            throw new IllegalArgumentException(operation.toString());
        }
        
    }
New to GrepCode? Check out our FAQ X