Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 26 21:44
    jtarvydas added as member
  • May 24 04:26

    github-actions[bot] on v3.4.7.17

    (compare)

  • May 24 04:23

    mpollmeier on master

    run test across all scala versi… Merge pull request #303 from mp… (compare)

  • May 24 04:23
    mpollmeier closed #303
  • May 24 04:09
    mpollmeier review_requested #303
  • May 24 04:09
    mpollmeier opened #303
  • May 24 04:09

    mpollmeier on run-cross-scala-version-test

    run test across all scala versi… (compare)

  • May 24 01:13
    mpollmeier commented #302
  • May 22 22:33

    github-actions[bot] on v3.4.7.16

    (compare)

  • May 22 22:32

    ithinkicancode on master

    Revert back to 2.11 Stream (#30… (compare)

  • May 22 22:32
    ithinkicancode closed #302
  • May 22 22:30
    ithinkicancode opened #302
  • May 22 22:16

    github-actions[bot] on v3.4.7.15

    (compare)

  • May 22 22:14

    ithinkicancode on master

    Reverted `LazyList` and put bac… (compare)

  • May 22 22:14
    ithinkicancode closed #301
  • May 22 22:12
    ithinkicancode opened #301
  • May 22 21:39

    github-actions[bot] on v3.4.7.14

    (compare)

  • May 22 21:38

    ithinkicancode on master

    1. Lib upgrades (Scalatest, sca… (compare)

  • May 22 21:38
    ithinkicancode closed #300
  • May 22 21:27
    ithinkicancode added as member
Benoit George
@sharkgua
CTRL+L in Linux and, according to https://www.davidtan.org/how-to-clear-screen-in-groovy-console/, CTRL+W in Windows.
Ernie Makris
@emakris_twitter

I’m confused about labels. I have this code:

val a = StepLabel[Vertex]()
val baseCreateT = g.V().has(lableName, idKey, value)
      .fold()
      .coalesce(_.unfold[Vertex](),
        _.addV(labelName).property(idKey, value)).as(a)

the type of baseCreateT is Aux[Vertex, Vertex :: HNil] after the as() call.
if I don't include the as() call, it is a Aux[Vertex, HNil]. I guess I don't know enough about shapeless yet,
but I wanted to pass this tranversal to another method to add properties. Is there a generic way to reference
a traversal step that is for a vertex?

any help would be appreciated!
Ernie Makris
@emakris_twitter
well, I just realized that I can parameterize the second part of the Aux.
Ernie Makris
@emakris_twitter

@mpollmeier I’m trying what I think is a simple project operation against neptune and I’m seeing the following error:

val result = g.V().hasLabel("foo").project(_(By(Key[String]("id"))).and(By(Key[String]("cloud")))).toList()

I'm seeing an error like this:
org.apache.tinkerpop.gremlin.driver.exception.ResponseException: An error occurred during serialization of this request [RequestMessage{, requestId=bb961b69-b0c7-4f90-b928-9698590b7bb9, op='bytecode', processor='traversal', args={gremlin=[[], [V(), hasLabel(foo), project(41b7a217-91d0-4463-acf4-1c2485e74ff1, 627bd6b6-f97c-48a6-95f3-7126db4ebd0d), by(id), by(cloud), map(gremlin.scala.package$$anon$5@11ecf329)]], aliases={g=g}}}] - it could not be sent to the server - Reason: org.apache.tinkerpop.gremlin.driver.ser.SerializationException: Serializer for type gremlin.scala.package$$anon$5 not found

I know that neptune doesn’t support lambda steps, is this the reason?
Michael Pollmeier
@mpollmeier
yes exactly. it's trying to serialize your traversal and to send it over the wire, which doesn't work because it contains lambdas
Ernie Makris
@emakris_twitter
if I use project(“a”, “b”).by(..).by(..), everything works ok, I reached for the projection builder because all the by() methods were marked as deprecated.
I’m a newbie, so I’m not sure if using the by.by syntax is going to go away in a future gremlin-scala release
vonchav
@voonchav_gitlab
Hi, any plan to upgrade to tinkerpop/gremlin-3.4.7 and/or Scala 2.13.3?
Michael Pollmeier
@mpollmeier
thanks for the reminder, i guess it's time. i just upgraded scala/sbt, will take a lot what it takes re tinkerpop version
1 reply
Michael Pollmeier
@mpollmeier
just upgrade tinkerpop to 3.4.7 as well, latest release is out as version 3.4.7.1
1 reply
vonchav
@voonchav_gitlab

Hi @mpollmeier , how do I translate this traversal g.V().hasLabel('continent').group().by('code').by(out().count()) into gremlin-scala? I tried:

val code = Key[String]("code")
g
    .V()
    .hasLabel("country")
    .group(By(code))
    .by(__.out().count())
    .headOption()

Obviously, this doesn't compile. I know #by is mostly deprecated. But I don't know how to chain out().count() after By(count) in #group.

1 reply
vonchav
@voonchav_gitlab
Hi @mpollmeier,
How do I translate this Groovy traversal to gremlin-scala? g.V().hasLabel("foo").project('a','b','c').by('code').by('region').by(__.out().count())
Hi @emakris_twitter ,
I'm having the same problem that you asked about a few months ago, regarding the issue with project(_(By(Key[String]("id"))).and(By(Key[String]("cloud")))) not working and project.by(...) being deprecated. Did you find a solution?
Thank you in advance.
Duncan Hills Coffee Company
@DuncanHills
@voonchav_gitlab I don't recommend @ mentioning library authors repeatedly if you want support for something. Try posting on stack overflow. You're just going to burn people out like that.
Jonathan Ward
@jbward1

I'm going through the book Graph Databases in Action, but i'm using gremlin-scala to go through some of the examples. I was reading about chaining mutations and i'm a bit stumped on the best way to get this working. If I just pull the example from the book, i'm getting a compile error: No Implicits found for parameter ev: Edge <:< Vertex

implicit val graph: ScalaGraph = TinkerGraph.open().asScala()
private val g = graph.traversal

val dave = graph + (Person, FirstName -> "Dave")
val kelly = graph + (Person, FirstName -> "Kelly")
val jim = graph + (Person, FirstName -> "Jim")

g.addE(Friends).from(dave).to(jim)
//Compile Error: No Implicits found for parameter ev: Edge <:< Vertex
 .addE(Friends).from(dave).to(kelly)
 .addE(Friends).from(kelly).to(jim)

What is the best way to handle multiple mutations in a single transaction with gremlin-scala?

Michael Pollmeier
@mpollmeier
@jbward1 you're right, the constraint is not only not necessary for addE, it's also totally in the way. PR coming shortly, thanks for reporting!
Michael Pollmeier
@mpollmeier
Jonathan Ward
@jbward1
@mpollmeier thanks for the quick PR!
aparajitha-cn
@aparajitha-cn
Hi @mpollmeier , is there a way to perform wild card search in Gremlin Scala?
Michael Pollmeier
@mpollmeier

when you say 'wild card search', I presum you mean regular expressions?
No it doesn't, since Tinkerpop doesn't provide that:

TinkerPop does not support a regular expression predicate, although specific graph databases that leverage TinkerPop may provide a partial match extension.
From https://tinkerpop.apache.org/docs/current/reference/#has-step

aparajitha-cn
@aparajitha-cn
So if I want perform a search on the name field for partial matches, is there a way to do it in gremlin scala?
Michael Pollmeier
@mpollmeier
You could use TextP, I just added an example for you here: https://github.com/mpollmeier/gremlin-scala/blob/5f2b9df/gremlin-scala/src/test/scala/gremlin/scala/FilterSpec.scala#L33
Or the more flexible filterOnEnd step which is just above that.
aparajitha-cn
@aparajitha-cn
Hi @mpollmeier, I tried using TextP in my query but got a runtime exception for the same. Following is my query : db.g.V().hasLabel("business").has(Key[String]("name"), TextP.containing("net")).l()
aparajitha-cn
@aparajitha-cn
Runtime Exception which I got is :
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Could not read the traversal from the request sent. Cause: Could not deserialize the JSON value as required. Nested exception: org.apache.tinkerpop.shaded.jackson.databind.JsonMappingException: Could not deserialize the JSON value as required. Nested exception: org.apache.tinkerpop.shaded.jackson.data bind.exc.MismatchedInputException: Cannot deserialize instance of java.lang.String out of START_OBJECT token at [Source: (String)"{"@type":"g:Bytecode","@value":{"step":[["V"],["hasLabel","business"],["has","name",{"@type":"g:TextP","@value":{"predicateType":"P","predicate":"containing","value ":"net"}}]]}}"; line: 1, column: 113]
Could you please help me resolve it?
Michael Pollmeier
@mpollmeier
if you're using a remote database you cannot use lambdas, like TextP or filterOnEnd
i.e. unfortunately you're bound by the limits of TinkerPop here, as quoted/linked above
aparajitha-cn
@aparajitha-cn
So do you think there is a workaround for this? Or is it not possible for me to do this kind of search at all?
Michael Pollmeier
@mpollmeier
I'm not sure, sorry.
vonchav
@voonchav_gitlab
Hi Michael, I see the latest version of gremlin-driver is 3.4.10. I'm wondering if there is any obstacle to upgrade gremlin-scala to this version. :)
Michael Pollmeier
@mpollmeier
Not that I know of (other than my limited time). Both me and Jeremy are happy to merge a (green) PR - could you give it a try please?
venkat125
@venkat125

Hi, is there a way in gremlin query to return with the transaction details.
For eg: suppose i attempt to create an edge (relationship) between two vertices (nodes). Then, when either (or) both the vertices (nodes) are absent the transaction would be Unsuccessful
I'm trying the following query:

Java code

`graphTrav addE = addE('label').from('fromId').to('toId')

g.V('fromId').as('from')
.V('toId').as('to')
.coalesce(inE('label').where(outV().as('from')),
addE)
.property('k','v').promise(Traversal::hasNext);`

The above query returns CompletableFuture<Boolean> as True (Successful) and false (Unsuccessful). But the reason for the Unsuccessful transaction is not known.

Is there any way to get the trace / cause on the transaction?
or
any workaround to check on vertices availability before creating edge in single query / transaction?

Michael Pollmeier
@mpollmeier
3 replies
venkat125
@venkat125

Hi team / @mpollmeier i managed to get the above working. but stuck in using alias as follows:

g.V('1a').as('from')
.V('1b').as('to')
.inE('edge_label')
.where(outV()).as('edge')
.select('from','to','edge').fold()
.coalesce(unfold(),select('fom'))

couldn't retrieve the save alias for next operation. Please correct me if i'm wrong. Thanks in advance.
I'm trying to get the 'from' alias in the second traversal of the coalesce.

Jeremy Sears
@jeremysears
@venkat125, your question is Gremlin query language related. This project (gremlin-scala) is a Scala type-safe facade around Gremlin Java. This isn't the right place to post general Gremlin language questions.
venkat125
@venkat125
thanks for the info @jeremysears
vonchav
@voonchav_gitlab
Hi @mpollmeier & @jeremysears, I'm working on a PR to upgrade a few libs and remove some compilation warnings. I notice that the old scala.collection.JavaConverters is used. I guess we cannot move to the new scala.jdk.CollectionConverters because we need to support both 2.11 and 2.12. Just wanted to confirm with you before I push my PR.
Jeremy Sears
@jeremysears
I'm OK with dropping support for 2.11, but for now, I need support for 2.12. I have an upgrade in the plan, but I'm not there yet. I'd be curious to hear what other constraints other users may have. I don't think moving to CollectionConverters is justification enough to disrupt users by dropping 2.11 or 2.12 support. Just my $0.02. I'm exited to hear you're interested in contributing!
vonchav
@voonchav_gitlab

I agree. I started replacing the imports, mostly in tests but then I realized that gremlin-scala cross-compiles to 3 Scala versions. So I will revert the changes to use the old converter.

As for my progress, I have updated ScalaMock and ScalaTest to the latest version. ScalaTest ships multiple modules now. That was pretty easy. I fixed all the Auto-application to () is deprecated warnings for future proof. There were a lot of them - could have used ScalaFix for that but no biggie :) I upgraded Tinkerpop to 3.4.11 (the latest in the 3.4.x series). Seems fine, although there are other deprecations we should definitely take care of soon. I tried upgrading to 3.5.0 but I don't have enough knowledge to resolve one deprecation. Then I thought we don't need to be using this new big release yet. It will take time for the community to upgrade. That said, there are deprecations that are long overdue, I feel. I removed one deprecation so far. But I'm rather new to Tinkerpop and Gremlin so I definitely don't have the know-how and experience to resolve all the remaining deprecations. Hopefully you will have some time to take a look at them. However, some of them are a bit ambiguous. Tinkerpop marks them deprecated but the docs said the replacement implementations offer only partial support or they need revisits in the future releases.

Right now the only blocker is upgrading Shapeless. Recently Shapeless becomes active again due to Scala 3 :) There are two recent upgrades 2.3.5/6. Some changes have been made to the TupleOps stuff. Currently the compilation fails at one line that prepends a tuple. I've asked the question on typelevel's forums. Hopefully I can resolve that soon. Once that's done, I will create a pull request.

Michael Pollmeier
@mpollmeier
Thanks @voonchav_gitlab !
I'm also ok with dropping 2.11, that should make cleaning up much easier going forward.
vonchav
@voonchav_gitlab
Hi, I pushed my PR: mpollmeier/gremlin-scala#300
Please review when you get a chance. Thank you.
vonchav
@voonchav_gitlab
Hi Jeremy & Michael, I merged my PR but I didn't realize that merging triggers the release process too :) Actually that's good, well, good in the sense that the release process failed due to LazyList (replacement of Stream) doesn't exist in 2.11.
So I'm going to create a new PR to revert and put back Stream. I know you have expressed dropping 2.11 support. Since it's just one change, let's keep the support for now, otherwise dropping support for a Scala version should probably merit a minor release, as opposed to a patch release, if we follow semver convention. :)
vonchav
@voonchav_gitlab
Ok, 3.4.7.16 is now released and I was able to download it from maven! Thanks!
Michael Pollmeier
@mpollmeier
:thumbsup:
the PR build really should have caught that... next time it will: mpollmeier/gremlin-scala#303
vonchav
@voonchav_gitlab
I'll see if I have some bandwidth next week to look at a couple of those Tinkerpop deprecations.
I've started looking into Scala 3 derivation stuff. Might be able to help migrate the Scala 2 macro to Scala 3.
Michael Pollmeier
@mpollmeier
that'd be awesome - i don't have any bandwidth to push for that in the near future, but i'm happy to assist/review
vonchav
@voonchav_gitlab
Happy to help, plus that should be fun :)
Manabu Tokunaga
@imanabu

Hello, I am super happy to find gremlin scala. I know similar question was asked about Cardinality but that's one area that's also hard for me to deal with.

Would it be possible to add Option[Cardinality] within Key[T] and that if it is present, you'd use it to talk to the Tinkerpop API?
I am escaping the traversal to Java by g.addV("label").traversal and that works for me, but it would be nice to not get in and out of Java. I would rather stay in pure Scala.

And having the cardinality built into the Key, this construct will work beautifully...
val pa = g + (testLabel, group -> "Palo Alto", rooms -> 15, beds -> 12)