I am able to get all the child nodes and its related information under a parent node but in a array of objects format , for the query
g.V(4128).repeat(out()).emit()
[
{
"id": 4152.0,
"label": "location",
"type": "vertex",
"properties": {
"displayName": [
{
"id": "1l3-37c-1l1",
"value": "XYZ"
}
],
"description": [
{
"id": "1zb-37c-7wl",
"value": "XYZ World"
}
],
"shortName": [
{
"id": "16v-37c-745",
"value": "XYZ"
}
]
}
},
{
"id": 4176.0,
"label": "location",
"type": "vertex",
"properties": {
"displayName": [
{
"id": "1l6-380-1l1",
"value": "XYZ-XYZW"
}
],
"description": [
{
"id": "1ze-380-7wl",
"value": "XYZ West Campus"
}
],
"shortName": [
{
"id": "16y-380-745",
"value": "XYZW"
}
]
}
},
{
"id": 8344.0,
"label": "location",
"type": "vertex",
"properties": {
"displayName": [
{
"id": "3kj-6fs-1l1",
"value": "XYZ-XYZE"
}
],
"description": [
{
"id": "3yr-6fs-7wl",
"value": "XYZ East Campus"
}
],
"shortName": [
{
"id": "36b-6fs-745",
"value": "XYZE"
}
]
}
},
{
"id": 4104.0,
"label": "location",
"type": "vertex",
"properties": {
"displayName": [
{
"id": "1kx-360-1l1",
"value": "XYZ-XYZW-P1"
}
],
"description": [
{
"id": "1z5-360-7wl",
"value": "XYZ West Campus-Phase-1"
}
],
"shortName": [
{
"id": "16p-360-745",
"value": "P1"
}
]
}
},
{
"id": 4296.0,
"label": "location",
"type": "vertex",
"properties": {
"displayName": [
{
"id": "1ll-3bc-1l1",
"value": "XYZ-XYZW-P3"
}
],
"description": [
{
"id": "1zt-3bc-7wl",
"value": "XYZ West Campus-Phase-3"
}
],
"shortName": [
{
"id": "17d-3bc-745",
"value": "P3"
}
]
}
},
{
"id": 8200.0,
"label": "location",
"type": "vertex",
"properties": {
"displayName": [
{
"id": "3k1-6bs-1l1",
"value": "XYZ-XYZW-P2"
}
],
"description": [
{
"id": "3y9-6bs-7wl",
"value": "XYZ West Campus-Phase-2"
}
],
"shortName": [
{
"id": "35t-6bs-745",
"value": "P2"
}
]
}
},
{
"id": 8224.0,
"label": "location",
"type": "vertex",
"properties": {
"displayName": [
{
"id": "3yc-6cg-1l1",
"value": "XYZ-XYZE-P1"
}
],
"description": [
{
"id": "4ck-6cg-7wl",
"value": "XYZ East Campus-Phase-1"
}
],
"shortName": [
{
"id": "3k4-6cg-745",
"value": "P1"
}
]
}
},
{
"id": 8392.0,
"label": "location",
"type": "vertex",
"properties": {
"displayName": [
{
"id": "3kp-6h4-1l1",
"value": "XYZ-XYZE-P2"
}
],
"description": [
{
"id": "3yx-6h4-7wl",
"value": "XYZ East Campus-Phase-2"
}
],
"shortName": [
{
"id": "36h-6h4-745",
"value": "P2"
}
]
}
}
]
I need to get the same information in hierarchial way .
I tried the following query
g.V(4128).repeat(out()).emit().tree().by(__.valueMap(true))
but I don't get the valid json.
I need to get the above data but in hierarchical way
Updated
I tried the following query
g.V(4128).repeat(out()).emit().tree().by(__.valueMap(true))
And the response I received was
[
{
"{label = org, name = [XYZ], orgId = [00000000-0000-0000-0000-000000000001], desc = [XYZ Organization], id = 4128}": {
"{label = location, displayName = [hh], description = [hfds], shortName = [kk], id = 8272}": {
},
"{label = location, displayName = [XYZ], description = [XYZ World], shortName = [XYZ], id = 4152}": {
"{label = location, displayName = [XYZ-XYZW], description = [XYZ West Campus], shortName = [XYZW], id = 4176}": {
"{label = location, displayName = [XYZ-XYZW-P3], description = [XYZ West Campus-Phase-3], shortName = [P3], id = 4296}": {
},
"{label = location, displayName = [XYZ-XYZW-P2], description = [XYZ West Campus-Phase-2], shortName = [P2], id = 8200}": {
},
"{label = location, displayName = [XYZ-XYZW-P1], description = [XYZ West Campus-Phase-1], shortName = [P1], id = 4104}": {
}
},
"{label = location, displayName = [XYZ-XYZE], description = [XYZ East Campus], shortName = [XYZE], id = 8344}": {
"{label = location, displayName = [XYZ-XYZE-P1], description = [XYZ East Campus-Phase-1], shortName = [P1], id = 8224}": {
},
"{label = location, displayName = [XYZ-XYZE-P2], description = [XYZ East Campus-Phase-2], shortName = [P2], id = 8392}": {
}
}
},
"{label = location, displayName = [hh], description = [hfds], shortName = [kk], id = 8248}": {
},
"{label = location, displayName = [hh], description = [hfds], shortName = [kk], id = 12488}": {
}
}
} ]
Now as you can see the json so received is not appropriate because the key contains fields that are '=' separated .
Now as for the answer I also tried the folowing query
g.V(4128).repeat(out()).emit().tree().next()
but the response returned only ids and didnt resolve the vertex properties
[
{
"4128": {
"8272": {},
"4152": {
"4176": {
"4104": {},
"4296": {},
"8200": {}
},
"8344": {
"8224": {},
"8392": {}
}
},
"8248": {},
"12488": {}
}
}
]
For the context I am using the following configurations in my gremlin-server.yaml file
authentication: {className: org.apache.tinkerpop.gremlin.server.auth.AllowAllAuthenticator,
config: null}
channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
graphs: {graph: 'D:/graph-data-access/src/test/resources/titan-inmemory.properties'}
gremlinPool: 8
host: localhost
maxAccumulationBufferComponents: 1024
maxChunkSize: 8192
maxContentLength: 65536
maxHeaderSize: 8192
maxInitialLineLength: 4096
metrics:
consoleReporter: null
csvReporter: null
gangliaReporter: null
graphiteReporter: null
jmxReporter: null
slf4jReporter: {enabled: true, interval: 180000, loggerName: org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics}
plugins: [aurelius.titan, tinkerpop.gephi]
port: 8182
processors: []
resultIterationBatchSize: 64
scriptEngines:
gremlin-groovy:
config: null
imports: [java.lang.Math]
scripts: ['D:/graph-data-access/src/test/resources/generate-locations.groovy']
staticImports: [java.lang.Math.PI]
scriptEvaluationTimeout: 30000
serializedResponseTimeout: 30000
serializers:
- className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
config: {useMapperFromGraph: graph}
- className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
config: {serializeResultToString: true}
- className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0
config: {useMapperFromGraph: graph}
- className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0
config: {useMapperFromGraph: graph}
ssl: {enabled: false, keyCertChainFile: null, keyFile: null, keyPassword: null, trustCertChainFile: null}
threadPoolBoss: 1
threadPoolWorker: 1
writeBufferHighWaterMark: 65536
writeBufferLowWaterMark: 32768
I am using Tinkerpop version 3.0.1 incubating as I am trying to use Titan 1.0.0 with DynamoDb as storage backend for the remote connection.