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

## com.franz.agbase
Class PrologSelectQuery

    java.lang.Object
      QueryBase
          com.franz.agbase.PrologSelectQuery

    public class PrologSelectQuery

extends QueryBase

This class collects the parameters and results of a query posed in a restricted version of Allegro Prolog. A query is composed of two main components, the variables for which bindings are requested, and the body of the query which consists of Allegro Prolog clauses. The variables are used to form a flat list template (see the documentation for select and friends in the AllegroGraph Lisp documentation).

Constructor Summary
`PrologSelectQuery()` Create a fresh Proloq query holder.

Method Summary
`void` | `bind(java.lang.String var, java.lang.Object val)` Add a pre-set binding to the query.
`long` | `count()` Run the query and count the results.
`long` | `count(AllegroGraph ag)` Run the query in the specified triple store.
`long` | `count(AllegroGraph ag, java.lang.String[] vars, java.lang.String newQuery)`
`long` | `count(java.lang.String[] vars, java.lang.String newQuery)` Run the specified query.
`int` | `getHasValue()` Query the hasValue option.
`long` | `getLimit()`
`java.lang.String` | `getQuery()`
`ValueSetIterator` | `getResult()` Retrieve the result of the last query.
`AGBase` | `getTripleStore()`
`java.lang.String[]` | `getVariables()` Query the names of the variables returned in each result set.
`boolean` | `isDistinct()` Query the Distinct option on the query.
`boolean` | `isIncludeInferred()`
`java.lang.Boolean` | `isRemoveRTF()` Query the state of the `:remove-redundant-type-filters` planner option on the query.
`java.lang.Boolean` | `isReorder()` Query the state of the `:reorder` planner option on the query.
`boolean` | `isSavedPlan()` Query the state of a saved plan for this query.
`java.lang.Boolean` | `isUseMaps()` Query the state of the `:use-maps` planner option on the query.
`java.lang.Boolean` | `isUseTransforms()` Query the state of the `:use-transforms` planner option on the query.
`boolean` | `preparePlan()` Prepare a plan for this query.
`ValueSetIterator` | `run()` Run the query and collect the results.
`ValueSetIterator` | `run(AllegroGraph ag)` Run the query in the specified triple store.
`ValueSetIterator` | `run(AllegroGraph ag, java.lang.String[] vars, java.lang.String newQuery)`
`ValueSetIterator` | `run(AllegroGraph ag, java.lang.String var, java.lang.String newQuery)`
`ValueSetIterator` | `run(java.lang.String[] vars, java.lang.String newQuery)` Run the specified query.
`ValueSetIterator` | `run(java.lang.String var, java.lang.String newQuery)`
`boolean` | `runAndSavePlan()` Run the query and save the plan for later re-use.
`ValueSetIterator` | `runPlan()` Run a previously saved plan.
`void` | `setDistinct(boolean onoff)` Set the Distinct option on the query.
`void` | `setHasValue(boolean v)` Enable or disable hasValue reasoning.
`void` | `setIncludeInferred(boolean includeInferred)`
`void` | `setLimit(long limit)`
`void` | `setQuery(java.lang.String newQuery)`
`void` | `setQuery(java.lang.String[] vars, java.lang.String query)` Set the result template and clauses of the query with one call.
`void` | `setQuery(java.lang.String var, java.lang.String query)` Set the result template and clauses of the query with one call.
`void` | `setRemoveRTF(java.lang.Boolean removeRTF)` Set the state of the `:remove-redundant-type-filters` planner option on the query.
`void` | `setReorder(java.lang.Boolean reorder)` Set the state of the `:reorder` planner option on the query.
`void` | `setTripleStore(AllegroGraph ag)`
`void` | `setUseMaps(java.lang.Boolean useMaps)` Set the state of the `:use-maps` planner option on the query.
`void` | `setUseTransforms(java.lang.Boolean useTransforms)` Set the state of the `:use-transforms` planner option on the query.
`void` | `setVariables(java.lang.String vars)` Set the template of values desired in each result set.
`void` | `setVariables(java.lang.String[] vars)` Set the template of values desired in each result set.
`java.lang.String` | `showPlan()` Return a string containing a description of the query plan.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PrologSelectQuery

    public PrologSelectQuery()

  Create a fresh Proloq query holder. Before it can be used, the variables, query and triple store must be set.

