X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Fgraph%2FReadGraphImpl.java;h=2309af76440b10bc2a3e9d336cf2fc4bdfc14819;hp=5d4852c0d7822efe1f88ef70a1a7eb6a941cb272;hb=e10760b08746837538ad4c2b4c37736aa34c7a47;hpb=21bef5bfa30007c081028f4f40d52a20c43794ca diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java index 5d4852c0d..2309af764 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java @@ -1850,40 +1850,42 @@ public class ReadGraphImpl implements AsyncReadGraph { try { - SyncReadProcedure procedure = new SyncReadProcedure(); - processor.forRelationInfo(this, relation, procedure); + RelationInfo rinfo = processor.getRelationInfo(this, relation); Collection predicates = getPredicates(subject); - - if(procedure.result.isFinal) { - + + if (rinfo.isFinal) { + return predicates.contains(relation); - - } else if (procedure.result.isFunctional) { + + } else if (rinfo.isFunctional) { try { - int result = processor.getSingleObject(this, subject, relation); - return result != 0; + 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)) + for (Resource predicate : getPredicates(subject)) { + if (isSubrelationOf(predicate, relation)) return true; } - + } - + return false; } catch (ServiceException e) { throw new ServiceException(e); + } catch (DatabaseException e) { + + throw new ServiceException(INTERNAL_ERROR_STRING, e); + } }