added order and relevance attributes to Relation class
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2138 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
24206693f9
commit
2e4f320fe7
2 changed files with 16 additions and 4 deletions
|
@ -35,6 +35,9 @@ class Relation(Persistent):
|
||||||
|
|
||||||
implements(IPredicate, IRelation)
|
implements(IPredicate, IRelation)
|
||||||
|
|
||||||
|
order = 0
|
||||||
|
relevance = 1.0
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getPredicateName(cls):
|
def getPredicateName(cls):
|
||||||
return '%s.%s' % (cls.__module__, cls.__name__)
|
return '%s.%s' % (cls.__module__, cls.__name__)
|
||||||
|
|
|
@ -32,6 +32,13 @@ class IRelation(Interface):
|
||||||
""" Base interface for relations.
|
""" Base interface for relations.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
order = Attribute('An integer that may be used for ordering relations. '
|
||||||
|
'The default should be 0, and there may be negative and '
|
||||||
|
'positive values.')
|
||||||
|
relevance = Attribute('A float greater than 0.0 and less or equal to '
|
||||||
|
'1.0 denoting the importance, relevance, or weight of a '
|
||||||
|
'relation. The default and standard value should be 1.0.')
|
||||||
|
|
||||||
def getPredicateName():
|
def getPredicateName():
|
||||||
""" Return the predicate of this relation as a string that may be
|
""" Return the predicate of this relation as a string that may be
|
||||||
used for indexing.
|
used for indexing.
|
||||||
|
@ -41,7 +48,9 @@ class IRelation(Interface):
|
||||||
""" Return True if this relation is valid.
|
""" Return True if this relation is valid.
|
||||||
|
|
||||||
If the registry argument is provided the check should be done
|
If the registry argument is provided the check should be done
|
||||||
with respect to this relation registry, e.g. to
|
with respect to this relation registry. The validate() method
|
||||||
|
may be used for implementing checks against ontologies or other
|
||||||
|
kinds of restrictions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue