|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Multi-variant resource query (a data structure abstraction).
Query
is a data structure encapsulating all the information necessary to retrieve
a resource possibly existing in many different variants and flavors:
ResourceProvider
instance;
unlike property names, resource names are not globally unique in Versatile.
Remarks:
Query
instances are typically created as a spin-off of the QueryTemplate
object.
Query
is meant to be an immutable object: once it gets instantiated, it never changes
Query
implementations should override Object.equals()
and implement
an efficient comparison algorithm to detect whether two queries are identical
ResourceProvider
implementations can more easily
implement caching for improved performance.
ResourceProvider
,
QueryTemplate
,
TemplateBasedQuery
Field Summary | |
static double |
BIASED_SCORING_FACTOR
Biased scoring factor. |
static double |
DEFAULT_MATCH_SCORE
Default match score is 0.0 , which means all values. |
static int |
DEFAULT_N_BEST
Default N-best is 1-best. |
static double |
DEFAULT_SCORING_FACTOR
Default scoring factor. |
static double |
EXACT_MATCH_SCORE
Exact match score is 1.0 , which means no constraint relaxing (fall-back) activity took place. |
static double |
NEUTRAL_SCORING_FACTOR
NEUTRAL_SCORING_FACTOR = 1.0 makes all property predicates equally significant.
|
Method Summary | |
int |
getNBest()
Returns the N-best (the expected size of the result set) setting for this query. |
java.util.List |
getPredicates()
An ordered list of meta-data constraints. |
java.lang.String |
getResourceName()
Resource name which uniquely identifies a resource within a scope of a particular ResourceProvider
instance. |
double |
getScoreThreshold()
Returns the resource score threshold setting for this query. |
double |
getScoringFactor()
Returns the scoring factor used by the scoring function for this query. |
Field Detail |
public static final int DEFAULT_N_BEST
public static final double DEFAULT_MATCH_SCORE
0.0
, which means all values.
public static final double EXACT_MATCH_SCORE
1.0
, which means no constraint relaxing (fall-back) activity took place.
PropertyOperators.BEST_MATCH
,
Constant Field Valuespublic static final double DEFAULT_SCORING_FACTOR
DEFAULT_SCORING_FACTOR = 0.99
, which is semantically very close NEUTRAL_SCORING_FACTOR
,
but the small penalty of this scoring factor effectively prevents ambiguity of the result scores.
public static final double NEUTRAL_SCORING_FACTOR
NEUTRAL_SCORING_FACTOR = 1.0
makes all property predicates equally significant.
the score calculated for an individual result entry by the scoring function will
be 1/(1 + m)
, where m
is the magnitude of the vector defined as the distance of the result entry from the original query
in an N-dimensional Euclidean space, each property corresponding to one dimension.
Remarks: This setting can easily generate ambiguous results - multiple result entries with the same score.
public static final double BIASED_SCORING_FACTOR
BIASED_SCORING_FACTOR = 0.1
strongly inclines towards the properties
at the beginning of the predicate list, i.e. these are the most significant.
This is analogous to the order of significance of the individual digits in a decimal number.
Method Detail |
public int getNBest()
ResultSet
entries. Assertive operators
have no effect on the score rating.
N-best represents the maximum number of result entries which can be returned.
public double getScoreThreshold()
<Query#DEFAULT_MATCH_SCORE, Query#EXACT_MATCH_SCORE>
(<0.0, 1.0>
).
public double getScoringFactor()
(0, Query#NEUTRAL_SCORING_FACTOR>
.
QueryTemplate.setScoringFactor(double)
public java.lang.String getResourceName()
ResourceProvider
instance. Unlike property names, resource names are not necessarily globally unique in Versatile).
public java.util.List getPredicates()
PropertyPredicates
are ordered in descending order of their significance,
the significance of the predicates affects the resource score in case there are one or more
predicates using bestMatch or another constraint relaxing operator.
PropertyPredicate
objects, the list can be emptyPropertyPredicate
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |