RemoverUtil.remove(graph, flag);\r
}\r
\r
+ /**\r
+ * @param graph\r
+ * @param flag\r
+ * @return <code>true</code> only if the specified flag is joined only\r
+ * within the single diagram it resides in\r
+ * @throws DatabaseException\r
+ */\r
public static boolean isJoinedInSingleDiagram(ReadGraph graph, Resource flag) throws DatabaseException {\r
- DiagramResource DIA = DiagramResource.getInstance(graph);\r
- Resource counterpart = getPossibleCounterpart(graph, flag);\r
- if (counterpart == null)\r
+ Collection<Resource> counterparts = getCounterparts(graph, flag);\r
+ if (counterparts.isEmpty())\r
return false;\r
- return !Collections.disjoint(\r
- OrderedSetUtils.getOwnerLists(graph, flag, DIA.Diagram),\r
- OrderedSetUtils.getOwnerLists(graph, counterpart, DIA.Diagram));\r
+ DiagramResource DIA = DiagramResource.getInstance(graph);\r
+ Collection<Resource> flagDiagrams = OrderedSetUtils.getOwnerLists(graph, flag, DIA.Diagram);\r
+ for (Resource counterpart : counterparts) {\r
+ if (Collections.disjoint(flagDiagrams,\r
+ OrderedSetUtils.getOwnerLists(graph, counterpart, DIA.Diagram)))\r
+ return false;\r
+ }\r
+ return true;\r
}\r
\r
public static boolean isJoinedBetweenDiagrams(ReadGraph graph, Resource flag) throws DatabaseException {\r