Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Create config/sessions with translatorSupplier #347

Open
vigorouscoding opened this issue Jun 4, 2020 · 0 comments
Open

Comments

@vigorouscoding
Copy link

vigorouscoding commented Jun 4, 2020

I would like to connect to a Neptune database using Cypher for queries (and use multiple labels in queries which requires the TranslatorFeature.MULTIPLE_LABELS).

I do get this to work using the following code:

// cluster setup
// .. this is identical in both cases

// client setup
CypherGremlinClient client = CypherGremlinClient.translating(
		cluster.connect(),
		() -> Translator.builder()
				.gremlinGroovy()
				.inlineParameters()
				.enableMultipleLabels()
				.build(TranslatorFlavor.neptune())
);

However - as soon as I start using sessions and a GremlinServerDriver I can't seem to get it work. I run into an exception:

org.opencypher.gremlin.translation.exception.SyntaxException: Multiple labels are not supported
// cluster setup
// .. this is identical in both cases

// driver setup
Config config = Config.build()
		.withTranslation(TranslatorFlavor.neptune())
		.ignoreIds()
		.toConfig();

GremlinServerDriver driver = GremlinDatabase.driver(cluster, config);

I have tried quite a few ways to get this to work but it seems the referenced code line (which creates the CypherGremlinClient in the GremlinServerDriver.session() method) only allows using a TranslatorFlavor.

I would kindly ask if you could enable users to create a Config with a Supplier<Translator<String, GroovyPredicate>> translatorSupplier which could then be used upon creating of a session to produce a different translating CypherGremlinClient.

Unless I am mistaken there is no way to create sessions with such a translatorSupplier - if I am wrong I'd kindly ask for a nudge in the right direction.
I could also create a PR myself if you'd like.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant