|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.versatile.core.PropertyOperators
A default implementation of the PropertyOperator
interface as well as an enumeration of all built-in (pre-defined)
property operators. The set of operators can be easily extended,
however, it always depends on the individual implementation of
the ResourceProvider
interface which operators
it recognizes. The operators listed below are mandatory for
all compliant ResourceProvider
implementations.
Operator | Intrinsic | Assertive | Applicable |
---|---|---|---|
= | yes | yes | Property |
> | yes | yes | Property |
< | yes | yes | Property |
>= | yes | yes | Property |
<= | yes | yes | Property |
assert | no | yes | RelationalProperty |
assertInv | no | yes | RelationalProperty |
assertLevel | no | yes | Taxonomy |
equivalent | no | yes | Equivalence |
comparable | no | yes | OrderProperty |
isParent | no | yes | Taxonomy |
isChild | no | yes | Taxonomy |
isAncestor | no | yes | Taxonomy |
isDescendant | no | yes | Taxonomy |
bestMatch | no | no | Taxonomy |
QueryTemplate
Field Summary | |
static PropertyOperator |
ASSERT
assert extrinsic assertive operator. |
static PropertyOperator |
ASSERT_INV
assertInv extrinsic assertive operator. |
static PropertyOperator |
ASSERT_LEVEL
assertLevel extrinsic assertive operator. |
protected boolean |
assertive
Flag whether the operator is assertive or whether it allows for an approximate matching (fall-back, constraint relaxing). |
static PropertyOperator |
BEST_MATCH
bestMatch extrinsic constraint-relaxing operator. |
static PropertyOperator |
COMPARABLE
comparable extrinsic assertive operator. |
static PropertyOperator |
EQ
Equals intrinsic assertive operator. |
static PropertyOperator |
EQUIVALENT
equivalent extrinsic assertive operator. |
static PropertyOperator |
GE
Greater than or equal to ( >= ) intrinsic assertive operator.
|
static PropertyOperator |
GT
Greater-than ( > ) intrinsic assertive operator.
|
protected int |
id
The unique ID of the operator. |
protected boolean |
intrinsic
Flag whether the operator is intrinsic or extrinsic intrinsic operators use methods of the actual property values for comparison, so they rely on the existing methods of Java objects extrinsic operators rely on the relations externally provided by the properties (e.g. |
static PropertyOperator |
IS_ANCESTOR
isAncestor extrinsic assertive operator. |
static PropertyOperator |
IS_CHILD
isChild extrinsic assertive operator. |
static PropertyOperator |
IS_DESCENDANT
isDescendant extrinsic assertive operator. |
static PropertyOperator |
IS_PARENT
isParent extrinsic assertive operator. |
static PropertyOperator |
LE
Less than or equal to ( <= ) intrinsic assertive operator.
|
static PropertyOperator |
LT
Less-than ( < ) intrinsic assertive operator.
|
protected java.lang.String |
name
A human-readable name - just for logging and debugging. |
Constructor Summary | |
protected |
PropertyOperators(int id,
java.lang.String name,
boolean intrinsic,
boolean assertive)
Protected Constructor - can be re-used by subclasses extending the set of supported operators. |
Method Summary | |
int |
getId()
The unique ID of the property operator. |
java.lang.String |
getName()
A human-readable property operator name - just for logging and debugging. |
boolean |
isAssertive()
Flag whether the operator is assertive or whether it allows for an approximate matching (fall-back, constraint relaxing) |
boolean |
isExtrinsic()
Flag whether the operator is extrinsic Extrinsic operators rely on the relations externally provided by the properties (e.g. |
boolean |
isIntrinsic()
Flag whether the operator is intrinsic. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int id
protected java.lang.String name
protected boolean intrinsic
OrderProperty
, Equivalence
)
protected boolean assertive
PropertyOperator.isAssertive()
public static final PropertyOperator EQ
Object.equals()
method.
Object.equals(java.lang.Object)
,
QueryTemplate.add_Equal(String)
public static final PropertyOperator GT
>
) intrinsic assertive operator.
When comparing two values, it invokes Comparable.compareTo()
method.
Remarks: Requires the objects to implement the Comparable
interface.
Comparable.compareTo(java.lang.Object)
,
QueryTemplate.add_GT(String)
public static final PropertyOperator LT
<
) intrinsic assertive operator.
When comparing two values, it invokes Comparable.compareTo()
method.
Remarks: Requires the objects to implement the Comparable
interface.
Comparable.compareTo(java.lang.Object)
,
QueryTemplate.add_LT(String)
public static final PropertyOperator GE
>=
) intrinsic assertive operator.
When comparing two values, it invokes Comparable.compareTo()
method.
Remarks: Requires the objects to implement the Comparable
interface.
Comparable.compareTo(java.lang.Object)
,
QueryTemplate.add_GE(String)
public static final PropertyOperator LE
<=
) intrinsic assertive operator.
When comparing two values, it invokes Comparable.compareTo()
method.
Remarks: Requires the objects to implement the Comparable
interface.
Comparable.compareTo(java.lang.Object)
,
QueryTemplate.add_LE(String)
public static final PropertyOperator ASSERT
RelationalProperty.contains(x, y)
.
Remarks:
RelationalProperty
OrderProperty
, Equivalence
and Taxonomy
RelationalProperty.contains(Object, Object)
,
QueryTemplate.addAssert(String)
public static final PropertyOperator ASSERT_INV
RelationalProperty.contains(y, x)
,
which is equivalent to InverseOf(p:RelationalProperty).contains(x, y).
Remarks:
- Can only be applied to a
RelationalProperty
- therefore it applies also to
OrderProperty
, Equivalence
and Taxonomy
- See Also:
RelationalProperty.contains(Object, Object)
,
InverseOf
,
QueryTemplate.addAssertInv(String)
public static final PropertyOperator ASSERT_LEVEL
RelationalProperty.contains(x, y)
it imposes an additional constraint
on how far are x
and y
in the classification hierarchy (taxonomy).
The additional mandatory parameter level(int)
represents the additional constraint as follows:
level = 0
- equivalent to assert
level > 0
- absolute distance from the root of the taxonomy
level < 0
- relative distance from the context node
Remarks:
Taxonomy
property
level > 0
makes most sense for fixed-depth taxonomies (e.g. UNSPSC),
for example, by combining "bestMatch and assertLevel(2)",
we can match all entries which are equal-to or greater-than a given entry, up-to the second level
of the 4-level UNSPSC hierarchy: given 43232203
(File versioning software), we generate the following
search sequence to find an upper-bound best match:
43232203
(File versioning software)
43232200
(Content management software)
43230000
(Software)
43000000
(Information Technology Broadcasting and Telecommunications) wont' match the query given the "assertLevel(2)" condition.
level < 0
on the other hand allows to express how many steps of the best match fall-back
search we want to allow, given the example above and the query "bestMatch and assertLevel(-1)",
only the exact match and optionally one step fall-back occurs:
43232203
(File versioning software)
43232200
(Content management software)
Taxonomy
,
BEST_MATCH
,
QueryTemplate.addAssertLevel(String, int)
public static final PropertyOperator COMPARABLE
Remarks:
OrderProperty
property
OrderProperty.comparable(Object, Object)
,
QueryTemplate.addComparable(String)
public static final PropertyOperator EQUIVALENT
Equivalence
sub-type
of RelationalProperty
to decide which values are considered "equal".
Remarks:
Equivalence
property
Equivalence
,
QueryTemplate.addEquivalent(String)
public static final PropertyOperator IS_PARENT
Taxonomy
API for details.
Remarks:
Taxonomy
property
Taxonomy.isParent(Object, Object)
,
QueryTemplate.addIsParent(String)
public static final PropertyOperator IS_CHILD
Taxonomy
API for details.
Remarks:
Taxonomy
property
Taxonomy.isChild(Object, Object)
,
QueryTemplate.addIsChild(String)
public static final PropertyOperator IS_ANCESTOR
Taxonomy
API for details.
Remarks:
Taxonomy
property
Taxonomy.isAncestor(Object, Object)
,
QueryTemplate.addIsAncestor(String)
public static final PropertyOperator IS_DESCENDANT
Taxonomy
API for details.
Remarks:
Taxonomy
property
RelationalProperty.contains()
in case of Taxonomy
.
Taxonomy.isDescendant(Object, Object)
,
QueryTemplate.addIsDescendant(String)
public static final PropertyOperator BEST_MATCH
ValueProvider
and tries to perform an exact match, if no resource
is found, it uses Taxonomy#getAncestorIterator()
to generate a sequence of candidates in ascending
order, leveraging the classification hierarchy of the taxonomy. With properly designed taxonomies in place,
one can thus easily implement quite sophisticated fall-back strategies using hierarchical defaulting
(constraint relaxing).
Remarks:
Taxonomy
property
43232203
(File versioning software)
we generate the following search sequence to find the closest match:
43232203
(File versioning software)
43232200
(Content management software)
43230000
(Software)
43000000
(Information Technology Broadcasting and Telecommunications)
/
(root = property value not set = universal concept)
ASSERT_LEVEL
,
Taxonomy.getAncestorIterator(Object, java.util.Comparator)
,
QueryTemplate.addBestMatch(String)
Constructor Detail |
protected PropertyOperators(int id, java.lang.String name, boolean intrinsic, boolean assertive)
id
- unique operator ID used for processing query predicatesname
- human readable equivalent for debugging and loggingintrinsic
- intrinsic/extrinsic flagMethod Detail |
public int getId()
PropertyOperator
switch/case
statement).
getId
in interface PropertyOperator
PropertyOperator.getId()
public java.lang.String getName()
PropertyOperator
getName
in interface PropertyOperator
PropertyOperator.getName()
public boolean isIntrinsic()
PropertyOperator
Object.equals()
or Comparable.compareTo()
)
Remarks: An operator is either intrinsic or extrinsic, never both.
isIntrinsic
in interface PropertyOperator
true
is the property operator is intrinsicPropertyOperator.isIntrinsic()
public boolean isExtrinsic()
PropertyOperator
OrderProperty
, Equivalence
)
Remarks: An operator is either intrinsic or extrinsic, never both.
isExtrinsic
in interface PropertyOperator
true
is the property operator is extrinsicPropertyOperator.isExtrinsic()
public boolean isAssertive()
PropertyOperator
isAssertive
in interface PropertyOperator
true
if the operator does not allow for any constraint relaxing
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |