Gremlin GroovyTranslator generates wrong result and fails at remote server

michael

I am using Gremlin java and I found GroovyTranslator adds additional \ before $ sign, and this causes query failing to execute on remote server.

GraphTraversal traversal = graph.addV().property("amount", "$1");
System.out.println(GroovyTranslator.of("g").translate(traversal.asAdmin().getBytecode()));

Translated result:

g.addV().property("amount","\$1")
  1. If this is issue with GroovyTranslator, i can replace \$ with $, but I am not sure if more special characters will have this issue.

  2. This fails because of backslash, but what if some property value want to use backslash?
    From what I see, use backslash will always fail.
    I suppose following should work but it doesn't:

    curl -X POST -d '{"gremlin":"g.V().has(\"key\",\"\\$\")"}' ...
    
Kelvin Lawrence

In Groovy the dollar sign has special meaning if you are using Groovy Strings (GStrings). It is used to indicate interpolation should occur as in :

gremlin> a=3
==>3
gremlin> "The number is $a"
==>The number is 3

If the server you are connecting to uses Groovy as-is to parse the query then the backslash is needed. If the server does not use Groovy as-is then you will need to remove the backslash.

There are a few other things to be aware of with GroovyTranslator. When it generates literal numbers it puts a cast such as (int) 3 into the query. You may need to also remove these depending on the back end graph database you are connecting to.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Full Text Search generates wrong result

Connecting gremlin CLI to a remote tinkerpop gremlin-server

Tinkerpop Gremlin server MissingPropertyException for SparkGraphComputer in remote mode

Hibernate returns wrong result set and generates wrong query

Gremlin-server: does vertexIdManager=ANY generates id collisions?

LINQ left join, group by and Count generates wrong result

Rails generates wrong asset url in production (with localhost instead of server ip)

predict fails when execute from remote server

openmpi installation fails locally and on remote server

Weird result from $_SERVER['REMOTE_ADDR']

Wrong result of user defined aggregate in SQL Server

PHP time() produces wrong result on server

Formula in SQL server is rounding creating wrong result

Result.data working in local and fails on Server

Gremlin remote command fails on azure cosmosDB: Host did not respond in a timely fashion

Call a remote API through NodeJS and attach the result to my API fails

Mockito test for spring method fails due to wrong result in the response

Gremlin : fetch result as an Array

CppSharp generates the wrong code

Where Is JanusGraph's Gremlin-Console Finding its Tinkerpop-Server's "conf/remote.yaml"?

Why is $_SERVER['REMOTE_ADDR'] showing a wrong ip?

Pushing mocks to remote wiremock server fails with "JSON Parsing" Error

add service reference fails with: Unable to connect to the remote server

SCP from Remote Mac to SSH'd Server Fails

Odoo v8 fails to load from remote server installation

Executing svn info in cronjob fails agianst remote server

Enter-PSSession to remote server fails with "cannot find the computer"

Ansible copy from the remote server to ansible host fails

Pipenv fails to install boto3 on remote server (Heroku)

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    flutter: dropdown item programmatically unselect problem

  14. 14

    How to use merge windows unallocated space into Ubuntu using GParted?

  15. 15

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  16. 16

    Nuget add packages gives access denied errors

  17. 17

    Svchost high CPU from Microsoft.BingWeather app errors

  18. 18

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  19. 19

    12.04.3--- Dconf Editor won't show com>canonical>unity option

  20. 20

    Any way to remove trailing whitespace *FOR EDITED* lines in Eclipse [for Java]?

  21. 21

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

HotTag

Archive