diff -r 6e71adc5ccdd -r d740f5f55d30 __init__.py --- a/__init__.py Fri Dec 19 14:52:42 2008 +0100 +++ b/__init__.py Fri Dec 19 14:53:06 2008 +0100 @@ -297,3 +297,21 @@ 'folders': 'folder', 'tags': 'tag', } + +def neg_role(role): + if role == 'subject': + return 'object' + return 'subject' + +def role(obj): + try: + return obj.role + except AttributeError: + return neg_role(obj.target) + +def target(obj): + try: + return obj.target + except AttributeError: + return neg_role(obj.role) +