Method Detail

### bind

    public void bind(java.lang.String var,
                     java.lang.Object val)

  Add a pre-set binding to the query. This binding turns a variable in the query into a constant when the query is presented to the triple store.

  Parameters:
    `var` - The name of a variable (with or without the leading ?). A null value removes all the variable bindings.
    `val` - The value for this variable may be a ValueNode instance, a UPI, or a string in Ntriples notation. A null value removes the variable from the list.

### isIncludeInferred

    public boolean isIncludeInferred()

### setIncludeInferred

    public void setIncludeInferred(boolean includeInferred)

### getHasValue

    public int getHasValue()

  Query the hasValue option. When true, hasValue reasoning is enabled.

  Returns:
    1 if true, 0 if false, -1 if unspecified (ie server default)

### setHasValue

    public void setHasValue(boolean v)

  Enable or disable hasValue reasoning. This option is in effect only if reasoning is ebabled.

  Parameters:
    `v` - true or false

### getTripleStore

    public AGBase getTripleStore()

### getQuery

    public java.lang.String getQuery()

### setQuery

    public void setQuery(java.lang.String newQuery)

### setQuery

    public void setQuery(java.lang.String[] vars,
                         java.lang.String query)

  Set the result template and clauses of the query with one call.

  Parameters:
    `vars` - the variable names to appear in the result template
    `query` - the clauses in the body of the query

### setQuery

    public void setQuery(java.lang.String var,
                         java.lang.String query)

  Set the result template and clauses of the query with one call.

  Parameters:
    `var` - the single variable name to appear in the result template
    `query` - the clauses in the body of the query

### setTripleStore

    public void setTripleStore(AllegroGraph ag)

### isDistinct

    public boolean isDistinct()

  Query the Distinct option on the query.

  Returns:
    when true, the query will return only the unique sets of results. When false, the results may include some duplicates.

### setDistinct

    public void setDistinct(boolean onoff)

  Set the Distinct option on the query.

  Parameters:
    `onoff` - when true, the query will return only the unique sets of results. When false, the results may include some duplicates.

### getLimit

    public long getLimit()

### setLimit

    public void setLimit(long limit)

### getVariables

    public java.lang.String[] getVariables()

  Query the names of the variables returned in each result set.

  Returns:
    an array of variable names (as previously supplied)

### setVariables

    public void setVariables(java.lang.String[] vars)

  Set the template of values desired in each result set.

  Parameters:
    `vars` - an array of variable names.

### setVariables

    public void setVariables(java.lang.String vars)

  Set the template of values desired in each result set.

  Parameters:
    `vars` - A string containing variable names separated by spaces.

### run

    public ValueSetIterator run()
                         throws AllegroGraphException

  Run the query and collect the results.

  Returns:
    a ValueSetIterator instance that will iterate through the results.
  Throws:
    `AllegroGraphException`

### getResult

    public ValueSetIterator getResult()

  Retrieve the result of the last query.

  Returns:
    Return the ValueSetIterator instance or null if the query result is not available.

### run

    public ValueSetIterator run(AllegroGraph ag)
                         throws AllegroGraphException

  Run the query in the specified triple store.

  Parameters:
    `ag` - the AllegroGraph instance where the query should run. This instance is remembered in the PrologSelectQuery instance.
  Returns:
    see `run()`
  Throws:
    `AllegroGraphException`

### run

    public ValueSetIterator run(java.lang.String[] vars,
                                java.lang.String newQuery)
                         throws AllegroGraphException

  Run the specified query.

  Parameters:
    `vars` - the variable names to appear in the result template
    `newQuery` - the clauses in the body of the query
  Returns:
    see `run()`
  Throws:
    `AllegroGraphException`

### run

    public ValueSetIterator run(java.lang.String var,
                                java.lang.String newQuery)
                         throws AllegroGraphException

  Throws:
    `AllegroGraphException`

### run

    public ValueSetIterator run(AllegroGraph ag,
                                java.lang.String[] vars,
                                java.lang.String newQuery)
                         throws AllegroGraphException

  Throws:
    `AllegroGraphException`

### run

    public ValueSetIterator run(AllegroGraph ag,
                                java.lang.String var,
                                java.lang.String newQuery)
                         throws AllegroGraphException

  Throws:
    `AllegroGraphException`

### isReorder

    public java.lang.Boolean isReorder()
                                throws AllegroGraphException

  Query the state of the `:reorder` planner option on the query.

  Returns:
    true or false. Return null if the option has not been set and the server default cannot be determined.
  Throws:
    `AllegroGraphException`

### setReorder

    public void setReorder(java.lang.Boolean reorder)

  Set the state of the `:reorder` planner option on the query.

  Parameters:
    `reorder` - True or false. A null value reverts to the built-in default in the server.

### isUseMaps

    public java.lang.Boolean isUseMaps()
                                throws AllegroGraphException

  Query the state of the `:use-maps` planner option on the query.

  Returns:
    true or false. Return null if the option has not been set and the server default cannot be determined.
  Throws:
    `AllegroGraphException`

### setUseMaps

    public void setUseMaps(java.lang.Boolean useMaps)

  Set the state of the `:use-maps` planner option on the query.

  Parameters:
    `useMaps` - True or false. A null value reverts to the built-in default in the server.

### isUseTransforms

    public java.lang.Boolean isUseTransforms()
                                      throws AllegroGraphException

  Query the state of the `:use-transforms` planner option on the query. Return null if the option has not been set and the server default cannot be determined.

  Returns:
    true or false.
  Throws:
    `AllegroGraphException`

### setUseTransforms

    public void setUseTransforms(java.lang.Boolean useTransforms)

  Set the state of the `:use-transforms` planner option on the query.

  Parameters:
    `useTransforms` - True or false. A null value reverts to the built-in default in the server.

### isRemoveRTF

    public java.lang.Boolean isRemoveRTF()
                                  throws AllegroGraphException

  Query the state of the `:remove-redundant-type-filters` planner option on the query.

  Returns:
    true or false. Return null if the option has not been set and the server default cannot be determined.
  Throws:
    `AllegroGraphException`

### setRemoveRTF

    public void setRemoveRTF(java.lang.Boolean removeRTF)

  Set the state of the `:remove-redundant-type-filters` planner option on the query.

  Parameters:
    `removeRTF` - True or false. A null value reverts to the built-in default in the server.

### runAndSavePlan

    public boolean runAndSavePlan()
                           throws AllegroGraphException

  Run the query and save the plan for later re-use.

  Returns:
    true if the plan was made and saved. False if the plan failed for some reason.

    The results of the query are obtained by calling getResult().

  Throws:
    `AllegroGraphException`

### count

    public long count()
               throws AllegroGraphException

  Run the query and count the results. The actual results are never collected.

  Returns:
    the number of result sets found.
  Throws:
    `AllegroGraphException`

### count

    public long count(AllegroGraph ag)
               throws AllegroGraphException

  Run the query in the specified triple store. The actual results are never collected.

  Parameters:
    `ag` - the AllegroGraph instance where the query should run. This instance is remembered in the PrologSelectQuery instance.
  Returns:
    the number of result sets found.
  Throws:
    `AllegroGraphException`

### count

    public long count(java.lang.String[] vars,
                      java.lang.String newQuery)
               throws AllegroGraphException

  Run the specified query. The actual results are never collected.

  Parameters:
    `vars` - the variable names to appear in the result template. Since the results are not actually collected, this argument may be null.
    `newQuery` - the clauses in the body of the query
  Returns:
    the number of result sets found.
  Throws:
    `AllegroGraphException`

### count

    public long count(AllegroGraph ag,
                      java.lang.String[] vars,
                      java.lang.String newQuery)
               throws AllegroGraphException

  Throws:
    `AllegroGraphException`

### isSavedPlan

    public boolean isSavedPlan()

  Query the state of a saved plan for this query.

  Returns:
    true if there is a plan that can be used.

### showPlan

    public java.lang.String showPlan()
                              throws AllegroGraphException

  Return a string containing a description of the query plan.

  Throws:
    `AllegroGraphException`

### preparePlan

    public boolean preparePlan()
                        throws AllegroGraphException

  Prepare a plan for this query.

  Returns:
    true if the plan was prepared. Return false if the plan preparation failed.
  Throws:
    `AllegroGraphException`

### runPlan

    public ValueSetIterator runPlan()
                             throws AllegroGraphException

  Run a previously saved plan.

  Returns:
    the results
  Throws:
    `AllegroGraphException`

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