public class SparqlQuery extends SparqlElement
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
A |
static java.lang.String |
ANYVAR
Query keywords
|
static java.lang.String |
AS |
static java.lang.String |
ASTERIX |
static java.lang.String |
AVG |
static java.lang.String |
BASE |
static java.lang.String |
COUNT |
static java.lang.String |
DESCR |
static java.lang.String |
DISTINCT |
static java.lang.String |
EQ |
static java.lang.String |
FILTER |
static java.lang.String |
FROM |
static java.lang.String |
GRAPH |
static java.lang.String |
GROUPBY |
static java.lang.String |
GT |
static java.lang.String |
ISURI |
static java.lang.String |
LIMIT |
static java.lang.String |
LT |
static java.lang.String |
MAX |
static java.lang.String |
MIN |
static java.lang.String |
MINUS |
static java.lang.String |
NAMED |
static java.lang.String |
NE |
static java.lang.String |
NOTEXISTS |
static java.lang.String |
NSEP |
static java.lang.String |
NULL |
static java.lang.String |
OBJECT |
static java.lang.String |
OFFSET |
static java.lang.String |
ONTOLOGY |
static java.lang.String |
OPTIONAL |
static java.lang.String |
ORDERBY |
static java.lang.String |
PLUS |
static java.lang.String |
PREDICATE |
static java.lang.String |
PREFIX
Statement headings
|
static java.lang.String |
REDUCED |
static java.lang.String |
REGEX
Functions
|
static java.lang.String |
RS |
static java.lang.String |
SELECT |
static java.lang.String |
SERVICE |
static java.lang.String |
SUBJECT
RDF headings
|
static java.lang.String |
SUM |
static java.lang.String |
TUPLE |
static java.lang.String |
UCASE |
static java.lang.String |
UNION |
static java.lang.String |
WHERE |
Constructor and Description |
---|
SparqlQuery()
Create a new instance of SparqlQuery
|
Modifier and Type | Method and Description |
---|---|
boolean |
addBase(java.net.URI uri)
Add a new prefix URI for the query.
|
void |
addClause(java.lang.String key,
java.lang.Object value)
Add a new clause value, overwriting any existing one.
|
java.lang.String |
addFrom(SparqlTriple thisFrom)
Add a from statement URI.
|
java.lang.String |
addPrefix(java.lang.String pref,
java.net.URI uri)
Add a new prefix with prefix URI for the query.
|
java.lang.String |
addSelect(SparqlTriple thisSelect)
Add a select statement projection.
|
java.lang.String |
addSelect(SparqlTriple thisSelect,
SparqlWhere addTo)
Add a select statement projection.
|
java.lang.String |
addWhere(SparqlSubWhere thisWhere)
Add a new sub-where clause.
|
java.lang.String |
addWhere(SparqlTriple thisWhere)
Add a new where clause.
|
void |
changeClause(java.lang.String key,
java.lang.Object value)
Reset this additional clauses to empty and then add a new clause.
|
java.lang.String |
changeFrom(SparqlTriple thisFrom)
Reset this from statement to empty and then add a new from statement URI.
|
java.lang.String |
changePrefix(java.lang.String pref,
java.net.URI uri)
Reset the prefixes list to empty and then add a new prefix.
|
java.lang.String |
changeSelect(SparqlTriple thisSelect)
Reset this select statement to empty and then add a new statement projection.
|
java.lang.String |
changeWhere(SparqlSubWhere thisWhere)
Reset this where statement to empty and then add a new where sub-clause.
|
java.lang.String |
changeWhere(SparqlTriple thisWhere)
Reset this where statement to empty and then add a new where clause.
|
java.lang.String |
createQuery()
Concatenate the query description to create the query string.
|
java.util.HashMap<java.lang.String,java.lang.Object> |
getClauses()
Get the list of additional clauses.
|
static java.util.ArrayList<java.lang.String> |
getClauseTypes()
Get the clause type keywords.
|
SparqlElement |
getElement(java.lang.String elemID)
Get the element with the specified unique ID.
|
java.lang.String |
getEndpoint()
Get the endpoint for the query server.
|
static java.util.ArrayList<java.lang.String> |
getFilterFunctions(java.lang.String filterType)
Get any filter functions that can be applied to a filter type, including
ANYVAR '---'. |
static java.util.ArrayList<java.lang.String> |
getFilterTypes(java.lang.String clauseType)
Get the filter type keywords, including '*'.
|
SparqlFrom |
getFrom()
Get the from statement.
|
static java.util.ArrayList<java.lang.String> |
getKeywords()
Get the list of sparql keywords.
|
java.util.ArrayList<SparqlPrefix> |
getPrefixes()
Get the list of prefixes.
|
static java.util.ArrayList<java.lang.String> |
getRegexTypes()
Get the regular expression type keywords.
|
SparqlSelect |
getSelect()
Get the select statement, to add condition or other to it.
|
SparqlWhere |
getWhere()
Get the where clause, or null if not set.
|
static boolean |
isClauseType(java.lang.String keyword)
Return true if the keyword is a clause type word: DISTINCT, LIMIT, excluding '*'.
|
static boolean |
isFilterSPO(java.lang.String keyword)
Return true if the keyword is a filter type that allows subject-predicate-object: SUM, excluding '*'.
|
static boolean |
isFilterType(java.lang.String keyword)
Return true if the keyword is a filter type word: DISTINCT, NAMED, excluding '*'.
|
static boolean |
isFilterWithFunction(java.lang.String keyword)
Return true if the keyword is a filter that can have a function: FILTER.
|
static boolean |
isKeyword(java.lang.String keyword)
Return true if the keyword is a statement word.
|
static boolean |
isReservedWord(java.lang.String keyword)
Return true if the keyword is a reserved word of any type.
|
java.lang.String |
partToString()
Get a string-based description of this query component for info purposes only.
|
java.lang.String |
partToString(java.lang.String elemID)
Convert the element clauseType only into a string-based description.
|
java.lang.String |
queryString()
Get a string-based description of this query component.
|
boolean |
setEndpoint(java.net.URI uri)
Set the endpoint endpoint for the query server.
|
public static final java.lang.String PREFIX
public static final java.lang.String SELECT
public static final java.lang.String FROM
public static final java.lang.String SERVICE
public static final java.lang.String WHERE
public static final java.lang.String NAMED
public static final java.lang.String DISTINCT
public static final java.lang.String REDUCED
public static final java.lang.String OPTIONAL
public static final java.lang.String UNION
public static final java.lang.String FILTER
public static final java.lang.String NOTEXISTS
public static final java.lang.String MIN
public static final java.lang.String MAX
public static final java.lang.String AVG
public static final java.lang.String SUM
public static final java.lang.String COUNT
public static final java.lang.String MINUS
public static final java.lang.String LIMIT
public static final java.lang.String UCASE
public static final java.lang.String GROUPBY
public static final java.lang.String ORDERBY
public static final java.lang.String OFFSET
public static final java.lang.String BASE
public static final java.lang.String GRAPH
public static final java.lang.String DESCR
public static final java.lang.String REGEX
public static final java.lang.String ISURI
public static final java.lang.String ASTERIX
public static final java.lang.String PLUS
public static final java.lang.String ANYVAR
public static final java.lang.String NSEP
public static final java.lang.String A
public static final java.lang.String AS
public static final java.lang.String EQ
public static final java.lang.String NE
public static final java.lang.String LT
public static final java.lang.String GT
public static final java.lang.String NULL
public static final java.lang.String SUBJECT
public static final java.lang.String PREDICATE
public static final java.lang.String OBJECT
public static final java.lang.String ONTOLOGY
public static final java.lang.String TUPLE
public static final java.lang.String RS
public java.lang.String createQuery()
public java.lang.String partToString(java.lang.String elemID)
elemID
- the unique ID created when the element was created.public java.lang.String queryString()
queryString
in class SparqlElement
public java.lang.String partToString()
partToString
in class SparqlElement
public SparqlElement getElement(java.lang.String elemID)
getElement
in class SparqlElement
elemID
- the element id.public boolean setEndpoint(java.net.URI uri)
uri
- the endpoint address.public java.lang.String getEndpoint()
public boolean addBase(java.net.URI uri)
uri
- the prefix address.public java.lang.String addPrefix(java.lang.String pref, java.net.URI uri)
pref
- the prefix prefix.uri
- the prefix address.public java.lang.String changePrefix(java.lang.String pref, java.net.URI uri)
pref
- the prefix prefix.uri
- the prefix address.public java.util.ArrayList<SparqlPrefix> getPrefixes()
public java.lang.String addSelect(SparqlTriple thisSelect)
thisSelect
- the projection statement to add.public java.lang.String addSelect(SparqlTriple thisSelect, SparqlWhere addTo)
thisSelect
- the projection statement to add.addTo
- the where clause to add the select clause to.public java.lang.String changeSelect(SparqlTriple thisSelect)
thisSelect
- the projection statement to add.public SparqlSelect getSelect()
public java.lang.String addFrom(SparqlTriple thisFrom)
thisFrom
- the projection statement to add.public java.lang.String changeFrom(SparqlTriple thisFrom)
thisFrom
- the projection statement to add.public SparqlFrom getFrom()
public java.lang.String addWhere(SparqlTriple thisWhere)
thisWhere
- the where clause.public java.lang.String changeWhere(SparqlTriple thisWhere)
thisWhere
- the where clause.public java.lang.String addWhere(SparqlSubWhere thisWhere)
thisWhere
- the where clause.public java.lang.String changeWhere(SparqlSubWhere thisWhere)
thisWhere
- the where clause.public SparqlWhere getWhere()
public void addClause(java.lang.String key, java.lang.Object value)
key
- the clause name.value
- the clause value.public void changeClause(java.lang.String key, java.lang.Object value)
key
- the clause name.value
- the clause value.public java.util.HashMap<java.lang.String,java.lang.Object> getClauses()
public static boolean isReservedWord(java.lang.String keyword)
keyword
- the keyword to check.public static boolean isKeyword(java.lang.String keyword)
keyword
- the keyword to check.public static boolean isFilterType(java.lang.String keyword)
keyword
- the keyword to check.public static boolean isFilterSPO(java.lang.String keyword)
keyword
- the keyword to check.public static boolean isFilterWithFunction(java.lang.String keyword)
keyword
- the keyword to check.public static boolean isClauseType(java.lang.String keyword)
keyword
- the keyword to check.public static java.util.ArrayList<java.lang.String> getKeywords()
public static java.util.ArrayList<java.lang.String> getFilterTypes(java.lang.String clauseType)
clauseType
- the clause type to return for, SELECT, WHERE, for example.public static java.util.ArrayList<java.lang.String> getFilterFunctions(java.lang.String filterType)
ANYVAR
'---'.filterType
- the filter type, FILTER, for example.public static java.util.ArrayList<java.lang.String> getClauseTypes()
public static java.util.ArrayList<java.lang.String> getRegexTypes()