Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.hp.hpl.jena.graph.query
Interface Expression

All Known Implementing Classes:
  Dyadic, Expression.Application, Expression.Base, Expression.BoolConstant, Expression.Constant, Expression.Fixed, Expression.Variable, Rewrite.DyadicLiteral

    public interface Expression

Expression - the interface for expressions that is expected by Query for constraints. An Expression can be evaluated (given a name->value mapping); it can be prepared into a Valuator (given a name->index mapping); and it can be analysed into its components.

An Expression can be a variable, an application, or a literal value. If an access method (eg getName) is applied to an Expression for which it is not appropriate (eg an application), the result is unspecified; an implementation is free to throw an exception, deliver a null result, deliver a misleading value, whatever is convenient.

The nested class `Util` provides some expression utility methods, including a generic version of `prepare`. The nested abstract class `Base` and its sub-classes `Literal`, `Variable`, and `Application` provide a framework for developers to implement Expressions over.

Author:
  kers

Nested Class Summary
`static class` | `Expression.Application` An abstract base class for apply nodes; subclasses implement getFun(), argCount(), and getArg().
`static class` | `Expression.Base` An abstract base class for Expressions; over-ride as appropriate.
`static class` | `Expression.BoolConstant` Base class used to implement `TRUE` and `FALSE`.
`static class` | `Expression.Constant` An abstract base class for literal nodes; subclasses implement getValue().
`static class` | `Expression.Fixed` A concrete class for representing fixed constants; each instance can hold a separate value and its valuator returns that value.
`static class` | `Expression.Util` Utility methods for Expressions, captured in a class because they can't be written directly in the interface.
`static class` | `Expression.Valof` Valof provides an implementation of VariableValues which composes the "compile-time" VariableIndexes map with the "run-time" IndexValues map to produce a VariableValues map.
`static class` | `Expression.Variable` An abstract base class for variable nodes; subclasses implement getName().

Field Summary
`static Expression` | `FALSE` An Expression which always evaluates to `false`.
`static Expression` | `TRUE` An Expression which always evaluates to `true`.

Method Summary
`int` | `argCount()` If this Expression is an application, answer the number of arguments that it has.
`Expression` | `getArg(int i)` If this Expression is an application, and 0 <= i < argCount(), answer the `i`th argument.
`java.lang.String` | `getFun()` If this Expression is an application, return the string identifying the function, which should be a URI.
`java.lang.String` | `getName()` If this Expression is a variable, answer a [non-null] String which is its name.
`java.lang.Object` | `getValue()` If this Expression is a literal, answer the value of that literal.
`boolean` | `isApply()` Answer true iff this Expression represents the application of some function [or operator] to some arguments [or operands].
`boolean` | `isConstant()` Answer true iff this Expression represents a literal [Java object] value.
`boolean` | `isVariable()` Answer true iff this Expression represents a variable.
`Valuator` | `prepare(VariableIndexes vi)` Answer a Valuator which, when run with a set of index-to-value bindings, evaluates this expression in the light of the given variable-to-index bindings [ie as though the variables were bound to the corresponding values]

Field Detail

### TRUE

    static final Expression TRUE

  An Expression which always evaluates to `true`.

### FALSE

    static final Expression FALSE

  An Expression which always evaluates to `false`.

Method Detail

### prepare

    Valuator prepare(VariableIndexes vi)

  Answer a Valuator which, when run with a set of index-to-value bindings, evaluates this expression in the light of the given variable-to-index bindings [ie as though the variables were bound to the corresponding values]

### isVariable

    boolean isVariable()

  Answer true iff this Expression represents a variable.

### getName

    java.lang.String getName()

  If this Expression is a variable, answer a [non-null] String which is its name. Otherwise the behaviour is unspecified.

### isConstant

    boolean isConstant()

  Answer true iff this Expression represents a literal [Java object] value.

### getValue

    java.lang.Object getValue()

  If this Expression is a literal, answer the value of that literal. Otherwise the behaviour is unspecified.

### isApply

    boolean isApply()

  Answer true iff this Expression represents the application of some function [or operator] to some arguments [or operands].

### getFun

    java.lang.String getFun()

  If this Expression is an application, return the string identifying the function, which should be a URI. Otherwise the behaviour is unspecified.

### argCount

    int argCount()

  If this Expression is an application, answer the number of arguments that it has. Otherwise the behaviour is unspecified.

### getArg

    Expression getArg(int i)

  If this Expression is an application, and 0 <= i < argCount(), answer the `i`th argument. Otherwise the behaviour is unspecified.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP