|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
QueryTemplate
represents the Versatile API to the underlying "meta-data query language".
In a typical case, the actual Query
objects are not created directly but they are instantiated
using newQuery
method of the QueryTemplate
class. The instances of the QueryTemplate
class serve the following purposes:
The interface provides a generic method for adding property predicates (addPredicate
)
and a set of methods allowing a short-hand notation for all the Versatile predefined operators.
PropertyOperators
Field Summary |
Fields inherited from interface cz.cuni.versatile.api.Query |
BIASED_SCORING_FACTOR, DEFAULT_MATCH_SCORE, DEFAULT_N_BEST, DEFAULT_SCORING_FACTOR, EXACT_MATCH_SCORE, NEUTRAL_SCORING_FACTOR |
Method Summary | |
void |
add_Equal(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#EQ (equals) intrinsic operator. |
void |
add_GE(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#GE (greater than or equals) intrinsic operator. |
void |
add_GT(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#GT (greater than) intrinsic operator. |
void |
add_LE(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#LE (less than or equals) intrinsic operator. |
void |
add_LT(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#LT (less than) intrinsic operator. |
void |
addAssert(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#ASSERT (assert) extrinsic operator. |
void |
addAssertInv(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#ASSERT_INV (assertInv) extrinsic operator. |
void |
addAssertLevel(java.lang.String uniqueName,
int level)
Add a meta-data predicate using a given property and the PropertyOperators#ASSERT_LEVEL (assertLevel) extrinsic operator. |
void |
addBestMatch(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#BEST_MATCH (bestMatch) extrinsic operator. |
void |
addComparable(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#COMPARABLE (comparable) extrinsic operator. |
void |
addEquivalent(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#EQUIVALENT (equivalent) extrinsic operator. |
void |
addIsAncestor(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#IS_ANCESTOR (isAncestor) extrinsic operator. |
void |
addIsChild(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#IS_CHILD (isChild) extrinsic operator. |
void |
addIsDescendant(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#IS_DESCENDANT (isDescendant) extrinsic operator. |
void |
addIsParent(java.lang.String uniqueName)
Add a meta-data predicate using a given property and the PropertyOperators#IS_PARENT (isParent) extrinsic operator. |
void |
addPredicate(PropertyPredicate pp)
A generic method for adding a meta-data predicate. |
DeliveryContext |
getDeliveryContext()
Returns the associated delivery context used to evaluate property values and substitute them to the property predicates during query instantiation. |
TemplateBasedQuery |
newQuery(java.lang.String resourceName)
Query factory method.
|
void |
setNBest(int nbest)
Sets the N-best size for queries based on this template. |
void |
setScoreThreshold(double threshold)
Sets the score threshold for queries based on this template. |
void |
setScoringFactor(double scoringFactor)
Sets the scoring factor for queries based on this template. |
Methods inherited from interface cz.cuni.versatile.api.Query |
getNBest, getPredicates, getResourceName, getScoreThreshold, getScoringFactor |
Method Detail |
public void setNBest(int nbest)
nbest
- a positive integerQuery.DEFAULT_N_BEST
public void setScoreThreshold(double threshold)
threshold
- a number in the interval <Query#DEFAULT_MATCH_SCORE, Query#EXACT_MATCH_SCORE>
(<0.0, 1.0>
)Query.DEFAULT_MATCH_SCORE
,
Query.EXACT_MATCH_SCORE
public void setScoringFactor(double scoringFactor)
scoringFactor
- a number in the interval (0, Query#NEUTRAL_SCORING_FACTOR>
.Query
public DeliveryContext getDeliveryContext()
public void addPredicate(PropertyPredicate pp) throws UnregisteredPropertyException
pp
- a meta-data predicate describing one particular aspect of a desired resource.
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
(an attribute of the PropertyPredicate
parameter)PropertyOperators
public void add_Equal(java.lang.String uniqueName) throws UnregisteredPropertyException
PropertyOperators#EQ
(equals) intrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given propertyPropertyOperators.EQ
public void add_GT(java.lang.String uniqueName) throws UnregisteredPropertyException
PropertyOperators#GT
(greater than) intrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given propertyPropertyOperators.GT
public void add_LT(java.lang.String uniqueName) throws UnregisteredPropertyException
PropertyOperators#LT
(less than) intrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given propertyPropertyOperators.LT
public void add_GE(java.lang.String uniqueName) throws UnregisteredPropertyException
PropertyOperators#GE
(greater than or equals) intrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given propertyPropertyOperators.GE
public void add_LE(java.lang.String uniqueName) throws UnregisteredPropertyException
PropertyOperators#LE
(less than or equals) intrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given propertyPropertyOperators.LE
public void addAssert(java.lang.String uniqueName) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#ASSERT
(assert) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.ASSERT
public void addAssertInv(java.lang.String uniqueName) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#ASSERT_INV
(assertInv) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.ASSERT_INV
public void addAssertLevel(java.lang.String uniqueName, int level) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#ASSERT_LEVEL
(assertLevel) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.ASSERT_LEVEL
public void addEquivalent(java.lang.String uniqueName) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#EQUIVALENT
(equivalent) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.EQUIVALENT
public void addComparable(java.lang.String uniqueName) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#COMPARABLE
(comparable) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.COMPARABLE
public void addIsParent(java.lang.String uniqueName) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#IS_PARENT
(isParent) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.IS_PARENT
public void addIsChild(java.lang.String uniqueName) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#IS_CHILD
(isChild) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.IS_CHILD
public void addIsAncestor(java.lang.String uniqueName) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#IS_ANCESTOR
(isAncestor) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.IS_ANCESTOR
public void addIsDescendant(java.lang.String uniqueName) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#IS_DESCENDANT
(isDescendant) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.IS_DESCENDANT
public void addBestMatch(java.lang.String uniqueName) throws UnregisteredPropertyException, UnsupportedPropertyOperatorException
PropertyOperators#BEST_MATCH
(bestMatch) extrinsic operator.
uniqueName
- a unique name of the Property
UnregisteredPropertyException
- if the associated DeliveryContext
does not recognize a given property
UnsupportedPropertyOperatorException
- is the operator is not applicable to a given property typePropertyOperators.BEST_MATCH
public TemplateBasedQuery newQuery(java.lang.String resourceName)
Query
factory method.
It takes a unique resource name as its input (resourceName
) and creates
an immutable Query
object using the current QueryTemplate
settings and its current predicate list.
An implementation of this method performs the following tasks:
DeliveryContext
to provide values for all the properties,
each property is evaluated only once, even if it appears in more than one predicate
Query
using the data gathered in the above steps
Remarks:
Query
instances can not be re-used repeatedly
over time as the property values may have changed in the meantime
resourceName
- a resource name uniquely identifying a particular resource within the scope of the target ResourceProvider
ResouceProvider
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |