public class SparqlRequest extends AbstractSparqlRequest implements java.io.Serializable
binds, coalesces, deleteForms, filters, insertForms, selectForm, 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 schema)
Constructor.
|
SparqlRequest(java.lang.String schema,
boolean checkVarsExistence)
Constructor.
|
SparqlRequest(java.lang.String schema,
boolean checkVarsExistence,
boolean addPrefix)
Constructor.
|
SparqlRequest(java.lang.String schema,
boolean checkVarsExistence,
SparqlPrefixDeclarations prefixDecl)
Constructor.
|
SparqlRequest(java.lang.String schema,
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.
|
java.lang.String |
addAutoVariable()
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 |
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 |
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.
|
boolean |
existsVariable(java.lang.String varName)
Return true if a variable exists.
|
java.util.Map<java.lang.String,Variable> |
getAdditionalVars()
Return the additional variables.
|
java.lang.String |
getDefaultSchema()
Return the schema.
|
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() |
Expression |
getOrderBy()
Return the limit of the number of results.
|
char |
getOrderByType()
Return the ORDER BY type.
|
SparqlPrefixDeclarations |
getPrefixDeclarations() |
SparqlRequest |
getRootRequest() |
java.util.List<SelectItem> |
getSelectList() |
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() |
java.util.Set<WhereType> |
getWhereTypes() |
boolean |
hasAdditionalVariable(java.lang.String var) |
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 |
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,
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.
|
addDelete, addInsert, addInsertData, addProperty, appendTypeExpression, checkVariableExistence, getBinds, getCoalesces, getDeleteForms, getDistances, getFilters, getGeometries, getGraphPatterns, getInsertForms, getLastInsertForm, getOwlTimes, getPrefix, getPrefix, getPropertyIndRefs, getPropertyRefs, getPropertyValues, getSelectForm, getWhereFormclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddLabel, addProperty, addPropertyIndividualRef, addPropertyIndividualRef, addPropertyRef, addPropertyRef, addPropertyRef, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValues, addPropertyValues, addPropertyValues, addSubClassOf, addSubClassOfStar, addType, addType, addTypeSubClassOf, addVariableSubClassOf, addVariableSubClassOfStar, addVariableType, addVariableType, addVariableTypeSubClassOfpublic SparqlRequest(SparqlRequest parent)
parent - the parent requestpublic SparqlRequest(java.lang.String schema,
boolean checkVarsExistence,
boolean addPrefix)
schema - the schemacheckVarsExistence - true if variables existence will be checked to allow adding relations for these variables. If false, no
check will be performed.addPrefix - true if prefix must be addedpublic SparqlRequest(java.lang.String schema,
boolean checkVarsExistence,
SparqlPrefixDeclarations prefixDecl)
schema - the schemacheckVarsExistence - 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 schema,
boolean checkVarsExistence)
schema - the schemacheckVarsExistence - 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 schema)
schema - the schemapublic SparqlRequest(java.lang.String schema,
SparqlPrefixDeclarations prefixDecl)
schema - the schemaprefixDecl - the prefix declarationspublic static SparqlRequest createRequest(java.lang.String prefix, java.lang.String requestAsString)
public SparqlRequest getRootRequest()
getRootRequest 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()
public java.util.Map<java.lang.String,Variable> getAdditionalVars()
getAdditionalVars in interface ISparqlRequestGrouppublic boolean hasAdditionalVariable(java.lang.String var)
hasAdditionalVariable in interface ISparqlRequestGrouppublic java.lang.String getDefaultSchema()
getDefaultSchema 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 Expression getOrderBy()
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.util.Set<WhereType> getWhereTypes()
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()
addAutoVariable in interface ISparqlRequestGrouppublic Variable addSelectVariable(SelectExpression selectExpr)
selectExpr - the select expressionpublic boolean addAdditionalVariable(java.lang.String varName)
varName - 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 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 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()
getOptionals in interface ISparqlRequestGrouppublic Union addUnionConstruct()
public java.util.List<Union> getUnions()
getUnions in interface ISparqlRequestGrouppublic void resetSPARQLResult()
resetSPARQLResult in interface ISparqlRequestGroupCopyright © 2025 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence