Giter Club home page Giter Club logo

blueprints-scala's People

Contributors

aembleton avatar anvie avatar pdolega-test avatar vikraman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blueprints-scala's Issues

[ClassCastException: java.lang.String cannot be cast to scala.runtime.Nothing$]

When doing

vertext.toCC[Invitations].get

or

v.get[String]("code").get

i kept getting the same error,

[ClassCastException: java.lang.String cannot be cast to scala.runtime.Nothing$]

any thoughts?

play.api.Application$$anon$1: Execution exception[[ClassCastException: java.lang.String cannot be cast to scala.runtime.Nothing$]]
at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.0]
at play.api.DefaultApplication.handleError(Application.scala:383) [play_2.10.jar:2.1.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12$$anonfun$apply$24.apply(PlayDefaultUpstreamHandler.scala:314) [play_2.10.jar:2.1.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12$$anonfun$apply$24.apply(PlayDefaultUpstreamHandler.scala:312) [play_2.10.jar:2.1.0]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.0]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.0]
java.lang.ClassCastException: java.lang.String cannot be cast to scala.runtime.Nothing$
at com.ansvia.graph.ObjectConverter$._toCCPossible(ObjectConverter.scala:71) ~[blueprints-scala_2.10.jar:0.1.0]
at com.ansvia.graph.ObjectConverter$.toCC(ObjectConverter.scala:53) ~[blueprints-scala_2.10.jar:0.1.0]
at com.ansvia.graph.BlueprintsWrapper$ScalasticPropertyAccessor.toCC(BlueprintsWrapper.scala:120) ~[blueprints-scala_2.10.jar:0.1.0]
at controllers.Test$$anonfun$generateICode$1$$anonfun$apply$2.apply(Test.scala:39) ~[na:na]
at controllers.Test$$anonfun$generateICode$1$$anonfun$apply$2.apply(Test.scala:37) ~[na:na]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na]

val CLASS_PROPERTY_NAME = "_class_" in ObjectConverter causes rexster graph to throw exception for underscore

Hi,

Is it possible to not have underscores for the CLASS_PROPERTY_NAME ?

RexsterGraph does not support property keys that start with underscore
java.lang.RuntimeException: RexsterGraph does not support property keys that start with underscore
at com.tinkerpop.blueprints.impls.rexster.RexsterElement.setProperty(RexsterElement.java:81)
at com.tinkerpop.blueprints.impls.rexster.RexsterVertex.setProperty(RexsterVertex.java:20)
at com.ansvia.graph.ObjectConverter$.serialize(ObjectConverter.scala:48)
at com.ansvia.graph.BlueprintsWrapper$$anon$8.save(BlueprintsWrapper.scala:412)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.ansvia.graph.BlueprintsWrapper$DbObject$class.save(BlueprintsWrapper.scala:449)

Java8 and CallerSensitive annotation error

Hey,

I am simply not sure whether this is a bug, or whether I am the problem, so sorry for that.

Some facts:

  • Java 1.8.0_40
  • Scala 2.11.5
  • sbt 0.13.7

When runing a simple scala main class (OrientDBMigrator) I get an exception thrown when reaching the "save" part.

val address = Jakarta()
address.province = "Jakarta Barat" // this will be saved
address.street = "KS. Tubun" // this will be saved
address.postalCode = 12345 // this will be saved
address.save() ---> Exception thrown

[error] Exception in thread "main" java.lang.InternalError: CallerSensitive annotation expected at frame 1
[error] at sun.reflect.Reflection.getCallerClass(Native Method)
[error] at com.ansvia.graph.BlueprintsWrapper$.(BlueprintsWrapper.scala:21)
[error] at com.ansvia.graph.BlueprintsWrapper$.(BlueprintsWrapper.scala)
[error] at com.ansvia.graph.BlueprintsWrapper$DbObject$class.save(BlueprintsWrapper.scala:306)
[error] at Jakarta.save(OrientDBMigrator.scala:41)
[error] at OrientDBMigrator$.main(OrientDBMigrator.scala:74)
[error] at OrientDBMigrator.main(OrientDBMigrator.scala)

I am thankful for any comment,

Cheers, Fritz

object not bound to existing vertex, unsaved vertex?

In the following code I get " object Person(admin,godlike) not bound to existing vertex, unsaved vertex?" But I did do admin.save() (even twice!), so what is wrong with the code then or it is simply a bug?

case class Person(name:String, kind:String) extends DbObject

implicit val graph: Neo4jGraph = new Neo4jGraph("/tmp/test");
graph.setCheckElementsInTransaction(true)

val user = Person("user","mortal")
val admin = Person("admin","godlike")
val root = Person("root","god")
user.save()
admin.save()
root.save()

user-->"can be"-->admin
admin-->"can be"-->root
admin.save()
root.save()

Error:scalac: bad symbolic reference to scala.ScalaObject encountered in class file 'BlueprintsWrapper.class'.

I use scala version 2.11
If I add dependency as "com.ansvia.graph" %% "blueprints-scala" % "0.1.6"
sbt update
gives error "unresolved dependency: com.ansvia.graph#blueprints-scala_2.11;0.1.6: not found"

So I added dependency like this
"com.ansvia.graph" % "blueprints-scala_2.9.2" % "0.1.6"
but in this case compiler throws error

"Error:scalac: bad symbolic reference to scala.ScalaObject encountered in class file 'BlueprintsWrapper.class'.
Cannot access type ScalaObject in package scala. The current classpath may be
missing a definition for scala.ScalaObject, or BlueprintsWrapper.class may have been compiled against a version that's
incompatible with the one found on the current classpath."

Repl?

Howdy,

I'm getting this error:

Failed to parse pickled Scala signature from

which lead me to this comment, from another project, which pretty plainly spells it out:

codahale/jerkson#16 (comment)

I was wondering if there's anyway around this? So that code can be used from the repl? I'm currently trying to use this with play and it'd be nice to run .save in it's console.

Best,
Seve

p.s. feel free to just close this; if it's a definitive "no way." I'm not offended! My blood type is n00b ๐Ÿ‘

Reload element after a closed transaction

A reload() method for Vertices/Edges would be helpful. For example,

transact {
  val v = obj.save()
}
//do something else
v.reload()
v.set("foo","bar")

instead of

val w = db.getVertex(v.getId)
w.set("foo","bar")

Incorrect use of Class.forName

It seems that using this (Class.forName) may cause ClassNotFoundException thrown from inside of some of the classes. It seems to be same issue as here: playframework/playframework#2847 In short - ClassLoader problems - there may be different classloaders withing the scope of this library and outside of it apparently (think OSGI, application containers).

It my case it happens if you use this lib inside Play (and only in DEV environment, in application produced with dist it works fine) application and it results in ClassNotFound being thrown from the piece of code called by Vertex.toCC

Here is the exact piece of code that I belive is causing problems: https://github.com/anvie/blueprints-scala/blob/master/src/main/scala/com/ansvia/graph/ObjectConverter.scala#L115-L129

The solution would be to pass ClassLoader to the blueprints-scala Vertex.toCC method (create overloaded version). I wonder though if there is other - more elegant way...

That's the stack trace:

java.lang.ClassNotFoundException: com.nexelem.nutstrap.play.mocks.models.Person
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.ansv
ia.graph.ObjectConverter$._toCCPossible(ObjectConverter.scala:109)
    at com.ansvia.graph.ObjectConverter$.toCC(ObjectConverter.scala:60)
    at com.ansvia.graph.BlueprintsWrapper$ScalasticPropertyAccessor.toCC(BlueprintsWrapper.scala:120)
    at com.nexelem.nutstrap.play.mocks.DbMock$.run(DbMock.scala:31)
    at com.nexelem.nutstrap.play.controllers.FactoryController$$anonfun$getImage$1.apply(FactoryController.scala:40)
    at com.nexelem.nutstrap.play.controllers.FactoryController$$anonfun$getImage$1.apply(FactoryController.scala:39)
    at play.api.mvc.ActionBuilder$$anonfun$async$1.apply(Action.scala:481)
    at play.api.mvc.ActionBuilder$$anonfun$async$1.apply(Action.scala:481)
    at play.api.mvc.Action$.invokeBlock(Action.scala:556)
    at play.api.mvc.Action$.invokeBlock(Action.scala:555)
    at play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:518)
    at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130)
    at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130)
    at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
    at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129)
    at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:128)
    at scala.Option.map(Option.scala:145)
    at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:128)
    at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:121)
    at play.api.libs.iteratee.DoneIteratee$$anonfun$mapM$2.apply(Iteratee.scala:705)
    at play.api.libs.iteratee.DoneIteratee$$anonfun$mapM$2.apply(Iteratee.scala:705)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Vertexes with labels?

