Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8685929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:42:18+00:00 2026-06-12T22:42:18+00:00

I am trying to write a gremlin expression that will, for a given vertex,

  • 0

I am trying to write a gremlin expression that will, for a given vertex, delete all the edges to and from it, and then delete the vertex itself.

I am using OrientDB 1.3-SNAPSHOT as my graph database.

This is my expression so far:

//The #8:1 just refers to a vertex
g.v('#8:1').bothE.each{ g.removeEdge(it) }.back(2)

I am expecting the above to delete the edges and then back 2, which should print out the node #8:1. However, for some reason, I am getting this error:

Error: java.lang.NullPointerException

Why is this happening?

Finally, how do I go about removing the vertex? The docs showed that removeVertex() requires an argument (which is the vertex). How do I pass the vertex from back(2) into removeVertex()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:42:20+00:00Added an answer on June 12, 2026 at 10:42 pm

    Gremlin actually deletes all the edges for you if you delete the vertex. In my case, I simply had to do:

    g.removeVertex(g.v('#8:1')); g.stopTransaction(SUCCESS);
    

    This will delete the vertex and any edges that are associated with the vertex. Stop transation is required for gremlin to commit the change.

    Now, as for why an error was thrown in the query for my statement. This is because each{} is a grovvy construct, so we exit the pipe. To continue in the pipe, use sideEffect{} instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to write a regular expression for java that will return true ONLY if
Trying to write app for service technicians that will display open service calls within
Trying to write a couple of functions that will encrypt or decrypt a file
I trying to write a regular expression that would match a particular word and
I'm trying write a simple perl script that reads some fields from a password
Trying to write a simple jQuery function that will multiple the index of an
Trying to write a python application that downloads images from an RSS feed, and
I'm trying write a C program that sends an UDP packet to a given
I'm currently trying write code that will maintain the sorting preference while changing page
Trying to write a procedure that given a value and a list, it deletes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.