You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/07/01 08:04:27 UTC
incubator-atlas git commit: ATLAS-1899: fixup the logic around edge
creation for relationshipDefs
Repository: incubator-atlas
Updated Branches:
refs/heads/master 958c48c2c -> 617bc25ec
ATLAS-1899: fixup the logic around edge creation for relationshipDefs
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/617bc25e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/617bc25e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/617bc25e
Branch: refs/heads/master
Commit: 617bc25ecc89f0bb38098faafc8fc1e4e1afb4de
Parents: 958c48c
Author: David Radley <da...@uk.ibm.com>
Authored: Sat Jul 1 00:59:08 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Sat Jul 1 00:59:08 2017 -0700
----------------------------------------------------------------------
.../graph/v1/AtlasRelationshipDefStoreV1.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/617bc25e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
index 194c546..bd7416e 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
@@ -84,7 +84,6 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
final String type2 = endDef2.getType();
final String name1 = endDef1.getName();
final String name2 = endDef2.getName();
-
AtlasVertex end1TypeVertex = typeDefStore.findTypeVertexByName(type1);
AtlasVertex end2TypeVertex = typeDefStore.findTypeVertexByName(type2);
@@ -96,22 +95,23 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
We are not invoking the equals method on the AtlasRelationshipedDef, as we only want 1 edge even if propagateTags or other properties are different.
*/
- if (!type1.equals(type2) && name1.equals(name2)) {
- AtlasEdge edge2 = typeDefStore.getOrCreateEdge(relationshipDefVertex, end2TypeVertex, AtlasGraphUtilsV1.RELATIONSHIPTYPE_EDGE_LABEL);
-
+ if (type1.equals(type2) && name1.equals(name2)) {
if (LOG.isDebugEnabled()) {
LOG.debug("AtlasRelationshipDefStoreV1.preCreate({}): created relationshipDef vertex {}," +
- " edge1 as {}, edge2 as {} ", relationshipDef, relationshipDefVertex, edge1, edge2);
+ " and one edge as {}, because end1 and end2 have the same type and name", relationshipDef, relationshipDefVertex, edge1);
}
+
} else {
+ AtlasEdge edge2 = typeDefStore.getOrCreateEdge(relationshipDefVertex, end2TypeVertex, AtlasGraphUtilsV1.RELATIONSHIPTYPE_EDGE_LABEL);
if (LOG.isDebugEnabled()) {
LOG.debug("AtlasRelationshipDefStoreV1.preCreate({}): created relationshipDef vertex {}," +
- " and one edge as {} , because end1 and and end2 has same type and name", relationshipDef, relationshipDefVertex, edge1);
+ " edge1 as {}, edge2 as {} ", relationshipDef, relationshipDefVertex, edge1, edge2);
}
- }
-
- LOG.debug("<== AtlasRelationshipDefStoreV1.preCreate({}): {}", relationshipDef, relationshipDefVertex);
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("<== AtlasRelationshipDefStoreV1.preCreate({}): {}", relationshipDef, relationshipDefVertex);
+ }
return relationshipDefVertex;
}