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

Implement apoc.util.validate and apoc.util.validatePredicate #525

Open
katarinasupe opened this issue Nov 4, 2024 · 2 comments
Open

Implement apoc.util.validate and apoc.util.validatePredicate #525

katarinasupe opened this issue Nov 4, 2024 · 2 comments
Assignees
Labels
bug bug community community Effort - Unknown Effort - Unknown Frequency - EveryTime Frequency - EveryTime Reach - Some Reach - Some Severity - S2 Severity - S2

Comments

@katarinasupe
Copy link
Contributor

katarinasupe commented Nov 4, 2024

On mutation, you get the following error:

"Function 'apoc.util.validatePredicate' doesn't exist."

To reproduce, run the attached code. Open Apollo server on localhost:4000. Run the following code to create user nodes:

# Create a user
mutation {
  createUsers(input: 
  [ { 
    name: "katarina"
  }]
  
  ) {
    users {
      id,
      name
    }
  }
}

# Create multiple users
mutation {
  createUsers(input: 
  [ { 
    name: "matea"
  },
  {
    name: "ante"
  },
  {
    name: "gabor"
  }]
  
  ) {
    users {
      id,
      name
    }
  }
}

Then, try the following mutation (connectOrCreate requires @unique decorator - we didn't document this well enough; it might have been added to never version):

# Create a post
mutation {
  createPosts(input: 
  [ { 
    content: "hello world!",
    creator: {
      connectOrCreate: {
        where: { node: { id: "06daddb7-1657-4e6a-8a7d-b11ec6d2698f" } }
        onCreate: { node: { name: "katarina" } }
      }
    }
  }]
  
  ) {
    posts {
      id,
      content
    }
  }
}

The above mutation results in the reported error, instead of creating a post.

This was reported on Discord.

@katarinasupe katarinasupe added bug bug community community Effort - Unknown Effort - Unknown Severity - S2 Severity - S2 Frequency - EveryTime Frequency - EveryTime Reach - Some Reach - Some labels Nov 4, 2024
@antejavor
Copy link

antejavor commented Nov 20, 2024

@katarinasupe Memgraph currently works on basic CRUD operations, it does not work in some specific cases where the apoc calls are needed.

The Neo4j graphQL changes the schema into the Cypher queries with hardcoded apoc calls.

The option is to code apoc modules into memgraph Mage modules that are missing and needed in the driver. Replace the apoc call with the Memgrpah Mage call QM call.

So, to be able to do this, we first need to code the following QM:

apoc.util.validate
apoc.util.validatePredicate

After that Memgraph needs to understand that it needs to change the query, as a first step I am transferring this issue to the Mage repository.

I think it is better to code the QMs and change the apoc calls as we move towards cipher generation from LLMs and convert from apoc to MAGE calls.

@antejavor antejavor transferred this issue from memgraph/memgraph Nov 20, 2024
@antejavor antejavor changed the title GraphQL v5 does not work as expected Implement apoc.util.validate and apoc.util.validatePredicate Nov 20, 2024
@antejavor antejavor removed this from drivers Nov 20, 2024
@katarinasupe
Copy link
Contributor Author

So, @antejavor the above mentioned procedures need to be implemented and https://github.com/memgraph/mage/blob/bf4b04d10bc6750ba2b665399e48d893919c50d8/apoc_mappings.json updated to make GraphQL v5 work with Memgraph for basic CRUD operations if I understood correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bug community community Effort - Unknown Effort - Unknown Frequency - EveryTime Frequency - EveryTime Reach - Some Reach - Some Severity - S2 Severity - S2
Projects
Development

No branches or pull requests

2 participants