Package org.eclipse.rdf4j.sail.lucene
Class QuerySpec
- java.lang.Object
-
- org.eclipse.rdf4j.sail.lucene.AbstractSearchQueryEvaluator
-
- org.eclipse.rdf4j.sail.lucene.QuerySpec
-
- All Implemented Interfaces:
SearchQueryEvaluator
public class QuerySpec extends AbstractSearchQueryEvaluator
A QuerySpec holds information extracted from a TupleExpr corresponding with a single Lucene query. Access the patterns or use the get-methods to get the names of the variables to bind.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QuerySpec.QueryParam
Param in a Lucene query extracted inQuerySpec
-
Field Summary
Fields Modifier and Type Field Description private StatementPattern
idPattern
private StatementPattern
matchesPattern
private java.lang.String
matchesVarName
private java.util.Collection<QuerySpec.QueryParam>
queryPatterns
private StatementPattern
scorePattern
private java.lang.String
scoreVarName
private Resource
subject
private StatementPattern
typePattern
-
Constructor Summary
Constructors Constructor Description QuerySpec(java.lang.String matchesVarName, java.lang.String propertyVarName, java.lang.String scoreVarName, java.lang.String snippetVarName, Resource subject, java.lang.String queryString, IRI propertyURI)
QuerySpec(StatementPattern matchesPattern, java.util.Collection<QuerySpec.QueryParam> queryPatterns, StatementPattern scorePattern, StatementPattern typePattern, StatementPattern idPattern, Resource subject)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
append(StatementPattern pattern, java.lang.StringBuilder buffer)
private static void
append(Var var, java.lang.StringBuilder buffer)
java.lang.String
getCatQuery()
StatementPattern
getIdPattern()
StatementPattern
getMatchesPattern()
java.lang.String
getMatchesVariableName()
return the name of the bound variable that should match the queryQueryModelNode
getParentQueryModelNode()
java.util.Collection<QuerySpec.QueryParam>
getQueryPatterns()
IRI
getQueryType()
the type of query, must equalLuceneSailSchema.LUCENE_QUERY
.StatementPattern
getScorePattern()
java.lang.String
getScoreVariableName()
The variable name associated with the query scoreResource
getSubject()
StatementPattern
getTypePattern()
boolean
isEvaluable()
boolean
isHighlight()
QueryModelNode
removeQueryPatterns()
Removes the query patterns and returns a placeholder where the query results could be placed.private static void
replace(QueryModelNode pattern, java.util.function.Supplier<? extends QueryModelNode> replacement)
Replace the given pattern with a new instance of the given replacement type.java.lang.String
toString()
-
Methods inherited from class org.eclipse.rdf4j.sail.lucene.AbstractSearchQueryEvaluator
replaceQueryPatternsWithResults
-
-
-
-
Field Detail
-
matchesPattern
private final StatementPattern matchesPattern
-
queryPatterns
private final java.util.Collection<QuerySpec.QueryParam> queryPatterns
-
scorePattern
private final StatementPattern scorePattern
-
typePattern
private final StatementPattern typePattern
-
idPattern
private final StatementPattern idPattern
-
subject
private final Resource subject
-
matchesVarName
private final java.lang.String matchesVarName
-
scoreVarName
private final java.lang.String scoreVarName
-
-
Constructor Detail
-
QuerySpec
public QuerySpec(StatementPattern matchesPattern, java.util.Collection<QuerySpec.QueryParam> queryPatterns, StatementPattern scorePattern, StatementPattern typePattern, StatementPattern idPattern, Resource subject)
-
-
Method Detail
-
replace
private static void replace(QueryModelNode pattern, java.util.function.Supplier<? extends QueryModelNode> replacement)
Replace the given pattern with a new instance of the given replacement type.- Parameters:
pattern
- the pattern to removereplacement
- the replacement type
-
append
private static void append(StatementPattern pattern, java.lang.StringBuilder buffer)
-
append
private static void append(Var var, java.lang.StringBuilder buffer)
-
getParentQueryModelNode
public QueryModelNode getParentQueryModelNode()
-
removeQueryPatterns
public QueryModelNode removeQueryPatterns()
Description copied from interface:SearchQueryEvaluator
Removes the query patterns and returns a placeholder where the query results could be placed.
-
getMatchesPattern
public StatementPattern getMatchesPattern()
-
getMatchesVariableName
public java.lang.String getMatchesVariableName()
return the name of the bound variable that should match the query- Returns:
- the name of the variable or null, if no name set
-
getQueryPatterns
public java.util.Collection<QuerySpec.QueryParam> getQueryPatterns()
-
getIdPattern
public StatementPattern getIdPattern()
-
getScorePattern
public StatementPattern getScorePattern()
-
getScoreVariableName
public java.lang.String getScoreVariableName()
The variable name associated with the query score- Returns:
- the name or null, if no score is queried in the pattern
-
getTypePattern
public StatementPattern getTypePattern()
-
getQueryType
public IRI getQueryType()
the type of query, must equalLuceneSailSchema.LUCENE_QUERY
. A null type is possible, but not valid.- Returns:
- the type of the Query or null, if no type assigned.
-
getSubject
public Resource getSubject()
-
isEvaluable
public boolean isEvaluable()
-
isHighlight
public boolean isHighlight()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getCatQuery
public java.lang.String getCatQuery()
-
-