Module org.apache.jena.querybuilder
Interface ValuesClause<T extends AbstractQueryBuilder<T>>
- Type Parameters:
T
- The Builder type that the clause is part of.
- All Known Implementing Classes:
AbstractQueryBuilder
,AskBuilder
,ConstructBuilder
,DescribeBuilder
,SelectBuilder
,WhereBuilder
public interface ValuesClause<T extends AbstractQueryBuilder<T>>
Interface that defines the ValueClause as per
https://www.w3.org/TR/sparql11-query/#rValuesClause
Conceptually this the values clause constructs a table comprising columns
named by variables and rows of data for those columns. Most of the methods
specified here add variable columns and/or add values for them.
The order that variables are added to the table is retained.
-
Method Summary
Modifier and TypeMethodDescriptionaddValueRow
(Object... values) Add objects as a row of values.addValueRow
(Collection<?> values) Add a collection of objects as row of values.addValueVar
(Object var) Add a variable or variable and values to the value statement.addValueVar
(Object var, Object... values) Add a variable and values to the value statement.<K extends Collection<?>>
TaddValueVars
(Map<?, K> dataTable) Add a data table to the value statement.Reset the values table to the initial undefined state.Get the value handler for this clause.Get an unmodifiable map of vars and their values.List<org.apache.jena.sparql.core.Var>
Get an unmodifiable list of vars in the order that they appear in the values table.
-
Method Details
-
getValuesHandler
ValuesHandler getValuesHandler()Get the value handler for this clause.- Returns:
- The ValueHandler this clause is using.
-
addValueVar
Add a variable or variable and values to the value statement. The first var (or first item in a collection) is converted to a variable using the makeVar strategy. A variable may be added multiple times, doing so will append values to the list of variable values. The order in which variables are added to the values table is preserved. Adding a collection as the var will use the first object in the collection as the var and the remaining objects as values. Values are created using makeNode() strategy except that null values are converted to UNDEF.- Parameters:
var
- The variable or collection to add.- Returns:
- The builder for chaining.
- See Also:
-
addValueVar
Add a variable and values to the value statement. The var is converted to a variable using the makeVar strategy. A variable may be added multiple times, doing so will append values to the list of variable values. The order in which variables are added to the values table is preserved. Values are created using makeNode() strategy except that null values are converted to UNDEF.- Parameters:
var
- The variable to add.values
- The values for the variable- Returns:
- The builder for chaining.
- See Also:
-
addValueVars
Add a data table to the value statement. Each key in the map is used converted into a variable using the makeVar strategy. The order in which variables are added to the values table is preserved. Each item in the value collection is converted into a node using makeNode() strategy except that null values are converted to UNDEF. If there are already values in the value statement the data table is adds as follows:- If the variable already exists in the table the map values are appended to the list of values
- If the variable does not exist in the table and there are other variables defined, an appropriate number of nulls is added to the front of the map values to create UNDEF entries for the existing rows
- If there are variables in the value statement that are not specified in the map additional UNDEF entries are appended to them to account for new rows that are added.
- Parameters:
dataTable
- The data table to add.- Returns:
- The builder for chaining.
- See Also:
-
addValueRow
Add objects as a row of values. This method is different from the other methods in that the values are appended to each of the variables in the clause. There must be sufficient entries in the list to provide data for each variable in the table. Values objects are converted to nodes using the makeNode strategy. Variables will always be in the order added to the values table.- Parameters:
values
- the collection of values to add.- Returns:
- The builder for chaining.
- See Also:
-
addValueRow
Add a collection of objects as row of values. This method is different from the other methods in that the values are appended to each of the variables in the clause. There must be sufficient entries in the list to provide data for each variable in the table. Values objects are converted to nodes using the makeNode strategy. Variables will always be in the order added to the values table.- Parameters:
values
- the collection of values to add.- Returns:
- The builder for chaining.
- See Also:
-
clearValues
T clearValues()Reset the values table to the initial undefined state. Used primarily to reset the builder values table to a known state.- Returns:
- The builder for chaining.
-
getValuesVars
List<org.apache.jena.sparql.core.Var> getValuesVars()Get an unmodifiable list of vars in the order that they appear in the values table.- Returns:
- an unmodifiable list of vars.
-
getValuesMap
Get an unmodifiable map of vars and their values. Null values are considered as UNDEF values.- Returns:
- an unmodifiable map of vars and their values.
-