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

Better syntax for node creation/query helpers? #43

Open
drkameleon opened this issue Nov 4, 2023 · 0 comments
Open

Better syntax for node creation/query helpers? #43

drkameleon opened this issue Nov 4, 2023 · 0 comments
Assignees
Labels
core functions Issues related to the main Grafito functions enhancement New feature or request open discussion Let's all talk about it! ;-) syntax Issues & PRs related to our query DSL

Comments

@drkameleon
Copy link
Contributor

drkameleon commented Nov 4, 2023

Right now, we have (let's say the "helper" is: person)

  • Create a new node (with just a name/title): person.new "John"
  • Create a new node (with various properties): person.new [name: "John" surname: "Doe"]
  • Query a new node (name only): person "John"
  • Query a new node (with various rules): person [surname: "Doe"]

I don't particularly dislike this person.new thing, but it still looks quite verbose. To be honest, I would prefer something like person! (for creating) and person for querying, or person (for creating) and person? for querying. That's just an example.

Both make sense, but both have their own issues. 🤔

For example:

  • The former's issue is that ! cannot be part of an identifier (it's the only really reserved character in Arturo - it's an accepted symbol actually - but I have managed to "keep it for later"; mainly the idea would probably be to use it as a preprocessor symbol, but that's a different story...)
  • The problem with the later is that normally identifiers ending in ? in Arturo mean: "do that and expect a boolean value will be returned" (= "predicate"). So, it would kind of break our own - not too bad - rule.

Another issue is that we may actually - in practice I mean - need more complicated queries.

For instance, in the different experiments I've done, I usually need something along the lines of: "get this node or create it if it doesn't exist". This can be done right now with: person.new.unique [name: "John" surname: "Doe"], but well... if person.new looks verbose to me, I can't start to explain why this looks like an... encyclopedia).

So, so, so... Open for discussion! :)

@drkameleon drkameleon added the enhancement New feature or request label Nov 4, 2023
@drkameleon drkameleon self-assigned this Nov 4, 2023
@drkameleon drkameleon added syntax Issues & PRs related to our query DSL open discussion Let's all talk about it! ;-) core functions Issues related to the main Grafito functions labels Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core functions Issues related to the main Grafito functions enhancement New feature or request open discussion Let's all talk about it! ;-) syntax Issues & PRs related to our query DSL
Projects
None yet
Development

No branches or pull requests

1 participant