Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
5651f934
Commit
5651f934
authored
Mar 04, 2019
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3063: updated entity create/update to enable relationship-type to be…
ATLAS-3063: updated entity create/update to enable relationship-type to be specified for relationship attributes
parent
ffa96f75
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
268 additions
and
175 deletions
+268
-175
AtlasRelatedObjectId.java
...org/apache/atlas/model/instance/AtlasRelatedObjectId.java
+67
-20
AtlasEntityType.java
.../src/main/java/org/apache/atlas/type/AtlasEntityType.java
+85
-56
AtlasRelationshipType.java
...ain/java/org/apache/atlas/type/AtlasRelationshipType.java
+8
-10
AtlasStructType.java
.../src/main/java/org/apache/atlas/type/AtlasStructType.java
+1
-1
AtlasEntityUtil.java
...src/main/java/org/apache/atlas/utils/AtlasEntityUtil.java
+18
-4
TestAtlasRelationshipType.java
...java/org/apache/atlas/type/TestAtlasRelationshipType.java
+9
-9
EntityDiscoveryService.java
...va/org/apache/atlas/discovery/EntityDiscoveryService.java
+1
-2
SearchContext.java
...c/main/java/org/apache/atlas/discovery/SearchContext.java
+2
-1
GraphHelper.java
...n/java/org/apache/atlas/repository/graph/GraphHelper.java
+9
-24
ExportService.java
...ava/org/apache/atlas/repository/impexp/ExportService.java
+10
-6
ExportTypeProcessor.java
...g/apache/atlas/repository/impexp/ExportTypeProcessor.java
+11
-7
AtlasEntityGraphDiscoveryV2.java
...epository/store/graph/v2/AtlasEntityGraphDiscoveryV2.java
+12
-4
AtlasEntityStoreV2.java
...e/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
+6
-3
AtlasGraphUtilsV2.java
...he/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
+0
-4
AtlasRelationshipDefStoreV2.java
...epository/store/graph/v2/AtlasRelationshipDefStoreV2.java
+1
-0
AtlasRelationshipStoreV2.java
...s/repository/store/graph/v2/AtlasRelationshipStoreV2.java
+2
-3
EntityGraphMapper.java
...he/atlas/repository/store/graph/v2/EntityGraphMapper.java
+12
-9
EntityGraphRetriever.java
...atlas/repository/store/graph/v2/EntityGraphRetriever.java
+14
-12
No files found.
intg/src/main/java/org/apache/atlas/model/instance/AtlasRelatedObjectId.java
View file @
5651f934
...
@@ -43,14 +43,17 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_
...
@@ -43,14 +43,17 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_
public
class
AtlasRelatedObjectId
extends
AtlasObjectId
implements
Serializable
{
public
class
AtlasRelatedObjectId
extends
AtlasObjectId
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
static
final
String
KEY_RELATIONSHIP_TYPE
=
"relationshipType"
;
public
static
final
String
KEY_RELATIONSHIP_GUID
=
"relationshipGuid"
;
public
static
final
String
KEY_RELATIONSHIP_GUID
=
"relationshipGuid"
;
public
static
final
String
KEY_RELATIONSHIP_STATUS
=
"relationshipStatus"
;
public
static
final
String
KEY_RELATIONSHIP_ATTRIBUTES
=
"relationshipAttributes"
;
public
static
final
String
KEY_RELATIONSHIP_ATTRIBUTES
=
"relationshipAttributes"
;
private
AtlasEntity
.
Status
entityStatus
=
null
;
private
AtlasEntity
.
Status
entityStatus
=
null
;
private
String
displayText
=
null
;
private
String
displayText
=
null
;
private
String
relationshipType
=
null
;
private
String
relationshipGuid
=
null
;
private
String
relationshipGuid
=
null
;
private
AtlasRelationship
.
Status
relationshipStatus
=
null
;
private
AtlasRelationship
.
Status
relationshipStatus
=
null
;
private
AtlasStruct
relationshipAttributes
;
private
AtlasStruct
relationshipAttributes
=
null
;
public
AtlasRelatedObjectId
()
{
}
public
AtlasRelatedObjectId
()
{
}
...
@@ -76,17 +79,76 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
...
@@ -76,17 +79,76 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
setRelationshipAttributes
(
relationshipAttributes
);
setRelationshipAttributes
(
relationshipAttributes
);
}
}
public
AtlasRelatedObjectId
(
AtlasObjectId
other
)
{
super
(
other
);
}
public
AtlasRelatedObjectId
(
Map
objIdMap
)
{
super
(
objIdMap
);
if
(
objIdMap
!=
null
)
{
Object
g
=
objIdMap
.
get
(
KEY_RELATIONSHIP_GUID
);
Object
t
=
objIdMap
.
get
(
KEY_RELATIONSHIP_TYPE
);
Object
a
=
objIdMap
.
get
(
KEY_RELATIONSHIP_ATTRIBUTES
);
Object
s
=
objIdMap
.
get
(
KEY_RELATIONSHIP_STATUS
);
if
(
g
!=
null
)
{
setRelationshipGuid
(
g
.
toString
());
}
if
(
a
instanceof
Map
)
{
setRelationshipAttributes
(
new
AtlasStruct
((
Map
)
a
));
}
else
if
(
a
instanceof
AtlasStruct
)
{
setRelationshipAttributes
(
new
AtlasStruct
((
AtlasStruct
)
a
));
}
if
(
t
!=
null
)
{
setRelationshipType
(
t
.
toString
());
}
if
(
s
!=
null
)
{
setRelationshipStatus
(
AtlasRelationship
.
Status
.
valueOf
(
s
.
toString
()));
}
}
}
public
AtlasEntity
.
Status
getEntityStatus
()
{
return
entityStatus
;
}
public
void
setEntityStatus
(
AtlasEntity
.
Status
entityStatus
)
{
this
.
entityStatus
=
entityStatus
;
}
public
String
getDisplayText
()
{
return
displayText
;
}
public
String
getDisplayText
()
{
return
displayText
;
}
public
void
setDisplayText
(
String
displayText
)
{
this
.
displayText
=
displayText
;
}
public
void
setDisplayText
(
String
displayText
)
{
this
.
displayText
=
displayText
;
}
public
String
getRelationshipType
()
{
return
relationshipType
;
}
public
void
setRelationshipType
(
String
relationshipType
)
{
this
.
relationshipType
=
relationshipType
;
}
public
String
getRelationshipGuid
()
{
return
relationshipGuid
;
}
public
String
getRelationshipGuid
()
{
return
relationshipGuid
;
}
public
void
setRelationshipGuid
(
String
relationshipGuid
)
{
this
.
relationshipGuid
=
relationshipGuid
;
}
public
void
setRelationshipGuid
(
String
relationshipGuid
)
{
this
.
relationshipGuid
=
relationshipGuid
;
}
public
AtlasRelationship
.
Status
getRelationshipStatus
()
{
return
relationshipStatus
;
}
public
void
setRelationshipStatus
(
final
AtlasRelationship
.
Status
relationshipStatus
)
{
this
.
relationshipStatus
=
relationshipStatus
;
}
public
AtlasStruct
getRelationshipAttributes
()
{
return
relationshipAttributes
;
}
public
AtlasStruct
getRelationshipAttributes
()
{
return
relationshipAttributes
;
}
public
void
setRelationshipAttributes
(
AtlasStruct
relationshipAttributes
)
{
this
.
relationshipAttributes
=
relationshipAttributes
;
}
public
void
setRelationshipAttributes
(
AtlasStruct
relationshipAttributes
)
{
this
.
relationshipAttributes
=
relationshipAttributes
;
if
(
relationshipAttributes
!=
null
&&
relationshipAttributes
.
getTypeName
()
!=
null
)
{
setRelationshipType
(
relationshipAttributes
.
getTypeName
());
}
}
@Override
@Override
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
...
@@ -96,6 +158,7 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
...
@@ -96,6 +158,7 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
AtlasRelatedObjectId
that
=
(
AtlasRelatedObjectId
)
o
;
AtlasRelatedObjectId
that
=
(
AtlasRelatedObjectId
)
o
;
return
Objects
.
equals
(
entityStatus
,
that
.
entityStatus
)
&&
return
Objects
.
equals
(
entityStatus
,
that
.
entityStatus
)
&&
Objects
.
equals
(
displayText
,
that
.
displayText
)
&&
Objects
.
equals
(
displayText
,
that
.
displayText
)
&&
Objects
.
equals
(
relationshipType
,
that
.
relationshipType
)
&&
Objects
.
equals
(
relationshipGuid
,
that
.
relationshipGuid
)
&&
Objects
.
equals
(
relationshipGuid
,
that
.
relationshipGuid
)
&&
Objects
.
equals
(
relationshipStatus
,
that
.
relationshipStatus
)
&&
Objects
.
equals
(
relationshipStatus
,
that
.
relationshipStatus
)
&&
Objects
.
equals
(
relationshipAttributes
,
that
.
relationshipAttributes
);
Objects
.
equals
(
relationshipAttributes
,
that
.
relationshipAttributes
);
...
@@ -103,7 +166,7 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
...
@@ -103,7 +166,7 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
Objects
.
hash
(
super
.
hashCode
(),
displayText
,
relationshipGuid
,
relationshipStatus
,
relationshipAttributes
);
return
Objects
.
hash
(
super
.
hashCode
(),
displayText
,
relationship
Type
,
relationship
Guid
,
relationshipStatus
,
relationshipAttributes
);
}
}
@Override
@Override
...
@@ -121,6 +184,7 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
...
@@ -121,6 +184,7 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
super
.
toString
(
sb
);
super
.
toString
(
sb
);
sb
.
append
(
"entityStatus='"
).
append
(
entityStatus
).
append
(
'\''
);
sb
.
append
(
"entityStatus='"
).
append
(
entityStatus
).
append
(
'\''
);
sb
.
append
(
", displayText='"
).
append
(
displayText
).
append
(
'\''
);
sb
.
append
(
", displayText='"
).
append
(
displayText
).
append
(
'\''
);
sb
.
append
(
", relationshipType='"
).
append
(
relationshipType
).
append
(
'\''
);
sb
.
append
(
", relationshipGuid='"
).
append
(
relationshipGuid
).
append
(
'\''
);
sb
.
append
(
", relationshipGuid='"
).
append
(
relationshipGuid
).
append
(
'\''
);
sb
.
append
(
", relationshipStatus='"
).
append
(
relationshipStatus
).
append
(
'\''
);
sb
.
append
(
", relationshipStatus='"
).
append
(
relationshipStatus
).
append
(
'\''
);
sb
.
append
(
", relationshipAttributes="
).
append
(
relationshipAttributes
);
sb
.
append
(
", relationshipAttributes="
).
append
(
relationshipAttributes
);
...
@@ -128,20 +192,4 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
...
@@ -128,20 +192,4 @@ public class AtlasRelatedObjectId extends AtlasObjectId implements Serializable
return
sb
;
return
sb
;
}
}
public
AtlasRelationship
.
Status
getRelationshipStatus
()
{
return
relationshipStatus
;
}
public
void
setRelationshipStatus
(
final
AtlasRelationship
.
Status
relationshipStatus
)
{
this
.
relationshipStatus
=
relationshipStatus
;
}
public
AtlasEntity
.
Status
getEntityStatus
()
{
return
entityStatus
;
}
public
void
setEntityStatus
(
AtlasEntity
.
Status
entityStatus
)
{
this
.
entityStatus
=
entityStatus
;
}
}
}
\ No newline at end of file
intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
View file @
5651f934
...
@@ -26,6 +26,7 @@ import org.apache.atlas.model.instance.AtlasStruct;
...
@@ -26,6 +26,7 @@ import org.apache.atlas.model.instance.AtlasStruct;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.type.AtlasBuiltInTypes.AtlasObjectIdType
;
import
org.apache.atlas.type.AtlasBuiltInTypes.AtlasObjectIdType
;
import
org.apache.atlas.utils.AtlasEntityUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
...
@@ -33,6 +34,7 @@ import org.slf4j.Logger;
...
@@ -33,6 +34,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
...
@@ -66,8 +68,7 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -66,8 +68,7 @@ public class AtlasEntityType extends AtlasStructType {
private
Set
<
String
>
allSubTypes
=
Collections
.
emptySet
();
private
Set
<
String
>
allSubTypes
=
Collections
.
emptySet
();
private
Set
<
String
>
typeAndAllSubTypes
=
Collections
.
emptySet
();
private
Set
<
String
>
typeAndAllSubTypes
=
Collections
.
emptySet
();
private
Set
<
String
>
typeAndAllSuperTypes
=
Collections
.
emptySet
();
private
Set
<
String
>
typeAndAllSuperTypes
=
Collections
.
emptySet
();
private
Map
<
String
,
AtlasAttribute
>
relationshipAttributes
=
Collections
.
emptyMap
();
private
Map
<
String
,
Map
<
String
,
AtlasAttribute
>>
relationshipAttributes
=
Collections
.
emptyMap
();
private
Map
<
String
,
List
<
AtlasRelationshipType
>>
relationshipAttributesType
=
Collections
.
emptyMap
();
private
List
<
AtlasAttribute
>
ownedRefAttributes
=
Collections
.
emptyList
();
private
List
<
AtlasAttribute
>
ownedRefAttributes
=
Collections
.
emptyList
();
private
String
typeAndAllSubTypesQryStr
=
""
;
private
String
typeAndAllSubTypesQryStr
=
""
;
private
boolean
isInternalType
=
false
;
private
boolean
isInternalType
=
false
;
...
@@ -123,7 +124,6 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -123,7 +124,6 @@ public class AtlasEntityType extends AtlasStructType {
this
.
allSubTypes
=
new
HashSet
<>();
// this will be populated in resolveReferencesPhase2()
this
.
allSubTypes
=
new
HashSet
<>();
// this will be populated in resolveReferencesPhase2()
this
.
typeAndAllSubTypes
=
new
HashSet
<>();
// this will be populated in resolveReferencesPhase2()
this
.
typeAndAllSubTypes
=
new
HashSet
<>();
// this will be populated in resolveReferencesPhase2()
this
.
relationshipAttributes
=
new
HashMap
<>();
// this will be populated in resolveReferencesPhase3()
this
.
relationshipAttributes
=
new
HashMap
<>();
// this will be populated in resolveReferencesPhase3()
this
.
relationshipAttributesType
=
new
HashMap
<>();
// this will be populated in resolveReferencesPhase3()
this
.
typeAndAllSubTypes
.
add
(
this
.
getTypeName
());
this
.
typeAndAllSubTypes
.
add
(
this
.
getTypeName
());
...
@@ -194,17 +194,28 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -194,17 +194,28 @@ public class AtlasEntityType extends AtlasStructType {
}
}
AtlasEntityType
superType
=
typeRegistry
.
getEntityTypeByName
(
superTypeName
);
AtlasEntityType
superType
=
typeRegistry
.
getEntityTypeByName
(
superTypeName
);
Map
<
String
,
Map
<
String
,
AtlasAttribute
>>
superTypeRelationshipAttributes
=
superType
.
getRelationshipAttributes
();
Map
<
String
,
AtlasAttribute
>
superTypeRelationshipAttributes
=
superType
.
getRelationshipAttributes
();
if
(
MapUtils
.
isNotEmpty
(
superTypeRelationshipAttributes
))
{
if
(
MapUtils
.
isNotEmpty
(
superTypeRelationshipAttributes
))
{
relationshipAttributes
.
putAll
(
superTypeRelationshipAttributes
);
for
(
String
attrName
:
superTypeRelationshipAttributes
.
keySet
())
{
}
Map
<
String
,
AtlasAttribute
>
superTypeAttributes
=
superTypeRelationshipAttributes
.
get
(
attrName
);
Map
<
String
,
List
<
AtlasRelationshipType
>>
superTypeRelationshipAttributesType
=
superType
.
getRelationshipAttributesType
();
if
(
MapUtils
.
isNotEmpty
(
superTypeAttributes
))
{
Map
<
String
,
AtlasAttribute
>
attributes
=
relationshipAttributes
.
get
(
attrName
);
if
(
MapUtils
.
isNotEmpty
(
superTypeRelationshipAttributesType
))
{
if
(
attributes
==
null
)
{
relationshipAttributesType
.
putAll
(
superTypeRelationshipAttributesType
);
attributes
=
new
HashMap
<>();
relationshipAttributes
.
put
(
attrName
,
attributes
);
}
for
(
String
relationshipType
:
superTypeAttributes
.
keySet
())
{
if
(!
attributes
.
containsKey
(
relationshipType
))
{
attributes
.
put
(
relationshipType
,
superTypeAttributes
.
get
(
relationshipType
));
}
}
}
}
}
}
}
}
...
@@ -216,18 +227,19 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -216,18 +227,19 @@ public class AtlasEntityType extends AtlasStructType {
}
}
}
}
for
(
AtlasAttribute
attribute
:
relationshipAttributes
.
values
())
{
for
(
Map
<
String
,
AtlasAttribute
>
attributes
:
relationshipAttributes
.
values
())
{
for
(
AtlasAttribute
attribute
:
attributes
.
values
())
{
if
(
attribute
.
isOwnedRef
())
{
if
(
attribute
.
isOwnedRef
())
{
ownedRefAttributes
.
add
(
attribute
);
ownedRefAttributes
.
add
(
attribute
);
}
}
}
}
}
subTypes
=
Collections
.
unmodifiableSet
(
subTypes
);
subTypes
=
Collections
.
unmodifiableSet
(
subTypes
);
allSubTypes
=
Collections
.
unmodifiableSet
(
allSubTypes
);
allSubTypes
=
Collections
.
unmodifiableSet
(
allSubTypes
);
typeAndAllSubTypes
=
Collections
.
unmodifiableSet
(
typeAndAllSubTypes
);
typeAndAllSubTypes
=
Collections
.
unmodifiableSet
(
typeAndAllSubTypes
);
typeAndAllSubTypesQryStr
=
""
;
// will be computed on next access
typeAndAllSubTypesQryStr
=
""
;
// will be computed on next access
relationshipAttributes
=
Collections
.
unmodifiableMap
(
relationshipAttributes
);
relationshipAttributes
=
Collections
.
unmodifiableMap
(
relationshipAttributes
);
relationshipAttributesType
=
Collections
.
unmodifiableMap
(
relationshipAttributesType
);
ownedRefAttributes
=
Collections
.
unmodifiableList
(
ownedRefAttributes
);
ownedRefAttributes
=
Collections
.
unmodifiableList
(
ownedRefAttributes
);
entityDef
.
setSubTypes
(
subTypes
);
entityDef
.
setSubTypes
(
subTypes
);
...
@@ -285,7 +297,7 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -285,7 +297,7 @@ public class AtlasEntityType extends AtlasStructType {
return
isInternalType
;
return
isInternalType
;
}
}
public
Map
<
String
,
AtlasAttribute
>
getRelationshipAttributes
()
{
public
Map
<
String
,
Map
<
String
,
AtlasAttribute
>
>
getRelationshipAttributes
()
{
return
relationshipAttributes
;
return
relationshipAttributes
;
}
}
...
@@ -293,33 +305,40 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -293,33 +305,40 @@ public class AtlasEntityType extends AtlasStructType {
return
ownedRefAttributes
;
return
ownedRefAttributes
;
}
}
public
AtlasAttribute
getRelationshipAttribute
(
String
attributeName
)
{
public
AtlasAttribute
getRelationshipAttribute
(
String
attributeName
,
String
relationshipType
)
{
return
relationshipAttributes
.
get
(
attributeName
);
final
AtlasAttribute
ret
;
Map
<
String
,
AtlasAttribute
>
attributes
=
relationshipAttributes
.
get
(
attributeName
);
if
(
MapUtils
.
isNotEmpty
(
attributes
))
{
if
(
relationshipType
!=
null
&&
attributes
.
containsKey
(
relationshipType
))
{
ret
=
attributes
.
get
(
relationshipType
);
}
else
{
ret
=
attributes
.
values
().
iterator
().
next
();
}
}
else
{
ret
=
null
;
}
}
// this method should be called from AtlasRelationshipType.resolveReferencesPhase2()
return
ret
;
void
addRelationshipAttribute
(
String
attributeName
,
AtlasAttribute
attribute
)
{
relationshipAttributes
.
put
(
attributeName
,
attribute
);
}
}
// this method should be called from AtlasRelationshipType.resolveReferencesPhase2()
// this method should be called from AtlasRelationshipType.resolveReferencesPhase2()
void
addRelationshipAttribute
Type
(
String
attributeNam
e
,
AtlasRelationshipType
relationshipType
)
{
void
addRelationshipAttribute
(
String
attributeName
,
AtlasAttribute
attribut
e
,
AtlasRelationshipType
relationshipType
)
{
List
<
AtlasRelationshipType
>
relationshipTypes
=
relationshipAttributesType
.
get
(
attributeName
);
Map
<
String
,
AtlasAttribute
>
attributes
=
relationshipAttributes
.
get
(
attributeName
);
if
(
relationshipTypes
==
null
)
{
if
(
attributes
==
null
)
{
relationshipTypes
=
new
ArrayList
<>();
attributes
=
new
HashMap
<>();
relationshipAttributesType
.
put
(
attributeName
,
relationshipTypes
);
}
relationshipTypes
.
add
(
relationshipType
);
relationshipAttributes
.
put
(
attributeName
,
attributes
);
}
}
public
List
<
AtlasRelationshipType
>
getRelationshipAttributeType
(
String
attributeName
)
{
attributes
.
put
(
relationshipType
.
getTypeName
(),
attribute
);
return
relationshipAttributesType
.
get
(
attributeName
);
}
}
public
Map
<
String
,
List
<
AtlasRelationshipType
>>
getRelationshipAttributesType
()
{
public
Collection
<
String
>
getAttributeRelationshipTypes
(
String
attributeName
)
{
return
relationshipAttributesType
;
Map
<
String
,
AtlasAttribute
>
attributes
=
relationshipAttributes
.
get
(
attributeName
);
return
attributes
!=
null
?
attributes
.
keySet
()
:
null
;
}
}
public
String
getTypeAndAllSubTypesQryStr
()
{
public
String
getTypeAndAllSubTypesQryStr
()
{
...
@@ -342,7 +361,7 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -342,7 +361,7 @@ public class AtlasEntityType extends AtlasStructType {
if
(
allAttributes
.
containsKey
(
attrName
))
{
if
(
allAttributes
.
containsKey
(
attrName
))
{
return
allAttributes
.
get
(
attrName
).
getQualifiedName
();
return
allAttributes
.
get
(
attrName
).
getQualifiedName
();
}
else
if
(
relationshipAttributes
.
containsKey
(
attrName
))
{
}
else
if
(
relationshipAttributes
.
containsKey
(
attrName
))
{
return
relationshipAttributes
.
get
(
attrName
).
getQualifiedName
();
return
relationshipAttributes
.
get
(
attrName
).
values
().
iterator
().
next
().
getQualifiedName
();
}
}
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNKNOWN_ATTRIBUTE
,
attrName
,
entityDef
.
getName
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNKNOWN_ATTRIBUTE
,
attrName
,
entityDef
.
getName
());
...
@@ -618,8 +637,10 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -618,8 +637,10 @@ public class AtlasEntityType extends AtlasStructType {
if
(
obj
instanceof
AtlasEntity
)
{
if
(
obj
instanceof
AtlasEntity
)
{
AtlasEntity
entityObj
=
(
AtlasEntity
)
obj
;
AtlasEntity
entityObj
=
(
AtlasEntity
)
obj
;
for
(
AtlasAttribute
attribute
:
relationshipAttributes
.
values
())
{
for
(
String
attributeName
:
relationshipAttributes
.
keySet
())
{
Object
attributeValue
=
entityObj
.
getRelationshipAttribute
(
attribute
.
getName
());
Object
attributeValue
=
entityObj
.
getRelationshipAttribute
(
attributeName
);
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
attributeValue
);
AtlasAttribute
attribute
=
getRelationshipAttribute
(
attributeName
,
relationshipType
);
AtlasAttributeDef
attributeDef
=
attribute
.
getAttributeDef
();
AtlasAttributeDef
attributeDef
=
attribute
.
getAttributeDef
();
if
(!
isAssignableValue
(
attributeValue
,
attributeDef
))
{
if
(!
isAssignableValue
(
attributeValue
,
attributeDef
))
{
...
@@ -629,8 +650,10 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -629,8 +650,10 @@ public class AtlasEntityType extends AtlasStructType {
}
else
if
(
obj
instanceof
Map
)
{
}
else
if
(
obj
instanceof
Map
)
{
Map
map
=
AtlasTypeUtil
.
toRelationshipAttributes
((
Map
)
obj
);
Map
map
=
AtlasTypeUtil
.
toRelationshipAttributes
((
Map
)
obj
);
for
(
AtlasAttribute
attribute
:
relationshipAttributes
.
values
())
{
for
(
String
attributeName
:
relationshipAttributes
.
keySet
())
{
Object
attributeValue
=
map
.
get
(
attribute
.
getName
());
Object
attributeValue
=
map
.
get
(
attributeName
);
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
attributeValue
);
AtlasAttribute
attribute
=
getRelationshipAttribute
(
attributeName
,
relationshipType
);
AtlasAttributeDef
attributeDef
=
attribute
.
getAttributeDef
();
AtlasAttributeDef
attributeDef
=
attribute
.
getAttributeDef
();
if
(!
isAssignableValue
(
attributeValue
,
attributeDef
))
{
if
(!
isAssignableValue
(
attributeValue
,
attributeDef
))
{
...
@@ -671,7 +694,8 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -671,7 +694,8 @@ public class AtlasEntityType extends AtlasStructType {
boolean
ret
=
true
;
boolean
ret
=
true
;
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
AtlasAttribute
attribute
=
relationshipAttributes
.
get
(
attributeDef
.
getName
());
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
value
);
AtlasAttribute
attribute
=
getRelationshipAttribute
(
attributeDef
.
getName
(),
relationshipType
);
if
(
attribute
!=
null
)
{
if
(
attribute
!=
null
)
{
AtlasType
attrType
=
attribute
.
getAttributeType
();
AtlasType
attrType
=
attribute
.
getAttributeType
();
...
@@ -705,12 +729,14 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -705,12 +729,14 @@ public class AtlasEntityType extends AtlasStructType {
if
(
obj
!=
null
&&
obj
instanceof
AtlasEntity
)
{
if
(
obj
!=
null
&&
obj
instanceof
AtlasEntity
)
{
AtlasEntity
entityObj
=
(
AtlasEntity
)
obj
;
AtlasEntity
entityObj
=
(
AtlasEntity
)
obj
;
for
(
AtlasAttribute
attribute
:
relationshipAttributes
.
values
())
{
for
(
String
attributeName
:
relationshipAttributes
.
keySet
())
{
String
attributeName
=
attribute
.
getName
();
if
(
entityObj
.
hasRelationshipAttribute
(
attributeName
))
{
Object
attributeValue
=
entityObj
.
getRelationshipAttribute
(
attributeName
);
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
attributeValue
);
AtlasAttribute
attribute
=
getRelationshipAttribute
(
attributeName
,
relationshipType
);
AtlasAttributeDef
attributeDef
=
attribute
.
getAttributeDef
();
AtlasAttributeDef
attributeDef
=
attribute
.
getAttributeDef
();
if
(
entityObj
.
hasRelationshipAttribute
(
attributeName
))
{
attributeValue
=
getNormalizedValue
(
attributeValue
,
attributeDef
);
Object
attributeValue
=
getNormalizedValue
(
entityObj
.
getRelationshipAttribute
(
attributeName
),
attributeDef
);
entityObj
.
setRelationshipAttribute
(
attributeName
,
attributeValue
);
entityObj
.
setRelationshipAttribute
(
attributeName
,
attributeValue
);
}
}
...
@@ -720,12 +746,14 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -720,12 +746,14 @@ public class AtlasEntityType extends AtlasStructType {
public
void
normalizeRelationshipAttributeValues
(
Map
<
String
,
Object
>
obj
)
{
public
void
normalizeRelationshipAttributeValues
(
Map
<
String
,
Object
>
obj
)
{
if
(
obj
!=
null
)
{
if
(
obj
!=
null
)
{
for
(
AtlasAttribute
attribute
:
relationshipAttributes
.
values
())
{
for
(
String
attributeName
:
relationshipAttributes
.
keySet
())
{
String
attributeName
=
attribute
.
getName
();
if
(
obj
.
containsKey
(
attributeName
))
{
Object
attributeValue
=
obj
.
get
(
attributeName
);
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
attributeValue
);
AtlasAttribute
attribute
=
getRelationshipAttribute
(
attributeName
,
relationshipType
);
AtlasAttributeDef
attributeDef
=
attribute
.
getAttributeDef
();
AtlasAttributeDef
attributeDef
=
attribute
.
getAttributeDef
();
if
(
obj
.
containsKey
(
attributeName
))
{
attributeValue
=
getNormalizedValue
(
attributeValue
,
attributeDef
);
Object
attributeValue
=
getNormalizedValue
(
obj
.
get
(
attributeName
),
attributeDef
);
obj
.
put
(
attributeName
,
attributeValue
);
obj
.
put
(
attributeName
,
attributeValue
);
}
}
...
@@ -734,7 +762,8 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -734,7 +762,8 @@ public class AtlasEntityType extends AtlasStructType {
}
}
private
Object
getNormalizedValue
(
Object
value
,
AtlasAttributeDef
attributeDef
)
{
private
Object
getNormalizedValue
(
Object
value
,
AtlasAttributeDef
attributeDef
)
{
AtlasAttribute
attribute
=
relationshipAttributes
.
get
(
attributeDef
.
getName
());
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
value
);
AtlasAttribute
attribute
=
getRelationshipAttribute
(
attributeDef
.
getName
(),
relationshipType
);
if
(
attribute
!=
null
)
{
if
(
attribute
!=
null
)
{
AtlasType
attrType
=
attribute
.
getAttributeType
();
AtlasType
attrType
=
attribute
.
getAttributeType
();
...
@@ -766,12 +795,13 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -766,12 +795,13 @@ public class AtlasEntityType extends AtlasStructType {
if
(
obj
instanceof
AtlasEntity
)
{
if
(
obj
instanceof
AtlasEntity
)
{
AtlasEntity
entityObj
=
(
AtlasEntity
)
obj
;
AtlasEntity
entityObj
=
(
AtlasEntity
)
obj
;
for
(
AtlasAttribute
attribute
:
relationshipAttributes
.
values
())
{
for
(
String
attributeName
:
relationshipAttributes
.
keySet
())
{
Object
value
=
entityObj
.
getAttribute
(
attributeName
);
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
value
);
AtlasAttribute
attribute
=
getRelationshipAttribute
(
attributeName
,
relationshipType
);
if
(
attribute
!=
null
)
{
if
(
attribute
!=
null
)
{
String
attributeName
=
attribute
.
getName
();
AtlasType
dataType
=
attribute
.
getAttributeType
();
AtlasType
dataType
=
attribute
.
getAttributeType
();
Object
value
=
entityObj
.
getAttribute
(
attributeName
);
String
fieldName
=
objName
+
"."
+
attributeName
;
if
(!
attribute
.
getAttributeDef
().
getIsOptional
())
{
if
(!
attribute
.
getAttributeDef
().
getIsOptional
())
{
// if required attribute is null, check if attribute value specified in relationship
// if required attribute is null, check if attribute value specified in relationship
...
@@ -781,29 +811,28 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -781,29 +811,28 @@ public class AtlasEntityType extends AtlasStructType {
if
(
value
==
null
)
{
if
(
value
==
null
)
{
ret
=
false
;
ret
=
false
;
messages
.
add
(
field
Name
+
": mandatory attribute value missing in type "
+
getTypeName
());
messages
.
add
(
objName
+
"."
+
attribute
Name
+
": mandatory attribute value missing in type "
+
getTypeName
());
}
}
}
}
if
(
isValidRelationshipType
(
dataType
)
&&
value
!=
null
)
{
if
(
isValidRelationshipType
(
dataType
)
&&
value
!=
null
)
{
ret
=
dataType
.
validateValue
(
value
,
field
Name
,
messages
)
&&
ret
;
ret
=
dataType
.
validateValue
(
value
,
objName
+
"."
+
attribute
Name
,
messages
)
&&
ret
;
}
}
}
}
}
}
}
else
if
(
obj
instanceof
Map
)
{
}
else
if
(
obj
instanceof
Map
)
{
Map
attributes
=
AtlasTypeUtil
.
toStructAttributes
((
Map
)
obj
);
Map
attributes
=
AtlasTypeUtil
.
toStructAttributes
((
Map
)
obj
);
for
(
AtlasAttribute
attribute
:
relationshipAttributes
.
values
())
{
for
(
String
attributeName
:
relationshipAttributes
.
keySet
())
{
Object
value
=
attributes
.
get
(
attributeName
);
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
value
);
AtlasAttribute
attribute
=
getRelationshipAttribute
(
attributeName
,
relationshipType
);
if
(
attribute
!=
null
)
{
if
(
attribute
!=
null
)
{
String
attributeName
=
attribute
.
getName
();
AtlasType
dataType
=
attribute
.
getAttributeType
();
AtlasType
dataType
=
attribute
.
getAttributeType
();
Object
value
=
attributes
.
get
(
attributeName
);
String
fieldName
=
objName
+
"."
+
attributeName
;
if
(
isValidRelationshipType
(
dataType
)
&&
value
!=
null
)
{
if
(
isValidRelationshipType
(
dataType
)
&&
value
!=
null
)
{
ret
=
dataType
.
validateValue
(
value
,
field
Name
,
messages
)
&&
ret
;
ret
=
dataType
.
validateValue
(
value
,
objName
+
"."
+
attribute
Name
,
messages
)
&&
ret
;
}
}
}
}
}
}
...
...
intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java
View file @
5651f934
...
@@ -123,9 +123,9 @@ public class AtlasRelationshipType extends AtlasStructType {
...
@@ -123,9 +123,9 @@ public class AtlasRelationshipType extends AtlasStructType {
relationshipLabel
=
getLegacyEdgeLabel
(
end2Type
,
endDef2
.
getName
());
relationshipLabel
=
getLegacyEdgeLabel
(
end2Type
,
endDef2
.
getName
());
}
}
addRelationshipAttributeToEndType
(
endDef1
,
end1Type
,
end2Type
.
getTypeName
(),
typeRegistry
,
relationshipLabel
,
relationshipDef
.
getRelationshipCategory
()
);
addRelationshipAttributeToEndType
(
endDef1
,
end1Type
,
end2Type
.
getTypeName
(),
typeRegistry
,
relationshipLabel
);
addRelationshipAttributeToEndType
(
endDef2
,
end2Type
,
end1Type
.
getTypeName
(),
typeRegistry
,
relationshipLabel
,
relationshipDef
.
getRelationshipCategory
()
);
addRelationshipAttributeToEndType
(
endDef2
,
end2Type
,
end1Type
.
getTypeName
(),
typeRegistry
,
relationshipLabel
);
// add relationship edge direction information
// add relationship edge direction information
addRelationshipEdgeDirection
();
addRelationshipEdgeDirection
();
...
@@ -138,12 +138,12 @@ public class AtlasRelationshipType extends AtlasStructType {
...
@@ -138,12 +138,12 @@ public class AtlasRelationshipType extends AtlasStructType {
if
(
StringUtils
.
equals
(
endDef1
.
getType
(),
endDef2
.
getType
())
&&
if
(
StringUtils
.
equals
(
endDef1
.
getType
(),
endDef2
.
getType
())
&&
StringUtils
.
equals
(
endDef1
.
getName
(),
endDef2
.
getName
()))
{
StringUtils
.
equals
(
endDef1
.
getName
(),
endDef2
.
getName
()))
{
AtlasAttribute
endAttribute
=
end1Type
.
getRelationshipAttribute
(
endDef1
.
getName
());
AtlasAttribute
endAttribute
=
end1Type
.
getRelationshipAttribute
(
endDef1
.
getName
()
,
relationshipDef
.
getName
()
);
endAttribute
.
setRelationshipEdgeDirection
(
BOTH
);
endAttribute
.
setRelationshipEdgeDirection
(
BOTH
);
}
else
{
}
else
{
AtlasAttribute
end1Attribute
=
end1Type
.
getRelationshipAttribute
(
endDef1
.
getName
());
AtlasAttribute
end1Attribute
=
end1Type
.
getRelationshipAttribute
(
endDef1
.
getName
()
,
relationshipDef
.
getName
()
);
AtlasAttribute
end2Attribute
=
end2Type
.
getRelationshipAttribute
(
endDef2
.
getName
());
AtlasAttribute
end2Attribute
=
end2Type
.
getRelationshipAttribute
(
endDef2
.
getName
()
,
relationshipDef
.
getName
()
);
//default relationship edge direction is end1 (out) -> end2 (in)
//default relationship edge direction is end1 (out) -> end2 (in)
AtlasRelationshipEdgeDirection
end1Direction
=
OUT
;
AtlasRelationshipEdgeDirection
end1Direction
=
OUT
;
...
@@ -296,7 +296,7 @@ public class AtlasRelationshipType extends AtlasStructType {
...
@@ -296,7 +296,7 @@ public class AtlasRelationshipType extends AtlasStructType {
}
}
private
void
addRelationshipAttributeToEndType
(
AtlasRelationshipEndDef
endDef
,
AtlasEntityType
entityType
,
String
attrTypeName
,
private
void
addRelationshipAttributeToEndType
(
AtlasRelationshipEndDef
endDef
,
AtlasEntityType
entityType
,
String
attrTypeName
,
AtlasTypeRegistry
typeRegistry
,
String
relationshipLabel
,
RelationshipCategory
relationshipCategory
)
throws
AtlasBaseException
{
AtlasTypeRegistry
typeRegistry
,
String
relationshipLabel
)
throws
AtlasBaseException
{
String
attrName
=
(
endDef
!=
null
)
?
endDef
.
getName
()
:
null
;
String
attrName
=
(
endDef
!=
null
)
?
endDef
.
getName
()
:
null
;
...
@@ -321,7 +321,7 @@ public class AtlasRelationshipType extends AtlasStructType {
...
@@ -321,7 +321,7 @@ public class AtlasRelationshipType extends AtlasStructType {
attrTypeName
=
AtlasBaseTypeDef
.
getArrayTypeName
(
attrTypeName
);
attrTypeName
=
AtlasBaseTypeDef
.
getArrayTypeName
(
attrTypeName
);
}
}
if
(
relationship
Category
==
RelationshipCategory
.
COMPOSITION
)
{
if
(
relationship
Def
.
getRelationshipCategory
()
==
RelationshipCategory
.
COMPOSITION
)
{
if
(
endDef
.
getIsContainer
())
{
if
(
endDef
.
getIsContainer
())
{
constraint
=
new
AtlasConstraintDef
(
CONSTRAINT_TYPE_OWNED_REF
);
constraint
=
new
AtlasConstraintDef
(
CONSTRAINT_TYPE_OWNED_REF
);
}
else
{
}
else
{
...
@@ -344,9 +344,7 @@ public class AtlasRelationshipType extends AtlasStructType {
...
@@ -344,9 +344,7 @@ public class AtlasRelationshipType extends AtlasStructType {
attribute
.
setRelationshipEdgeLabel
(
relationshipLabel
);
attribute
.
setRelationshipEdgeLabel
(
relationshipLabel
);
}
}
entityType
.
addRelationshipAttribute
(
attrName
,
attribute
);
entityType
.
addRelationshipAttribute
(
attrName
,
attribute
,
this
);
entityType
.
addRelationshipAttributeType
(
attrName
,
this
);
}
}
private
String
getLegacyEdgeLabel
(
AtlasEntityType
entityType
,
String
attributeName
)
{
private
String
getLegacyEdgeLabel
(
AtlasEntityType
entityType
,
String
attributeName
)
{
...
...
intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
View file @
5651f934
...
@@ -852,7 +852,7 @@ public class AtlasStructType extends AtlasType {
...
@@ -852,7 +852,7 @@ public class AtlasStructType extends AtlasType {
}
}
private
String
getRelationshipEdgeLabel
(
String
relationshipLabel
)
{
private
String
getRelationshipEdgeLabel
(
String
relationshipLabel
)
{
return
(
relationshipLabel
==
null
)
?
getEdgeLabel
(
vertexProperty
Name
)
:
relationshipLabel
;
return
(
relationshipLabel
==
null
)
?
getEdgeLabel
(
qualified
Name
)
:
relationshipLabel
;
}
}
private
static
String
getQualifiedAttributeName
(
AtlasStructDef
structDef
,
String
attrName
)
{
private
static
String
getQualifiedAttributeName
(
AtlasStructDef
structDef
,
String
attrName
)
{
...
...
intg/src/main/java/org/apache/atlas/utils/AtlasEntityUtil.java
View file @
5651f934
...
@@ -18,11 +18,8 @@
...
@@ -18,11 +18,8 @@
package
org
.
apache
.
atlas
.
utils
;
package
org
.
apache
.
atlas
.
utils
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.model.instance.AtlasRelatedObjectId
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
...
@@ -123,4 +120,21 @@ public class AtlasEntityUtil {
...
@@ -123,4 +120,21 @@ public class AtlasEntityUtil {
return
ret
;
return
ret
;
}
}
public
static
String
getRelationshipType
(
Object
val
)
{
final
String
ret
;
if
(
val
instanceof
AtlasRelatedObjectId
)
{
ret
=
((
AtlasRelatedObjectId
)
val
).
getRelationshipType
();
}
else
if
(
val
instanceof
Map
)
{
Object
relTypeName
=
((
Map
)
val
).
get
(
AtlasRelatedObjectId
.
KEY_RELATIONSHIP_TYPE
);
ret
=
relTypeName
!=
null
?
relTypeName
.
toString
()
:
null
;
}
else
{
ret
=
null
;
}
return
ret
;
}
}
}
intg/src/test/java/org/apache/atlas/type/TestAtlasRelationshipType.java
View file @
5651f934
...
@@ -140,7 +140,7 @@ public class TestAtlasRelationshipType {
...
@@ -140,7 +140,7 @@ public class TestAtlasRelationshipType {
@Test
(
dependsOnMethods
=
"createTypesAndRelationships"
)
@Test
(
dependsOnMethods
=
"createTypesAndRelationships"
)
public
void
testRelationshipAttributes
()
throws
Exception
{
public
void
testRelationshipAttributes
()
throws
Exception
{
Map
<
String
,
AtlasAttribute
>
employeeRelationAttrs
=
getRelationAttrsForType
(
EMPLOYEE_TYPE
);
Map
<
String
,
Map
<
String
,
AtlasAttribute
>
>
employeeRelationAttrs
=
getRelationAttrsForType
(
EMPLOYEE_TYPE
);
Assert
.
assertNotNull
(
employeeRelationAttrs
);
Assert
.
assertNotNull
(
employeeRelationAttrs
);
Assert
.
assertEquals
(
employeeRelationAttrs
.
size
(),
2
);
Assert
.
assertEquals
(
employeeRelationAttrs
.
size
(),
2
);
...
@@ -148,28 +148,28 @@ public class TestAtlasRelationshipType {
...
@@ -148,28 +148,28 @@ public class TestAtlasRelationshipType {
Assert
.
assertTrue
(
employeeRelationAttrs
.
containsKey
(
"department"
));
Assert
.
assertTrue
(
employeeRelationAttrs
.
containsKey
(
"department"
));
Assert
.
assertTrue
(
employeeRelationAttrs
.
containsKey
(
"address"
));
Assert
.
assertTrue
(
employeeRelationAttrs
.
containsKey
(
"address"
));
AtlasAttribute
deptAttr
=
employeeRelationAttrs
.
get
(
"department"
);
AtlasAttribute
deptAttr
=
employeeRelationAttrs
.
get
(
"department"
)
.
values
().
iterator
().
next
()
;
Assert
.
assertEquals
(
deptAttr
.
getTypeName
(),
DEPARTMENT_TYPE
);
Assert
.
assertEquals
(
deptAttr
.
getTypeName
(),
DEPARTMENT_TYPE
);
AtlasAttribute
addrAttr
=
employeeRelationAttrs
.
get
(
"address"
);
AtlasAttribute
addrAttr
=
employeeRelationAttrs
.
get
(
"address"
)
.
values
().
iterator
().
next
()
;
Assert
.
assertEquals
(
addrAttr
.
getTypeName
(),
ADDRESS_TYPE
);
Assert
.
assertEquals
(
addrAttr
.
getTypeName
(),
ADDRESS_TYPE
);
Map
<
String
,
AtlasAttribute
>
deptRelationAttrs
=
getRelationAttrsForType
(
DEPARTMENT_TYPE
);
Map
<
String
,
Map
<
String
,
AtlasAttribute
>
>
deptRelationAttrs
=
getRelationAttrsForType
(
DEPARTMENT_TYPE
);
Assert
.
assertNotNull
(
deptRelationAttrs
);
Assert
.
assertNotNull
(
deptRelationAttrs
);
Assert
.
assertEquals
(
deptRelationAttrs
.
size
(),
1
);
Assert
.
assertEquals
(
deptRelationAttrs
.
size
(),
1
);
Assert
.
assertTrue
(
deptRelationAttrs
.
containsKey
(
"employees"
));
Assert
.
assertTrue
(
deptRelationAttrs
.
containsKey
(
"employees"
));
AtlasAttribute
employeesAttr
=
deptRelationAttrs
.
get
(
"employees"
);
AtlasAttribute
employeesAttr
=
deptRelationAttrs
.
get
(
"employees"
)
.
values
().
iterator
().
next
()
;
Assert
.
assertEquals
(
employeesAttr
.
getTypeName
(),
AtlasBaseTypeDef
.
getArrayTypeName
(
EMPLOYEE_TYPE
));
Assert
.
assertEquals
(
employeesAttr
.
getTypeName
(),
AtlasBaseTypeDef
.
getArrayTypeName
(
EMPLOYEE_TYPE
));
Map
<
String
,
AtlasAttribute
>
addressRelationAttrs
=
getRelationAttrsForType
(
ADDRESS_TYPE
);
Map
<
String
,
Map
<
String
,
AtlasAttribute
>
>
addressRelationAttrs
=
getRelationAttrsForType
(
ADDRESS_TYPE
);
Assert
.
assertNotNull
(
addressRelationAttrs
);
Assert
.
assertNotNull
(
addressRelationAttrs
);
Assert
.
assertEquals
(
addressRelationAttrs
.
size
(),
1
);
Assert
.
assertEquals
(
addressRelationAttrs
.
size
(),
1
);
Assert
.
assertTrue
(
addressRelationAttrs
.
containsKey
(
"employees"
));
Assert
.
assertTrue
(
addressRelationAttrs
.
containsKey
(
"employees"
));
AtlasAttribute
employeesAttr1
=
addressRelationAttrs
.
get
(
"employees"
);
AtlasAttribute
employeesAttr1
=
addressRelationAttrs
.
get
(
"employees"
)
.
values
().
iterator
().
next
()
;
Assert
.
assertEquals
(
employeesAttr1
.
getTypeName
(),
AtlasBaseTypeDef
.
getArrayTypeName
(
EMPLOYEE_TYPE
));
Assert
.
assertEquals
(
employeesAttr1
.
getTypeName
(),
AtlasBaseTypeDef
.
getArrayTypeName
(
EMPLOYEE_TYPE
));
}
}
...
@@ -182,7 +182,7 @@ public class TestAtlasRelationshipType {
...
@@ -182,7 +182,7 @@ public class TestAtlasRelationshipType {
createType
(
employeePhoneRelationDef
);
createType
(
employeePhoneRelationDef
);
Map
<
String
,
AtlasAttribute
>
employeeRelationshipAttrs
=
getRelationAttrsForType
(
EMPLOYEE_TYPE
);
Map
<
String
,
Map
<
String
,
AtlasAttribute
>
>
employeeRelationshipAttrs
=
getRelationAttrsForType
(
EMPLOYEE_TYPE
);
Map
<
String
,
AtlasAttribute
>
employeeAttrs
=
getAttrsForType
(
EMPLOYEE_TYPE
);
Map
<
String
,
AtlasAttribute
>
employeeAttrs
=
getAttrsForType
(
EMPLOYEE_TYPE
);
// validate if phone_no exists in both relationAttributes and attributes
// validate if phone_no exists in both relationAttributes and attributes
...
@@ -245,7 +245,7 @@ public class TestAtlasRelationshipType {
...
@@ -245,7 +245,7 @@ public class TestAtlasRelationshipType {
return
typeName
+
" description"
;
return
typeName
+
" description"
;
}
}
private
Map
<
String
,
AtlasAttribute
>
getRelationAttrsForType
(
String
typeName
)
{
private
Map
<
String
,
Map
<
String
,
AtlasAttribute
>
>
getRelationAttrsForType
(
String
typeName
)
{
return
typeRegistry
.
getEntityTypeByName
(
typeName
).
getRelationshipAttributes
();
return
typeRegistry
.
getEntityTypeByName
(
typeName
).
getRelationshipAttributes
();
}
}
...
...
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
View file @
5651f934
...
@@ -81,7 +81,6 @@ import static org.apache.atlas.model.TypeCategory.MAP;
...
@@ -81,7 +81,6 @@ import static org.apache.atlas.model.TypeCategory.MAP;
import
static
org
.
apache
.
atlas
.
model
.
TypeCategory
.
OBJECT_ID_TYPE
;
import
static
org
.
apache
.
atlas
.
model
.
TypeCategory
.
OBJECT_ID_TYPE
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
AtlasEntity
.
Status
.
ACTIVE
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
AtlasEntity
.
Status
.
ACTIVE
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
AtlasEntity
.
Status
.
DELETED
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
AtlasEntity
.
Status
.
DELETED
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
EDGE_LABEL_PREFIX
;
import
static
org
.
apache
.
atlas
.
util
.
AtlasGremlinQueryProvider
.
AtlasGremlinQuery
.*;
import
static
org
.
apache
.
atlas
.
util
.
AtlasGremlinQueryProvider
.
AtlasGremlinQuery
.*;
@Component
@Component
...
@@ -539,7 +538,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
...
@@ -539,7 +538,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
if
(
attribute
!=
null
)
{
if
(
attribute
!=
null
)
{
if
(
isRelationshipAttribute
(
attribute
))
{
if
(
isRelationshipAttribute
(
attribute
))
{
relation
=
EDGE_LABEL_PREFIX
+
attribute
.
getQualifiedName
();
relation
=
attribute
.
getRelationshipEdgeLabel
();
}
else
{
}
else
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_RELATIONSHIP_ATTRIBUTE
,
relation
,
attribute
.
getTypeName
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_RELATIONSHIP_ATTRIBUTE
,
relation
,
attribute
.
getTypeName
());
}
}
...
...
repository/src/main/java/org/apache/atlas/discovery/SearchContext.java
View file @
5651f934
...
@@ -31,6 +31,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
...
@@ -31,6 +31,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2
;
import
org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2
;
import
org.apache.atlas.repository.store.graph.v2.EntityGraphRetriever
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasStructType
;
import
org.apache.atlas.type.AtlasStructType
;
...
@@ -239,7 +240,7 @@ public class SearchContext {
...
@@ -239,7 +240,7 @@ public class SearchContext {
private
List
<
AtlasVertex
>
getAssignedEntities
(
AtlasVertex
glossaryTerm
)
{
private
List
<
AtlasVertex
>
getAssignedEntities
(
AtlasVertex
glossaryTerm
)
{
List
<
AtlasVertex
>
ret
=
new
ArrayList
<>();
List
<
AtlasVertex
>
ret
=
new
ArrayList
<>();
AtlasEntityType
termType
=
getTermEntityType
();
AtlasEntityType
termType
=
getTermEntityType
();
AtlasAttribute
attr
=
termType
.
getRelationshipAttribute
(
TermSearchProcessor
.
ATLAS_GLOSSARY_TERM_ATTR_ASSIGNED_ENTITIES
);
AtlasAttribute
attr
=
termType
.
getRelationshipAttribute
(
TermSearchProcessor
.
ATLAS_GLOSSARY_TERM_ATTR_ASSIGNED_ENTITIES
,
EntityGraphRetriever
.
TERM_RELATION_NAME
);
Iterator
<
AtlasEdge
>
edges
=
GraphHelper
.
getEdgesForLabel
(
glossaryTerm
,
attr
.
getRelationshipEdgeLabel
(),
attr
.
getRelationshipEdgeDirection
());
Iterator
<
AtlasEdge
>
edges
=
GraphHelper
.
getEdgesForLabel
(
glossaryTerm
,
attr
.
getRelationshipEdgeLabel
(),
attr
.
getRelationshipEdgeDirection
());
boolean
excludeDeletedEntities
=
searchParameters
.
getExcludeDeletedEntities
();
boolean
excludeDeletedEntities
=
searchParameters
.
getExcludeDeletedEntities
();
...
...
repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
View file @
5651f934
...
@@ -31,7 +31,6 @@ import org.apache.atlas.model.instance.AtlasEntity.Status;
...
@@ -31,7 +31,6 @@ import org.apache.atlas.model.instance.AtlasEntity.Status;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasRelationship
;
import
org.apache.atlas.model.instance.AtlasRelationship
;
import
org.apache.atlas.model.typedef.AtlasRelationshipDef
;
import
org.apache.atlas.repository.graphdb.AtlasVertexQuery
;
import
org.apache.atlas.repository.graphdb.AtlasVertexQuery
;
import
org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2
;
import
org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2
;
import
org.apache.atlas.type.AtlasArrayType
;
import
org.apache.atlas.type.AtlasArrayType
;
...
@@ -51,7 +50,6 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
...
@@ -51,7 +50,6 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasRelationshipType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.exception.EntityNotFoundException
;
import
org.apache.atlas.exception.EntityNotFoundException
;
import
org.apache.atlas.util.AttributeValueMap
;
import
org.apache.atlas.util.AttributeValueMap
;
...
@@ -1058,7 +1056,7 @@ public final class GraphHelper {
...
@@ -1058,7 +1056,7 @@ public final class GraphHelper {
}
}
public
static
String
getEdgeLabel
(
AtlasAttribute
aInfo
)
throws
AtlasException
{
public
static
String
getEdgeLabel
(
AtlasAttribute
aInfo
)
throws
AtlasException
{
return
GraphHelper
.
EDGE_LABEL_PREFIX
+
aInfo
.
getQualifiedName
();
return
aInfo
.
getRelationshipEdgeLabel
();
}
}
public
static
Id
getIdFromVertex
(
String
dataTypeName
,
AtlasVertex
vertex
)
{
public
static
Id
getIdFromVertex
(
String
dataTypeName
,
AtlasVertex
vertex
)
{
...
@@ -1774,40 +1772,27 @@ public final class GraphHelper {
...
@@ -1774,40 +1772,27 @@ public final class GraphHelper {
* resolve by comparing all incoming edges typename with relationDefs name returned for an attribute
* resolve by comparing all incoming edges typename with relationDefs name returned for an attribute
* to pick the right relationshipDef name
* to pick the right relationshipDef name
*/
*/
public
String
getRelationshipDefName
(
AtlasVertex
entityVertex
,
AtlasEntityType
entityType
,
String
attributeName
)
{
public
String
getRelationshipTypeName
(
AtlasVertex
entityVertex
,
AtlasEntityType
entityType
,
String
attributeName
)
{
AtlasRelationshipDef
relationshipDef
=
getRelationshipDef
(
entityVertex
,
entityType
,
attributeName
);
String
ret
=
null
;
Collection
<
String
>
relationshipTypes
=
entityType
.
getAttributeRelationshipTypes
(
attributeName
);
return
(
relationshipDef
!=
null
)
?
relationshipDef
.
getName
()
:
null
;
if
(
CollectionUtils
.
isNotEmpty
(
relationshipTypes
))
{
}
public
AtlasRelationshipDef
getRelationshipDef
(
AtlasVertex
entityVertex
,
AtlasEntityType
entityType
,
String
attributeName
)
{
List
<
AtlasRelationshipType
>
relationshipTypes
=
entityType
.
getRelationshipAttributeType
(
attributeName
);
AtlasRelationshipDef
ret
=
null
;
if
(
relationshipTypes
.
size
()
>
1
)
{
Iterator
<
AtlasEdge
>
iter
=
entityVertex
.
getEdges
(
AtlasEdgeDirection
.
IN
).
iterator
();
Iterator
<
AtlasEdge
>
iter
=
entityVertex
.
getEdges
(
AtlasEdgeDirection
.
IN
).
iterator
();
while
(
iter
.
hasNext
()
&&
ret
==
null
)
{
while
(
iter
.
hasNext
()
&&
ret
==
null
)
{
String
edgeTypeName
=
AtlasGraphUtilsV2
.
getTypeName
(
iter
.
next
());
String
edgeTypeName
=
AtlasGraphUtilsV2
.
getTypeName
(
iter
.
next
());
for
(
AtlasRelationshipType
relationType
:
relationshipTypes
)
{
if
(
relationshipTypes
.
contains
(
edgeTypeName
))
{
AtlasRelationshipDef
relationshipDef
=
relationType
.
getRelationshipDef
();
ret
=
edgeTypeName
;
if
(
StringUtils
.
equals
(
edgeTypeName
,
relationshipDef
.
getName
()))
{
ret
=
relationshipDef
;
break
;
break
;
}
}
}
}
}
if
(
ret
==
null
)
{
if
(
ret
==
null
)
{
ret
=
relationshipTypes
.
get
(
0
).
getRelationshipDef
();
}
}
else
{
//relationshipTypes will have at least one relationshipDef
//relationshipTypes will have at least one relationshipDef
ret
=
relationshipTypes
.
get
(
0
).
getRelationshipDef
();
ret
=
relationshipTypes
.
iterator
().
next
();
}
}
}
return
ret
;
return
ret
;
...
...
repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
View file @
5651f934
...
@@ -620,7 +620,7 @@ public class ExportService {
...
@@ -620,7 +620,7 @@ public class ExportService {
}
else
if
(
type
instanceof
AtlasEnumType
)
{
}
else
if
(
type
instanceof
AtlasEnumType
)
{
addEnumType
((
AtlasEnumType
)
type
,
context
);
addEnumType
((
AtlasEnumType
)
type
,
context
);
}
else
if
(
type
instanceof
AtlasRelationshipType
)
{
}
else
if
(
type
instanceof
AtlasRelationshipType
)
{
addRelationshipType
(
(
AtlasRelationshipType
)
type
,
context
);
addRelationshipType
(
type
.
getTypeName
()
,
context
);
}
}
}
}
...
@@ -667,15 +667,19 @@ public class ExportService {
...
@@ -667,15 +667,19 @@ public class ExportService {
}
}
}
}
private
void
addRelationshipType
(
AtlasRelationshipType
relationshipType
,
ExportContext
context
)
{
private
void
addRelationshipType
(
String
relationshipTypeName
,
ExportContext
context
)
{
if
(!
context
.
relationshipTypes
.
contains
(
relationshipType
.
getTypeName
()))
{
if
(!
context
.
relationshipTypes
.
contains
(
relationshipTypeName
))
{
context
.
relationshipTypes
.
add
(
relationshipType
.
getTypeName
());
AtlasRelationshipType
relationshipType
=
typeRegistry
.
getRelationshipTypeByName
(
relationshipTypeName
);
if
(
relationshipType
!=
null
)
{
context
.
relationshipTypes
.
add
(
relationshipTypeName
);
addAttributeTypes
(
relationshipType
,
context
);
addAttributeTypes
(
relationshipType
,
context
);
addEntityType
(
relationshipType
.
getEnd1Type
(),
context
);
addEntityType
(
relationshipType
.
getEnd1Type
(),
context
);
addEntityType
(
relationshipType
.
getEnd2Type
(),
context
);
addEntityType
(
relationshipType
.
getEnd2Type
(),
context
);
}
}
}
}
}
private
void
addAttributeTypes
(
AtlasStructType
structType
,
ExportContext
context
)
{
private
void
addAttributeTypes
(
AtlasStructType
structType
,
ExportContext
context
)
{
for
(
AtlasAttributeDef
attributeDef
:
structType
.
getStructDef
().
getAttributeDefs
())
{
for
(
AtlasAttributeDef
attributeDef
:
structType
.
getStructDef
().
getAttributeDefs
())
{
...
@@ -684,8 +688,8 @@ public class ExportService {
...
@@ -684,8 +688,8 @@ public class ExportService {
}
}
private
void
addRelationshipTypes
(
AtlasEntityType
entityType
,
ExportContext
context
)
{
private
void
addRelationshipTypes
(
AtlasEntityType
entityType
,
ExportContext
context
)
{
for
(
List
<
AtlasRelationshipType
>
relationshipTypes
:
entityType
.
getRelationshipAttributesType
().
values
())
{
for
(
Map
.
Entry
<
String
,
Map
<
String
,
AtlasAttribute
>>
entry
:
entityType
.
getRelationshipAttributes
().
entrySet
())
{
for
(
AtlasRelationshipType
relationshipType
:
relationshipTypes
)
{
for
(
String
relationshipType
:
entry
.
getValue
().
keySet
()
)
{
addRelationshipType
(
relationshipType
,
context
);
addRelationshipType
(
relationshipType
,
context
);
}
}
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/impexp/ExportTypeProcessor.java
View file @
5651f934
...
@@ -36,7 +36,7 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -36,7 +36,7 @@ import org.apache.commons.collections.CollectionUtils;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.
List
;
import
java.util.
Map
;
class
ExportTypeProcessor
{
class
ExportTypeProcessor
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ExportTypeProcessor
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ExportTypeProcessor
.
class
);
...
@@ -110,7 +110,7 @@ class ExportTypeProcessor {
...
@@ -110,7 +110,7 @@ class ExportTypeProcessor {
}
else
if
(
type
instanceof
AtlasEnumType
)
{
}
else
if
(
type
instanceof
AtlasEnumType
)
{
addEnumType
((
AtlasEnumType
)
type
,
context
);
addEnumType
((
AtlasEnumType
)
type
,
context
);
}
else
if
(
type
instanceof
AtlasRelationshipType
)
{
}
else
if
(
type
instanceof
AtlasRelationshipType
)
{
addRelationshipType
(
(
AtlasRelationshipType
)
type
,
context
);
addRelationshipType
(
type
.
getTypeName
()
,
context
);
}
}
}
}
...
@@ -157,15 +157,19 @@ class ExportTypeProcessor {
...
@@ -157,15 +157,19 @@ class ExportTypeProcessor {
}
}
}
}
private
void
addRelationshipType
(
AtlasRelationshipType
relationshipType
,
ExportService
.
ExportContext
context
)
{
private
void
addRelationshipType
(
String
relationshipTypeName
,
ExportService
.
ExportContext
context
)
{
if
(!
context
.
relationshipTypes
.
contains
(
relationshipType
.
getTypeName
()))
{
if
(!
context
.
relationshipTypes
.
contains
(
relationshipTypeName
))
{
context
.
relationshipTypes
.
add
(
relationshipType
.
getTypeName
());
AtlasRelationshipType
relationshipType
=
typeRegistry
.
getRelationshipTypeByName
(
relationshipTypeName
);
if
(
relationshipType
!=
null
)
{
context
.
relationshipTypes
.
add
(
relationshipTypeName
);
addAttributeTypes
(
relationshipType
,
context
);
addAttributeTypes
(
relationshipType
,
context
);
addEntityType
(
relationshipType
.
getEnd1Type
(),
context
);
addEntityType
(
relationshipType
.
getEnd1Type
(),
context
);
addEntityType
(
relationshipType
.
getEnd2Type
(),
context
);
addEntityType
(
relationshipType
.
getEnd2Type
(),
context
);
}
}
}
}
}
private
void
addAttributeTypes
(
AtlasStructType
structType
,
ExportService
.
ExportContext
context
)
{
private
void
addAttributeTypes
(
AtlasStructType
structType
,
ExportService
.
ExportContext
context
)
{
for
(
AtlasStructDef
.
AtlasAttributeDef
attributeDef
:
structType
.
getStructDef
().
getAttributeDefs
())
{
for
(
AtlasStructDef
.
AtlasAttributeDef
attributeDef
:
structType
.
getStructDef
().
getAttributeDefs
())
{
...
@@ -174,8 +178,8 @@ class ExportTypeProcessor {
...
@@ -174,8 +178,8 @@ class ExportTypeProcessor {
}
}
private
void
addRelationshipTypes
(
AtlasEntityType
entityType
,
ExportService
.
ExportContext
context
)
{
private
void
addRelationshipTypes
(
AtlasEntityType
entityType
,
ExportService
.
ExportContext
context
)
{
for
(
List
<
AtlasRelationshipType
>
relationshipTypes
:
entityType
.
getRelationshipAttributesType
().
values
())
{
for
(
Map
.
Entry
<
String
,
Map
<
String
,
AtlasStructType
.
AtlasAttribute
>>
entry
:
entityType
.
getRelationshipAttributes
().
entrySet
())
{
for
(
AtlasRelationshipType
relationshipType
:
relationshipTypes
)
{
for
(
String
relationshipType
:
entry
.
getValue
().
keySet
()
)
{
addRelationshipType
(
relationshipType
,
context
);
addRelationshipType
(
relationshipType
,
context
);
}
}
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityGraphDiscoveryV2.java
View file @
5651f934
...
@@ -36,6 +36,7 @@ import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
...
@@ -36,6 +36,7 @@ import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.utils.AtlasEntityUtil
;
import
org.apache.atlas.utils.AtlasPerfMetrics.MetricRecorder
;
import
org.apache.atlas.utils.AtlasPerfMetrics.MetricRecorder
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -330,16 +331,23 @@ public class AtlasEntityGraphDiscoveryV2 implements EntityGraphDiscovery {
...
@@ -330,16 +331,23 @@ public class AtlasEntityGraphDiscoveryV2 implements EntityGraphDiscovery {
}
}
private
void
visitRelationships
(
AtlasEntityType
entityType
,
AtlasEntity
entity
,
List
<
String
>
visitedAttributes
)
throws
AtlasBaseException
{
private
void
visitRelationships
(
AtlasEntityType
entityType
,
AtlasEntity
entity
,
List
<
String
>
visitedAttributes
)
throws
AtlasBaseException
{
for
(
AtlasAttribute
attribute
:
entityType
.
getRelationshipAttributes
().
values
())
{
for
(
String
attrName
:
entityType
.
getRelationshipAttributes
().
keySet
())
{
String
attrName
=
attribute
.
getName
();
// if attribute is not in 'relationshipAttributes', try 'attributes'
// if attribute is not in 'relationshipAttributes', try 'attributes'
if
(
entity
.
hasRelationshipAttribute
(
attrName
))
{
if
(
entity
.
hasRelationshipAttribute
(
attrName
))
{
visitAttribute
(
attribute
.
getAttributeType
(),
entity
.
getRelationshipAttribute
(
attrName
));
Object
attrVal
=
entity
.
getRelationshipAttribute
(
attrName
);
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
attrVal
);
AtlasAttribute
attribute
=
entityType
.
getRelationshipAttribute
(
attrName
,
relationshipType
);
visitAttribute
(
attribute
.
getAttributeType
(),
attrVal
);
visitedAttributes
.
add
(
attrName
);
visitedAttributes
.
add
(
attrName
);
}
else
if
(
entity
.
hasAttribute
(
attrName
))
{
}
else
if
(
entity
.
hasAttribute
(
attrName
))
{
visitAttribute
(
attribute
.
getAttributeType
(),
entity
.
getAttribute
(
attrName
));
Object
attrVal
=
entity
.
getAttribute
(
attrName
);
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
attrVal
);
AtlasAttribute
attribute
=
entityType
.
getRelationshipAttribute
(
attrName
,
relationshipType
);
visitAttribute
(
attribute
.
getAttributeType
(),
attrVal
);
visitedAttributes
.
add
(
attrName
);
visitedAttributes
.
add
(
attrName
);
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
View file @
5651f934
...
@@ -41,6 +41,7 @@ import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
...
@@ -41,6 +41,7 @@ import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.utils.AtlasEntityUtil
;
import
org.apache.atlas.utils.AtlasPerfMetrics.MetricRecorder
;
import
org.apache.atlas.utils.AtlasPerfMetrics.MetricRecorder
;
import
org.apache.atlas.utils.AtlasPerfTracer
;
import
org.apache.atlas.utils.AtlasPerfTracer
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
...
@@ -760,12 +761,14 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
...
@@ -760,12 +761,14 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
}
}
if
(!
hasUpdates
&&
MapUtils
.
isNotEmpty
(
entity
.
getRelationshipAttributes
()))
{
// check of relationsship-attribute value change
if
(!
hasUpdates
&&
MapUtils
.
isNotEmpty
(
entity
.
getRelationshipAttributes
()))
{
// check of relationsship-attribute value change
for
(
AtlasAttribute
attribute
:
entityType
.
getRelationshipAttributes
().
values
())
{
for
(
String
attributeName
:
entityType
.
getRelationshipAttributes
().
keySet
())
{
if
(!
entity
.
getRelationshipAttributes
().
containsKey
(
attribute
.
getName
()
))
{
// if value is not provided, current value will not be updated
if
(!
entity
.
getRelationshipAttributes
().
containsKey
(
attribute
Name
))
{
// if value is not provided, current value will not be updated
continue
;
continue
;
}
}
Object
newVal
=
entity
.
getRelationshipAttribute
(
attribute
.
getName
());
Object
newVal
=
entity
.
getRelationshipAttribute
(
attributeName
);
String
relationshipType
=
AtlasEntityUtil
.
getRelationshipType
(
newVal
);
AtlasAttribute
attribute
=
entityType
.
getRelationshipAttribute
(
attributeName
,
relationshipType
);
Object
currVal
=
entityRetriever
.
getEntityAttribute
(
vertex
,
attribute
);
Object
currVal
=
entityRetriever
.
getEntityAttribute
(
vertex
,
attribute
);
if
(!
attribute
.
getAttributeType
().
areEqualValues
(
currVal
,
newVal
,
context
.
getGuidAssignments
()))
{
if
(!
attribute
.
getAttributeType
().
areEqualValues
(
currVal
,
newVal
,
context
.
getGuidAssignments
()))
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
View file @
5651f934
...
@@ -126,10 +126,6 @@ public class AtlasGraphUtilsV2 {
...
@@ -126,10 +126,6 @@ public class AtlasGraphUtilsV2 {
return
GraphHelper
.
EDGE_LABEL_PREFIX
+
property
;
return
GraphHelper
.
EDGE_LABEL_PREFIX
+
property
;
}
}
public
static
String
getAttributeEdgeLabel
(
AtlasStructType
fromType
,
String
attributeName
)
throws
AtlasBaseException
{
return
getEdgeLabel
(
getQualifiedAttributePropertyKey
(
fromType
,
attributeName
));
}
public
static
String
getQualifiedAttributePropertyKey
(
AtlasStructType
fromType
,
String
attributeName
)
throws
AtlasBaseException
{
public
static
String
getQualifiedAttributePropertyKey
(
AtlasStructType
fromType
,
String
attributeName
)
throws
AtlasBaseException
{
switch
(
fromType
.
getTypeCategory
())
{
switch
(
fromType
.
getTypeCategory
())
{
case
ENTITY:
case
ENTITY:
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipDefStoreV2.java
View file @
5651f934
...
@@ -459,6 +459,7 @@ public class AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRe
...
@@ -459,6 +459,7 @@ public class AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRe
// Update RelationshipCategory
// Update RelationshipCategory
vertex
.
setProperty
(
Constants
.
RELATIONSHIPTYPE_CATEGORY_KEY
,
relationshipCategory
);
vertex
.
setProperty
(
Constants
.
RELATIONSHIPTYPE_CATEGORY_KEY
,
relationshipCategory
);
vertex
.
setProperty
(
Constants
.
RELATIONSHIPTYPE_LABEL_KEY
,
relationshipDef
.
getRelationshipLabel
());
vertex
.
setProperty
(
Constants
.
RELATIONSHIPTYPE_LABEL_KEY
,
relationshipDef
.
getRelationshipLabel
());
vertex
.
setProperty
(
Constants
.
RELATIONSHIPTYPE_LABEL_KEY
,
relationshipDef
.
getRelationshipLabel
());
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java
View file @
5651f934
...
@@ -810,12 +810,11 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore {
...
@@ -810,12 +810,11 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore {
if
(
fromVertexTypes
.
contains
(
endDef1
.
getType
())
&&
toVertexTypes
.
contains
(
endDef2
.
getType
()))
{
if
(
fromVertexTypes
.
contains
(
endDef1
.
getType
())
&&
toVertexTypes
.
contains
(
endDef2
.
getType
()))
{
String
attributeName
=
endDef1
.
getName
();
String
attributeName
=
endDef1
.
getName
();
attribute
=
relationshipType
.
getEnd1Type
().
getRelationshipAttribute
(
attributeName
);
attribute
=
relationshipType
.
getEnd1Type
().
getRelationshipAttribute
(
attributeName
,
relationshipTypeName
);
}
else
if
(
fromVertexTypes
.
contains
(
endDef2
.
getType
())
&&
toVertexTypes
.
contains
(
endDef1
.
getType
()))
{
}
else
if
(
fromVertexTypes
.
contains
(
endDef2
.
getType
())
&&
toVertexTypes
.
contains
(
endDef1
.
getType
()))
{
String
attributeName
=
endDef2
.
getName
();
String
attributeName
=
endDef2
.
getName
();
attribute
=
relationshipType
.
getEnd2Type
().
getRelationshipAttribute
(
attributeName
);
attribute
=
relationshipType
.
getEnd2Type
().
getRelationshipAttribute
(
attributeName
,
relationshipTypeName
);
}
}
if
(
attribute
!=
null
)
{
if
(
attribute
!=
null
)
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
View file @
5651f934
...
@@ -339,17 +339,21 @@ public class EntityGraphMapper {
...
@@ -339,17 +339,21 @@ public class EntityGraphMapper {
MetricRecorder
metric
=
RequestContext
.
get
().
startMetricRecord
(
"mapRelationshipAttributes"
);
MetricRecorder
metric
=
RequestContext
.
get
().
startMetricRecord
(
"mapRelationshipAttributes"
);
if
(
op
.
equals
(
CREATE
))
{
if
(
op
.
equals
(
CREATE
))
{
for
(
AtlasAttribute
attribute
:
entityType
.
getRelationshipAttributes
().
values
())
{
for
(
String
attrName
:
entityType
.
getRelationshipAttributes
().
keySet
())
{
Object
attrValue
=
entity
.
getRelationshipAttribute
(
attribute
.
getName
());
Object
attrValue
=
entity
.
getRelationshipAttribute
(
attrName
);
String
relationType
=
AtlasEntityUtil
.
getRelationshipType
(
attrValue
);
AtlasAttribute
attribute
=
entityType
.
getRelationshipAttribute
(
attrName
,
relationType
);
mapAttribute
(
attribute
,
attrValue
,
vertex
,
op
,
context
);
mapAttribute
(
attribute
,
attrValue
,
vertex
,
op
,
context
);
}
}
}
else
if
(
op
.
equals
(
UPDATE
))
{
}
else
if
(
op
.
equals
(
UPDATE
))
{
// relationship attributes mapping
// relationship attributes mapping
for
(
AtlasAttribute
attribute
:
entityType
.
getRelationshipAttributes
().
values
())
{
for
(
String
attrName
:
entityType
.
getRelationshipAttributes
().
keySet
())
{
if
(
attribute
!=
null
&&
entity
.
hasRelationshipAttribute
(
attribute
.
getName
()))
{
if
(
entity
.
hasRelationshipAttribute
(
attrName
))
{
Object
attrValue
=
entity
.
getRelationshipAttribute
(
attribute
.
getName
());
Object
attrValue
=
entity
.
getRelationshipAttribute
(
attrName
);
String
relationType
=
AtlasEntityUtil
.
getRelationshipType
(
attrValue
);
AtlasAttribute
attribute
=
entityType
.
getRelationshipAttribute
(
attrName
,
relationType
);
mapAttribute
(
attribute
,
attrValue
,
vertex
,
op
,
context
);
mapAttribute
(
attribute
,
attrValue
,
vertex
,
op
,
context
);
}
}
...
@@ -599,7 +603,7 @@ public class EntityGraphMapper {
...
@@ -599,7 +603,7 @@ public class EntityGraphMapper {
AtlasEntityType
entityType
=
(
AtlasEntityType
)
inverseAttributeType
;
AtlasEntityType
entityType
=
(
AtlasEntityType
)
inverseAttributeType
;
if
(
entityType
.
hasRelationshipAttribute
(
inverseAttributeName
))
{
if
(
entityType
.
hasRelationshipAttribute
(
inverseAttributeName
))
{
String
relationshipName
=
graphHelper
.
getRelationship
Def
Name
(
inverseVertex
,
entityType
,
inverseAttributeName
);
String
relationshipName
=
graphHelper
.
getRelationship
Type
Name
(
inverseVertex
,
entityType
,
inverseAttributeName
);
ret
=
getOrCreateRelationship
(
inverseVertex
,
vertex
,
relationshipName
,
relationshipAttributes
);
ret
=
getOrCreateRelationship
(
inverseVertex
,
vertex
,
relationshipName
,
relationshipAttributes
);
...
@@ -843,7 +847,7 @@ public class EntityGraphMapper {
...
@@ -843,7 +847,7 @@ public class EntityGraphMapper {
ret
=
updateRelationship
(
ctx
.
getCurrentEdge
(),
entityVertex
,
attributeVertex
,
edgeDirection
,
relationshipAttributes
);
ret
=
updateRelationship
(
ctx
.
getCurrentEdge
(),
entityVertex
,
attributeVertex
,
edgeDirection
,
relationshipAttributes
);
}
else
{
}
else
{
String
relationshipName
=
graphHelper
.
getRelationship
Def
Name
(
entityVertex
,
entityType
,
attributeName
);
String
relationshipName
=
graphHelper
.
getRelationship
Type
Name
(
entityVertex
,
entityType
,
attributeName
);
AtlasVertex
fromVertex
;
AtlasVertex
fromVertex
;
AtlasVertex
toVertex
;
AtlasVertex
toVertex
;
...
@@ -1900,8 +1904,7 @@ public class EntityGraphMapper {
...
@@ -1900,8 +1904,7 @@ public class EntityGraphMapper {
// move/remove relationship-attributes present in 'attributes'
// move/remove relationship-attributes present in 'attributes'
private
static
void
compactAttributes
(
AtlasEntity
entity
,
AtlasEntityType
entityType
)
{
private
static
void
compactAttributes
(
AtlasEntity
entity
,
AtlasEntityType
entityType
)
{
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
for
(
AtlasAttribute
attribute
:
entityType
.
getRelationshipAttributes
().
values
())
{
for
(
String
attrName
:
entityType
.
getRelationshipAttributes
().
keySet
())
{
String
attrName
=
attribute
.
getName
();
if
(
entity
.
hasAttribute
(
attrName
))
{
if
(
entity
.
hasAttribute
(
attrName
))
{
Object
attrValue
=
entity
.
getAttribute
(
attrName
);
Object
attrValue
=
entity
.
getAttribute
(
attrName
);
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
View file @
5651f934
...
@@ -100,8 +100,8 @@ import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelation
...
@@ -100,8 +100,8 @@ import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelation
public
class
EntityGraphRetriever
{
public
class
EntityGraphRetriever
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
EntityGraphRetriever
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
EntityGraphRetriever
.
class
);
private
static
final
String
TERM_RELATION_NAME
=
"AtlasGlossarySemanticAssignment"
;
private
static
final
String
GLOSSARY_TERM_DISPLAY_NAME_ATTR
=
"AtlasGlossaryTerm.name"
;
private
static
final
String
GLOSSARY_TERM_DISPLAY_NAME_ATTR
=
"AtlasGlossaryTerm.name"
;
public
static
final
String
TERM_RELATION_NAME
=
"AtlasGlossarySemanticAssignment"
;
public
static
final
String
NAME
=
"name"
;
public
static
final
String
NAME
=
"name"
;
public
static
final
String
DISPLAY_NAME
=
"displayName"
;
public
static
final
String
DISPLAY_NAME
=
"displayName"
;
...
@@ -655,7 +655,7 @@ public class EntityGraphRetriever {
...
@@ -655,7 +655,7 @@ public class EntityGraphRetriever {
private
Object
mapVertexToAttribute
(
AtlasVertex
entityVertex
,
AtlasAttribute
attribute
,
AtlasEntityExtInfo
entityExtInfo
,
final
boolean
isMinExtInfo
)
throws
AtlasBaseException
{
private
Object
mapVertexToAttribute
(
AtlasVertex
entityVertex
,
AtlasAttribute
attribute
,
AtlasEntityExtInfo
entityExtInfo
,
final
boolean
isMinExtInfo
)
throws
AtlasBaseException
{
Object
ret
=
null
;
Object
ret
=
null
;
AtlasType
attrType
=
attribute
.
getAttributeType
();
AtlasType
attrType
=
attribute
.
getAttributeType
();
String
edgeLabel
=
EDGE_LABEL_PREFIX
+
attribute
.
getQualifiedName
();
String
edgeLabel
=
attribute
.
getRelationshipEdgeLabel
();
boolean
isOwnedAttribute
=
attribute
.
isOwnedRef
();
boolean
isOwnedAttribute
=
attribute
.
isOwnedRef
();
AtlasRelationshipEdgeDirection
edgeDirection
=
attribute
.
getRelationshipEdgeDirection
();
AtlasRelationshipEdgeDirection
edgeDirection
=
attribute
.
getRelationshipEdgeDirection
();
...
@@ -997,30 +997,32 @@ public class EntityGraphRetriever {
...
@@ -997,30 +997,32 @@ public class EntityGraphRetriever {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_NAME_INVALID
,
entity
.
getTypeName
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_NAME_INVALID
,
entity
.
getTypeName
());
}
}
for
(
AtlasAttribute
attribute
:
entityType
.
getRelationshipAttributes
().
values
())
{
for
(
String
attributeName
:
entityType
.
getRelationshipAttributes
().
keySet
())
{
Object
attrValue
=
mapVertexToRelationshipAttribute
(
entityVertex
,
entityType
,
attribute
);
Object
attrValue
=
mapVertexToRelationshipAttribute
(
entityVertex
,
entityType
,
attribute
Name
);
entity
.
setRelationshipAttribute
(
attribute
.
getName
()
,
attrValue
);
entity
.
setRelationshipAttribute
(
attribute
Name
,
attrValue
);
}
}
}
}
private
Object
mapVertexToRelationshipAttribute
(
AtlasVertex
entityVertex
,
AtlasEntityType
entityType
,
AtlasAttribute
attribut
e
)
throws
AtlasBaseException
{
private
Object
mapVertexToRelationshipAttribute
(
AtlasVertex
entityVertex
,
AtlasEntityType
entityType
,
String
attributeNam
e
)
throws
AtlasBaseException
{
Object
ret
=
null
;
Object
ret
=
null
;
AtlasRelationshipDef
relationshipDef
=
graphHelper
.
getRelationshipDef
(
entityVertex
,
entityType
,
attribute
.
getName
());
String
relationshipTypeName
=
graphHelper
.
getRelationshipTypeName
(
entityVertex
,
entityType
,
attributeName
);
AtlasRelationshipType
relationshipType
=
relationshipTypeName
!=
null
?
typeRegistry
.
getRelationshipTypeByName
(
relationshipTypeName
)
:
null
;
if
(
relationship
Def
==
null
)
{
if
(
relationship
Type
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_INVALID
,
"relationshipDef is null"
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_INVALID
,
"relationshipDef is null"
);
}
}
AtlasRelationshipDef
relationshipDef
=
relationshipType
.
getRelationshipDef
();
AtlasRelationshipEndDef
endDef1
=
relationshipDef
.
getEndDef1
();
AtlasRelationshipEndDef
endDef1
=
relationshipDef
.
getEndDef1
();
AtlasRelationshipEndDef
endDef2
=
relationshipDef
.
getEndDef2
();
AtlasRelationshipEndDef
endDef2
=
relationshipDef
.
getEndDef2
();
AtlasEntityType
endDef1Type
=
typeRegistry
.
getEntityTypeByName
(
endDef1
.
getType
());
AtlasEntityType
endDef1Type
=
typeRegistry
.
getEntityTypeByName
(
endDef1
.
getType
());
AtlasEntityType
endDef2Type
=
typeRegistry
.
getEntityTypeByName
(
endDef2
.
getType
());
AtlasEntityType
endDef2Type
=
typeRegistry
.
getEntityTypeByName
(
endDef2
.
getType
());
AtlasRelationshipEndDef
attributeEndDef
=
null
;
AtlasRelationshipEndDef
attributeEndDef
=
null
;
if
(
endDef1Type
.
isTypeOrSuperTypeOf
(
entityType
.
getTypeName
())
&&
StringUtils
.
equals
(
endDef1
.
getName
(),
attribute
.
getName
()
))
{
if
(
endDef1Type
.
isTypeOrSuperTypeOf
(
entityType
.
getTypeName
())
&&
StringUtils
.
equals
(
endDef1
.
getName
(),
attribute
Name
))
{
attributeEndDef
=
endDef1
;
attributeEndDef
=
endDef1
;
}
else
if
(
endDef2Type
.
isTypeOrSuperTypeOf
(
entityType
.
getTypeName
())
&&
StringUtils
.
equals
(
endDef2
.
getName
(),
attribute
.
getName
()
))
{
}
else
if
(
endDef2Type
.
isTypeOrSuperTypeOf
(
entityType
.
getTypeName
())
&&
StringUtils
.
equals
(
endDef2
.
getName
(),
attribute
Name
))
{
attributeEndDef
=
endDef2
;
attributeEndDef
=
endDef2
;
}
}
...
@@ -1030,12 +1032,12 @@ public class EntityGraphRetriever {
...
@@ -1030,12 +1032,12 @@ public class EntityGraphRetriever {
switch
(
attributeEndDef
.
getCardinality
())
{
switch
(
attributeEndDef
.
getCardinality
())
{
case
SINGLE:
case
SINGLE:
ret
=
mapRelatedVertexToObjectId
(
entityVertex
,
attribute
);
ret
=
mapRelatedVertexToObjectId
(
entityVertex
,
entityType
.
getRelationshipAttribute
(
attributeName
,
relationshipTypeName
)
);
break
;
break
;
case
LIST:
case
LIST:
case
SET:
case
SET:
ret
=
mapRelationshipArrayAttribute
(
entityVertex
,
attribute
);
ret
=
mapRelationshipArrayAttribute
(
entityVertex
,
entityType
.
getRelationshipAttribute
(
attributeName
,
relationshipTypeName
)
);
break
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment