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
667abe4a
Commit
667abe4a
authored
Dec 07, 2017
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2304: fix Relationship search API to work TinkerPop3
parent
28fb3cc6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
EntityDiscoveryService.java
...va/org/apache/atlas/discovery/EntityDiscoveryService.java
+2
-2
AtlasGremlin3QueryProvider.java
...ava/org/apache/atlas/util/AtlasGremlin3QueryProvider.java
+14
-0
No files found.
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
View file @
667abe4a
...
...
@@ -608,11 +608,11 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
}
if
(
ret
.
getEntities
()
==
null
)
{
ret
.
setEntities
(
new
ArrayList
<
AtlasEntityHeader
>());
ret
.
setEntities
(
new
ArrayList
<>());
}
}
catch
(
ScriptException
e
)
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Gremlin script execution failed for relationship search query:
"
+
e
);
LOG
.
debug
(
"Gremlin script execution failed for relationship search query:
{}"
,
relatedEntitiesQuery
,
e
);
}
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INTERNAL_ERROR
,
"Relationship search query failed"
);
...
...
repository/src/main/java/org/apache/atlas/util/AtlasGremlin3QueryProvider.java
View file @
667abe4a
...
...
@@ -23,6 +23,10 @@ public class AtlasGremlin3QueryProvider extends AtlasGremlin2QueryProvider {
// In case any overrides are necessary, a specific switch case can be added here to
// return Gremlin 3 specific query otherwise delegate to super.getQuery
switch
(
gremlinQuery
)
{
case
TYPE_UNUSED_COUNT_METRIC:
return
"g.V().has('__type', 'typeSystem').filter({ !it.getProperty('__type.category').name().matches('TRAIT') && it.inE().count() == 0}).count()"
;
case
ENTITY_COUNT_METRIC:
return
"g.V().has('__superTypeNames', within(['Referenceable'])).count()"
;
case
EXPORT_TYPE_STARTS_WITH:
return
"g.V().has('__typeName',typeName).filter({it.get().value(attrName).startsWith(attrValue)}).has('__guid').values('__guid').toList()"
;
case
EXPORT_TYPE_ENDS_WITH:
...
...
@@ -33,6 +37,8 @@ public class AtlasGremlin3QueryProvider extends AtlasGremlin2QueryProvider {
return
"g.V().has('__typeName',typeName).filter({it.get().value(attrName).matches(attrValue)}).has('__guid').values('__guid').toList()"
;
case
EXPORT_TYPE_DEFAULT:
return
"g.V().has('__typeName',typeName).has(attrName, attrValue).has('__guid').values('__guid').toList()"
;
case
EXPORT_BY_GUID_FULL:
return
"g.V().has('__guid', startGuid).bothE().bothV().has('__guid').transform{[__guid:it.__guid,isProcess:(it.__superTypeNames != null) ? it.__superTypeNames.contains('Process') : false ]}.dedup().toList()"
;
case
EXPORT_BY_GUID_CONNECTED_IN_EDGE:
return
"g.V().has('__guid', startGuid).inE().outV().has('__guid').project('__guid', 'isProcess').by('__guid').by(map {it.get().values('__superTypeNames').toSet().contains('Process')}).dedup().toList()"
;
case
EXPORT_BY_GUID_CONNECTED_OUT_EDGE:
...
...
@@ -45,6 +51,14 @@ public class AtlasGremlin3QueryProvider extends AtlasGremlin2QueryProvider {
return
"g.V().has('__guid', '%s').repeat(__.in('%s').out('%s')).times(%s)."
+
"emit(has('__superTypeNames').and().properties('__superTypeNames').hasValue('DataSet'))."
+
"path().toList()"
;
case
TO_RANGE_LIST:
return
".range(startIdx, endIdx).toList()"
;
case
RELATIONSHIP_SEARCH:
return
"g.V().has('__guid', guid).both(relation).has('__state', within(states))"
;
case
RELATIONSHIP_SEARCH_ASCENDING_SORT:
return
".order().by(sortAttributeName, incr)"
;
case
RELATIONSHIP_SEARCH_DESCENDING_SORT:
return
".order().by(sortAttributeName, decr)"
;
case
GREMLIN_SEARCH_RETURNS_VERTEX_ID:
return
"g.V().range(0,1).toList()"
;
case
GREMLIN_SEARCH_RETURNS_EDGE_ID:
...
...
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