public class SparqlRequest extends AbstractSparqlRequest implements java.io.Serializable
additionalVars, askForm, binds, coalesces, deleteForms, filters, insertForms, iris, selectForm, variables, whereFormLABEL, SUBCLASS_OF, SUBCLASS_OF_STAR, TYPE, TYPE_SUBCLASS_OFDISTANCE_FT, DISTANCE_KM, DISTANCE_M, DISTANCE_NM| Constructor and Description |
|---|
SparqlRequest(SparqlRequest parent)
Constructor.
|
SparqlRequest(java.lang.String prefix)
Constructor.
|
SparqlRequest(java.lang.String prefix,
boolean checkVarsExistence)
Constructor.
|
SparqlRequest(java.lang.String prefix,
boolean checkVarsExistence,
char prefixInclusionType)
Constructor.
|
SparqlRequest(java.lang.String prefix,
boolean checkVarsExistence,
SparqlPrefixDeclarations prefixDecl)
Constructor.
|
SparqlRequest(java.lang.String prefix,
char prefixInclusionType)
Constructor.
|
SparqlRequest(java.lang.String prefix,
SparqlPrefixDeclarations prefixDecl)
Constructor.Variables existence check will be performed.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addAdditionalVariable(java.lang.String varName)
Add an additional variable in the query.
|
boolean |
addAdditionalVariable(Variable var)
Add an additional variable in the query.
|
java.lang.String |
addAutoVariable(java.lang.String radix)
Add an additional variable in the query with a name chosen automatically.
|
Bind |
addBind()
Add a bind.
|
Bind |
addBind(java.lang.String var)
Add a bind.
|
Coalesce |
addCoalesce()
Add a coalesce.
|
boolean |
addDistance(java.lang.String var,
java.lang.String fromVar,
java.lang.String varDist,
short unit,
boolean isExact)
Add a distance property reference declaration in the WHERE part of the request.
|
boolean |
addDistance(java.lang.String var,
java.lang.String fromVar,
java.lang.String varDist,
short unit,
boolean isExact,
boolean optional)
Add a distance property reference declaration in the WHERE part of the request.
|
Filter |
addFilter()
Add a filter.
|
boolean |
addGeometry(java.lang.String var,
java.lang.String varLat,
java.lang.String varLon,
boolean isExact)
Add an object property reference declaration in the WHERE part of the request.
|
boolean |
addGeometry(java.lang.String var,
java.lang.String varLat,
java.lang.String varLon,
boolean isExact,
boolean optional)
Add a geometry declaration in the WHERE part of the request.
|
SparqlRequest |
addInnerQuery()
Add an inner query.
|
boolean |
addLabel(java.lang.String var,
TripleElement type)
Add a rdfs:label matching declaration in the WHERE part of the request.
|
SparqlRequestGroup |
addOptionalConstruct()
Add an OPTIONAL construct with multiple expressions.
|
boolean |
addPropertyIndividualRef(java.lang.String var,
TripleElement type,
java.lang.String individual,
boolean optional)
Add an object property individual declaration in the WHERE part of the request.
|
boolean |
addPropertyRef(java.lang.String var,
TripleElement type,
java.lang.String varRef,
boolean optional)
Add an object property reference declaration in the WHERE part of the request.
|
boolean |
addPropertyRef(VariableOrIRI varOrIRI,
TripleElement type,
VariableOrIRI varOrIRIRef,
boolean optional)
Add an object property reference declaration in the OPTIONAL construct.
|
boolean |
addPropertyValue(java.lang.String var,
TripleElement type,
java.lang.Object propertyValue,
boolean optional)
Add a property value declaration in the WHERE part of the request.
|
boolean |
addPropertyValues(java.lang.String var,
TripleElement type,
java.util.List<? extends java.lang.Object> propValues,
boolean optional)
Add a property value declaration in the WHERE part of the request, for several values.
|
boolean |
addSelect(Expression expr,
java.lang.String asVar)
Add an expression to use for the SELECT part of the Sparql request.
|
boolean |
addSelect(SelectExpression selectExpr)
Add an expression to use for the SELECT part of the Sparql request.
|
boolean |
addSelect(java.lang.String... vars)
Add several variables to use for the SELECT part of the Sparql request.
|
boolean |
addSelect(java.lang.String var)
Add a variable to use for the SELECT part of the Sparql request.
|
Variable |
addSelectVariable(SelectExpression selectExpr)
Add a variable for a select expression.
|
boolean |
addSubClassOf(java.lang.String var,
TripleElement type)
Add a rdfs:subClassOf matching declaration in the WHERE part of the request.
|
boolean |
addSubClassOfStar(java.lang.String var,
TripleElement type)
Add a rdfs:subClassOf* matching declaration in the WHERE part of the request.
|
boolean |
addTime(java.lang.String var,
java.lang.String varTime,
boolean isDateTime)
Add a time declaration in the WHERE part of the request.
|
boolean |
addTime(java.lang.String var,
java.lang.String varTime,
boolean isDateTime,
boolean optional)
Add a time declaration in the WHERE part of the request.
|
boolean |
addType(java.lang.String var,
short exprKind,
TripleElement type)
Add a matching declaration in the WHERE part of the request.
|
boolean |
addType(java.lang.String var,
TripleElement type)
Add a rdf:type matching declaration in the WHERE part of the request.
|
boolean |
addType(VariableOrIRI varOrIRI,
TripleElement type)
Add a rdf:type matching declaration in the WHERE part of the request.
|
boolean |
addTypeSubClassOf(java.lang.String var,
TripleElement type)
Add a rdf:type/rdfs:subClassOf matching declaration in the WHERE part of the request.
|
Union |
addUnionConstruct()
Add an UNION construct with multiple expressions.
|
boolean |
addVariableSubClassOf(java.lang.String var,
TripleElement typeVar)
Add a rdfs:subClassOf matching declaration in the WHERE part of the request.
|
boolean |
addVariableSubClassOfStar(java.lang.String var,
TripleElement typeVar)
Add a rdfs:subClassOf* matching declaration in the WHERE part of the request.
|
boolean |
addVariableType(java.lang.String var,
short exprKind,
TripleElement typeVar)
Add a matching declaration in the WHERE part of the request.
|
boolean |
addVariableType(java.lang.String var,
TripleElement element)
Add a rdf:type matching declaration in the WHERE part of the request.
|
boolean |
addVariableTypeSubClassOf(java.lang.String var,
TripleElement typeVar)
Add a rdf:type/rdfs:subClassOf matching declaration in the WHERE part of the request.
|
boolean |
checkValidity()
Check the validity of the SPARQL expression.
|
static SparqlRequest |
createRequest(java.lang.String prefix,
java.lang.String requestAsString) |
static java.util.List<? extends java.lang.Object> |
createValuesList(java.lang.Object... values)
Creates a list of values.
|
Variable |
createVariable(java.lang.String name)
Create a variable with a specified name.
|
boolean |
existsVariable(java.lang.String varName)
Return true if a variable exists.
|
java.lang.String |
getDefaultPrefix()
Return the default prefix.
|
WhereForm |
getEffectiveWhereForm()
Return the effective WHERE form.
|
java.util.List<java.lang.String> |
getGroupBy()
Return the GROUP BY declaration.
|
java.util.List<SparqlRequest> |
getInnerQueries()
Return the inner queries.
|
int |
getLimit()
Return the LIMIT of the number of results.
|
int |
getOffset()
Return the OFFSET of the number of results.
|
java.util.List<SparqlRequestGroup> |
getOptionals()
Return the list of optional groups in this request.
|
Expression |
getOrderBy()
Return the limit of the number of results.
|
char |
getOrderByType()
Return the ORDER BY type.
|
Variable |
getPreferredVariable()
Return the preferred variable.
|
java.lang.String |
getPreferredVariableName()
Return the preferred variable name.
|
SparqlPrefixDeclarations |
getPrefixDeclarations()
Return the prefix declarations.
|
SparqlRequest |
getRootRequest()
Return the top level request.
|
java.util.List<SelectItem> |
getSelectList()
Return the list of SELECT items.
|
java.util.Map<java.lang.String,SelectItem> |
getSelectMap()
Return the map of SELECT items.
|
java.lang.String |
getSPARQL()
Return the constructed sparql request.
|
java.util.List<Union> |
getUnions()
Return the list of unions in this request.
|
boolean |
hasInnerQueries()
Returen true if there are inner queries.
|
boolean |
hasSelectVariable(java.lang.String var)
Return true if a variable is added in the SELECT.
|
boolean |
hasUnions()
Return true if there are unions in this request.
|
boolean |
isCheckingVariablesExistence()
Return true if the variables existence if checked during the creation of the request.
|
boolean |
isLoggingErrors()
Return true if errors should be logged by the framework.
|
boolean |
isSelect(java.lang.String var)
Return true if a variable is in the SELECT list of variables.
|
boolean |
isSelectAll()
Return true if SELECT * is set.
|
boolean |
isSelectDistinct()
Return true if the SELECT expression should be SELECT DISTINCT.
|
void |
logErrors(boolean logErrors)
Set if errors should be logged by the framework.
|
void |
resetSPARQLResult() |
void |
selectDistinct(boolean selectDistinct)
Set if the SELECT expression should be SELECT DISTINCT.
|
void |
setGroupBy(java.util.List<java.lang.String> groupBy)
Set the GROUP BY declaration.
|
void |
setGroupBy(java.lang.String... groupBy)
Set the GROUP BY declaration.
|
void |
setLimit(int limit)
Set the limit of the number of results.
|
void |
setOffset(int offset)
Set the OFFSET of the number of results.
|
void |
setOrderBy(Expression orderBy)
Set the ORDER BY declaration.
|
void |
setOrderBy(Expression orderBy,
boolean isAscending)
Set the ORDER BY declaration.
|
void |
setOrderBy(Expression orderBy,
char orderByType)
Set the ORDER BY declaration.
|
void |
setOrderBy(java.lang.String orderBy)
Set the ORDER BY declaration.
|
void |
setOrderBy(java.lang.String orderBy,
boolean isAscending)
Set the ORDER BY declaration.
|
void |
setOrderBy(java.lang.String orderBy,
char orderByType)
Set the ORDER BY declaration.
|
void |
setSelect(java.lang.String... vars)
Set the variables to use for the SELECT part of the Sparql request.
|
boolean |
setSelectAll()
Set "*" for SELECT all variables.
|
java.lang.String |
toString() |
boolean |
variableExists(java.lang.String var)
Return true if a variable is defined.
|
addAsk, addDelete, addInsert, addInsertData, addIRI, addProperty, addVariable, addVariableOrIRI, appendTypeExpression, checkVariableExistence, createAdditionalVariable, createIRI, getAdditionalVars, getAskForm, getBinds, getCoalesces, getDeleteForms, getDistances, getFilters, getGeometries, getGraphPatterns, getInsertForms, getIRI, getIRIs, getLastInsertForm, getOwlTimes, getPrefix, getPrefix, getPropertyIndRefs, getPropertyRefs, getPropertyValues, getSelectForm, getVariable, getVariableOrIRI, getVariables, getVariablesIterator, getVariablesOrIRIIterator, getVariableType, getWhereExpressions, getWhereForm, hasAdditionalVariable, hasAskForm, hasIRI, hasVariable, hasVariableOrIRIclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAutoVariable, addLabel, addProperty, addPropertyIndividualRef, addPropertyIndividualRef, addPropertyRef, addPropertyRef, addPropertyRef, addPropertyRef, addPropertyRef, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValues, addPropertyValues, addPropertyValues, addSubClassOf, addSubClassOfStar, addType, addType, addTypeSubClassOf, addVariableSubClassOf, addVariableSubClassOfStar, addVariableType, addVariableType, addVariableTypeSubClassOf, getAllVariables, hasDeleteForms, hasInsertForms, removeSelectpublic SparqlRequest(SparqlRequest parent)
parent - the parent requestpublic SparqlRequest(java.lang.String prefix,
char prefixInclusionType)
prefix - the default prefixprefixInclusionType - specify how the prefix must be addedpublic SparqlRequest(java.lang.String prefix,
boolean checkVarsExistence,
char prefixInclusionType)
prefix - the default prefixcheckVarsExistence - true if variables existence will be checked to allow adding relations for these variables. If false, no
check will be performed.prefixInclusionType - specify how the prefix must be addedpublic SparqlRequest(java.lang.String prefix,
boolean checkVarsExistence,
SparqlPrefixDeclarations prefixDecl)
prefix - the default prefixcheckVarsExistence - true if variables existence will be checked to allow adding relations for these variables. If false, no
check will be performed.prefixDecl - the prefix declarationspublic SparqlRequest(java.lang.String prefix,
boolean checkVarsExistence)
prefix - the default prefixcheckVarsExistence - true if variables existence will be checked to allow adding relations for these variables. If false, no
check will be performed.public SparqlRequest(java.lang.String prefix)
prefix - the default prefixpublic SparqlRequest(java.lang.String prefix,
SparqlPrefixDeclarations prefixDecl)
prefix - the default prefixprefixDecl - the prefix declarationspublic static SparqlRequest createRequest(java.lang.String prefix, java.lang.String requestAsString)
public SparqlRequest getRootRequest()
ISparqlRequestGroupgetRootRequest in interface ISparqlRequestGrouppublic WhereForm getEffectiveWhereForm()
getEffectiveWhereForm in interface ISparqlRequestGrouppublic SparqlPrefixDeclarations getPrefixDeclarations()
public void logErrors(boolean logErrors)
logErrors - true if errors should be logged by the frameworkpublic boolean isLoggingErrors()
isLoggingErrors in interface ISparqlRequestGrouppublic boolean isCheckingVariablesExistence()
checkValidity() before the generation.isCheckingVariablesExistence in interface ISparqlRequestGrouppublic boolean existsVariable(java.lang.String varName)
varName - the variable namepublic java.util.Map<java.lang.String,SelectItem> getSelectMap()
getSelectMap in interface ISparqlRequestGrouppublic java.util.List<SelectItem> getSelectList()
getSelectList in interface ISparqlRequestGrouppublic java.lang.String getDefaultPrefix()
getDefaultPrefix in interface ISparqlRequestGrouppublic void setLimit(int limit)
limit - the limit of the number of resultspublic int getLimit()
public void setOffset(int offset)
offset - the OFFSET of the number of resultspublic int getOffset()
getOffset in interface ISparqlRequestGrouppublic void setOrderBy(java.lang.String orderBy)
orderBy - the ORDER BY declarationpublic void setOrderBy(java.lang.String orderBy,
boolean isAscending)
orderBy - the ORDER BY declarationisAscending - true if the ORDER BY declaration is ascendingpublic void setOrderBy(java.lang.String orderBy,
char orderByType)
orderBy - the ORDER BY declarationorderByType - the type for the ORDER By DECLARATIONpublic void setOrderBy(Expression orderBy)
orderBy - the ORDER BY declarationpublic void setOrderBy(Expression orderBy, char orderByType)
orderBy - the ORDER BY declarationorderByType - the type for the ORDER By DECLARATIONpublic void setOrderBy(Expression orderBy, boolean isAscending)
orderBy - the ORDER BY declarationisAscending - true if the ORDER BY declaration is ascendingpublic Expression getOrderBy()
public java.lang.String getPreferredVariableName()
getPreferredVariable()public Variable getPreferredVariable()
public void setGroupBy(java.lang.String... groupBy)
groupBy - the groupBy variables declarationpublic void setGroupBy(java.util.List<java.lang.String> groupBy)
groupBy - the groupBy variables declarationpublic java.util.List<java.lang.String> getGroupBy()
public char getOrderByType()
public void selectDistinct(boolean selectDistinct)
selectDistinct - true for SELECT DISTINCTpublic boolean isSelectDistinct()
public java.lang.String getSPARQL()
public boolean checkValidity()
public boolean isSelect(java.lang.String var)
var - the variable namepublic boolean variableExists(java.lang.String var)
var - the variable namepublic static java.util.List<? extends java.lang.Object> createValuesList(java.lang.Object... values)
values - the values arraypublic java.lang.String toString()
toString in class java.lang.Objectpublic SparqlRequest addInnerQuery()
public java.util.List<SparqlRequest> getInnerQueries()
public boolean hasInnerQueries()
public boolean isSelectAll()
isSelectAll in interface ISparqlRequestGroupisSelectAll in class AbstractSparqlRequestpublic boolean hasSelectVariable(java.lang.String var)
hasSelectVariable in interface ISparqlRequestGrouphasSelectVariable in class AbstractSparqlRequestvar - the variable namepublic boolean setSelectAll()
public void setSelect(java.lang.String... vars)
isSelectAll() property.vars - the variablespublic boolean addSelect(java.lang.String... vars)
vars - the variablespublic boolean addSelect(Expression expr, java.lang.String asVar)
expr - the expressionasVar - the AS variablepublic boolean addSelect(SelectExpression selectExpr)
selectExpr - the select expressionpublic boolean addSelect(java.lang.String var)
var - the variablepublic java.lang.String addAutoVariable(java.lang.String radix)
addAutoVariable in interface ISparqlRequestGroupradix - the variable radixpublic Variable createVariable(java.lang.String name)
createVariable in interface ISparqlRequestGroupcreateVariable in class AbstractSparqlRequestname - the variable namepublic Variable addSelectVariable(SelectExpression selectExpr)
selectExpr - the select expressionpublic boolean addAdditionalVariable(Variable var)
addAdditionalVariable in interface ISparqlRequestGroupaddAdditionalVariable in class AbstractSparqlRequestvar - the variablepublic boolean addAdditionalVariable(java.lang.String varName)
addAdditionalVariable in interface ISparqlRequestGroupaddAdditionalVariable in class AbstractSparqlRequestvarName - the variable namepublic boolean addSubClassOf(java.lang.String var,
TripleElement type)
addSubClassOf in interface ISparqlRequestGroupvar - the variable nametype - the typepublic boolean addLabel(java.lang.String var,
TripleElement type)
addLabel in interface ISparqlRequestGroupvar - the variable nametype - the typepublic boolean addSubClassOfStar(java.lang.String var,
TripleElement type)
addSubClassOfStar in interface ISparqlRequestGroupvar - the variable nametype - the typepublic boolean addTypeSubClassOf(java.lang.String var,
TripleElement type)
addTypeSubClassOf in interface ISparqlRequestGroupvar - the variable nametype - the typepublic boolean addType(java.lang.String var,
short exprKind,
TripleElement type)
ExpressionTypes.TYPE: a rdf:type expressionExpressionTypes.SUBCLASS_OF: a rdfs:subClassOf expressionExpressionTypes.SUBCLASS_OF_STAR: a rdfs:subClassOf* expressionExpressionTypes.TYPE_SUBCLASS_OF: a rdf:type/rdfs:subClassOf expressionaddType in interface ISparqlRequestGroupvar - the variable nameexprKind - the expression kindtype - the typepublic boolean addType(java.lang.String var,
TripleElement type)
addType in interface ISparqlRequestGroupvar - the variable nametype - the typepublic boolean addType(VariableOrIRI varOrIRI, TripleElement type)
addType in interface ISparqlRequestGroupvarOrIRI - the variable or IRItype - the typepublic boolean addVariableSubClassOf(java.lang.String var,
TripleElement typeVar)
addVariableSubClassOf in interface ISparqlRequestGroupvar - the variable nametypeVar - the type variablepublic boolean addVariableSubClassOfStar(java.lang.String var,
TripleElement typeVar)
addVariableSubClassOfStar in interface ISparqlRequestGroupvar - the variable nametypeVar - the type variablepublic boolean addVariableTypeSubClassOf(java.lang.String var,
TripleElement typeVar)
addVariableTypeSubClassOf in interface ISparqlRequestGroupvar - the variable nametypeVar - the type variablepublic boolean addVariableType(java.lang.String var,
short exprKind,
TripleElement typeVar)
ExpressionTypes.TYPE: a rdf:type expressionExpressionTypes.SUBCLASS_OF: a rdfs:subClassOf expressionExpressionTypes.SUBCLASS_OF_STAR: a rdfs:subClassOf* expressionExpressionTypes.TYPE_SUBCLASS_OF: a rdf:type/rdfs:subClassOf expressionaddVariableType in interface ISparqlRequestGroupvar - the variable nameexprKind - the expression kindtypeVar - the type variablepublic boolean addVariableType(java.lang.String var,
TripleElement element)
addVariableType in interface ISparqlRequestGroupvar - the variable nameelement - the triple elementpublic boolean addPropertyValue(java.lang.String var,
TripleElement type,
java.lang.Object propertyValue,
boolean optional)
addPropertyValue in interface ISparqlRequestGroupvar - the variable nametype - the typepropertyValue - the property valueoptional - true for an optional patternpublic boolean addPropertyValues(java.lang.String var,
TripleElement type,
java.util.List<? extends java.lang.Object> propValues,
boolean optional)
addPropertyValues in interface ISparqlRequestGroupvar - the variable nametype - the typepropValues - the property valuesoptional - true for an optional patternpublic Filter addFilter()
addFilter in interface ISparqlRequestGrouppublic Bind addBind()
addBind in interface ISparqlRequestGrouppublic Bind addBind(java.lang.String var)
addBind in interface ISparqlRequestGroupvar - the variablepublic Coalesce addCoalesce()
addCoalesce in interface ISparqlRequestGrouppublic boolean addTime(java.lang.String var,
java.lang.String varTime,
boolean isDateTime,
boolean optional)
var - the variable namevarTime - the time variable nameisDateTime - true for a dateTime propertyoptional - true for an optional patternpublic boolean addTime(java.lang.String var,
java.lang.String varTime,
boolean isDateTime)
addTime in interface ISparqlRequestGroupvar - the variable namevarTime - the time variable nameisDateTime - true for a dateTime propertypublic boolean addGeometry(java.lang.String var,
java.lang.String varLat,
java.lang.String varLon,
boolean isExact)
addGeometry in interface ISparqlRequestGroupvar - the variable namevarLat - the latitude variable namevarLon - the longitude variable nameisExact - the name for an exact geometrypublic boolean addGeometry(java.lang.String var,
java.lang.String varLat,
java.lang.String varLon,
boolean isExact,
boolean optional)
var - the variable namevarLat - the latitude variable namevarLon - the longitude variable nameisExact - the name for an exact geometryoptional - true for an optional patternpublic boolean addDistance(java.lang.String var,
java.lang.String fromVar,
java.lang.String varDist,
short unit,
boolean isExact)
addDistance in interface ISparqlRequestGroupvar - the variable namefromVar - the other element variable namevarDist - the distance variable nameunit - the distance unitisExact - the name for an exact geometrypublic boolean addDistance(java.lang.String var,
java.lang.String fromVar,
java.lang.String varDist,
short unit,
boolean isExact,
boolean optional)
var - the variable namefromVar - the other element variable namevarDist - the distance variable nameunit - the distance unitisExact - the name for an exact geometryoptional - true for an optional patternpublic boolean addPropertyRef(java.lang.String var,
TripleElement type,
java.lang.String varRef,
boolean optional)
addPropertyRef in interface ISparqlRequestGroupvar - the variable nametype - the typevarRef - the variable to use for the referenceoptional - true for an optional patternpublic boolean addPropertyRef(VariableOrIRI varOrIRI, TripleElement type, VariableOrIRI varOrIRIRef, boolean optional)
addPropertyRef in interface ISparqlRequestGroupvarOrIRI - the variable or IRItype - the propertyvarOrIRIRef - the variable or IRI to use for the referenceoptional - true for an optional propertypublic boolean addPropertyIndividualRef(java.lang.String var,
TripleElement type,
java.lang.String individual,
boolean optional)
addPropertyIndividualRef in interface ISparqlRequestGroupvar - the variable nametype - the typeindividual - the individual nameoptional - true for an optional patternpublic SparqlRequestGroup addOptionalConstruct()
public java.util.List<SparqlRequestGroup> getOptionals()
ISparqlRequestGroupgetOptionals in interface ISparqlRequestGrouppublic Union addUnionConstruct()
public java.util.List<Union> getUnions()
ISparqlRequestGroupgetUnions in interface ISparqlRequestGrouppublic boolean hasUnions()
ISparqlRequestGrouphasUnions in interface ISparqlRequestGrouppublic void resetSPARQLResult()
resetSPARQLResult in interface ISparqlRequestGroupCopyright © 2025, 2026 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence