HailDevil
HailDevil
Explore posts from servers
ATApache TinkerPop
Created by HailDevil on 7/13/2023 in #questions
Gremlin query to give response for 1 and 2 hops at same time
I have a graph setup with certain type of vertices like: inputFiles, outputFiles, convertors convertors basically take some input files, process them and produce output files. For example: convertor-abc -----output----> outputFile-1 | | input | | inputFile-1 this inputFile-1 can be an input to more than one convertors., an input file can also be an output file for another convertor vice versa for output file. I need to write a gremlin query which takes an input file id, looks for all the convertors for which this input file is given as input, and also all the input output files given to these convertors and gives in response; For example: { "file": "inputFile-id", "convertors": [ { "convertor": "convertor-1", "inputs" : [ { "file": "inputFile-id-1" }, { "file": "inputFile-id-2" } ], "outputs" : [ { "file": "outputFile-id-1" }, { "file": "outputFile-id-2" } ] }, { "convertor": "convertor-2", "inputs" : [ { "file": "inputFile-id-3" }, { "file": "inputFile-id-4" } ], "outputs" : [ { "file": "outputFile-id-3" }, { "file": "outputFile-id-4" } ] } ] } How can I achieve this in single gremlin query, also it is fesable to have a single query to achieve this? or its better to break the query into two and first we fetch all the convertors and then look for its input output files?
9 replies