Is it possible to create Vertexes with labels via blueprint-scala .save() method?

I use blueprint-scala with Titan DB. An quote from Titan DB doc:
"For compatibility with Blueprints, Titan provides differently-named methods for adding labeled and unlabeled vertices:

addVertexWithLabel
addVertex"

It would be nice to use this feature, especially with indexes by labels.

Cannot set edge properties

transact {
  val edge = userVertex --> "follow" --> tagVertex <
  edge.set("timestamp", DateTime.now)
}
[error] Tag.scala:68: recursive value edge needs type
[error]           edge.set("timestamp", DateTime.now)
[error]           ^
[error] one error found
[error] (compile:compile) Compilation failed

I can get rid of it by doing val modEdge = edge.sedge.set("timestamp", DateTime.now) but then transact won't work.

TitanDb Wrapper

Having spent the better part of 2 days trying to get Titan to work unsuccessfully, I was wondering if someone create a wiki page on how to do this with Titan for Scala 2.10:

  import com.ansvia.graph.BlueprintsWrapper._
  implicit val db = TinkerGraphFactory.createTinkerGraph()
  case class Person(name:String) extends DbObject
  val bob = Person("bob").save()
  val alice = Person("alice").save()
  alice --> "sendsPgpKeyTo" --> bob

GremlinGroovy

I would like to know if there is a way I could use GremlinGroovy style annotations with Blueprint Scala. I understand bp-scala is more like a ORM approach but it would be nice to be able to these annotations.

ansvia-commons missing from Maven Central repo

blueprints-scala 0.1.5 is published on Sonatype OSS repo, which is synced to Maven Central. All artifacts published to Maven Central are supposed to depend only on other artifacts available on Maven Central, central repo should be self-contained. blueprints-scala 0.1.5 breaks this rule, as it depends on com.ansvia:ansvia-commons:0.0.7 which is not available on Maven Central.

Please publish ansvia-commons:0.0.7 to Sonatype OSS repo / Maven Central.

3 warnings/errors with -Xlint scalac flag

[error] /blueprints-scala/src/main/scala/com/ansvia/graph/util/scalax/rules/Rule.scala:46: a type was inferred to be Any; this may indicate a programming error.
[error] def orError[In2 <: In] = this orElse (error[In2])
[error] ^
[error] /blueprints-scala/src/main/scala/com/ansvia/graph/util/scalax/rules/scalasig/ScalaSig.scala:180: a type was inferred to be Any; this may indicate a programming error.
[error] def symHeader(key: Int) = (key -~ none | (key + 64) -~ nat)
[error] ^
[error] /blueprints-scala/src/main/scala/com/ansvia/graph/util/scalax/rules/scalasig/ScalaSig.scala:279: a type was inferred to be Any; this may indicate a programming error.
[error] 26 -~ longValue ^^ (_.toByte),
[error] ^
[error] three errors found
error Compilation failed
[error] Total time: 15 s, completed Aug 3, 2015 11:45:54 AM

Explicit types should solve this problem.

Making DbObject more idiomatic

The DbObject helper trait has several "non-Scalastic" qualities:

  • the underlying, mutable Vertex is exposed via getVertex (especially problematic since DbObject seems to be intended to be mixed into case classes),
  • most of the utility methods are "expression unfriendly" (return Unit).

Obviously, there needs to be a way to interface with the "main" blueprints API, but is there a reason for this particular implementation?

I would be very happy to produce a PR with a more idiomatic approach, but I'd like to understand the rationale for the status quo first.

Question: Why store className (_class_) in the database ?

I'm using OrientDB and when trying to save a record to the database with the following code a _class_ property is added to the database for every record which stores the full className (com.messaging.actor.Person). I'm worried this tight coupling of the full className(including package name) will cause issues if someone moves the classes around.

val person = Person("John Smith")
    val address = new Address("Sydney, Australia")
    db.save(person)
    db.save(address)
    person --> "address is" --> address 

Is there a reason why storing the full className in the database was chosen ? Instead of just passing the Class to convert Vertex object to Case Class whenever needed (eg: toCC method) ?

val vertices = db.getVertices("name", "John Smith").asScala
    vertices.foreach(vert => {
      println(vert.toCC[Person])
    })

Indexes?

Hey,

Is there anyway to use indexes with this library? Either through creating/saving records to an index or by using something like a KeyIndexableGraph?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.