- Collection<Resource> objects = getObjects(subject, relation);
- return !objects.isEmpty();
+ RelationInfo rinfo = processor.getRelationInfo(this, relation);
+ Collection<Resource> predicates = getPredicates(subject);
+
+ if (rinfo.isFinal) {
+
+ return predicates.contains(relation);
+
+ } else if (rinfo.isFunctional) {
+
+ try {
+ return processor.getSingleObject(this, subject, relation) != 0;
+ } catch (ManyObjectsForFunctionalRelationException e) {
+ return true;
+ } catch (DatabaseException e) {
+ throw new ServiceException(e);
+ }
+
+ } else {
+
+ for (Resource predicate : getPredicates(subject)) {
+ if (isSubrelationOf(predicate, relation))
+ return true;
+ }
+
+ }
+
+ return false;