Peter, I think its not possible because "[" and "]" are reserved for Scalas
type declarations.
The String (fe. "KNOWS") is implicitly converted
into DynamicRelationshipType.withName("KNOWS").

What would be possible to get something like this (which is actually just a
change of method names):

start - "KNOWS" -> end

Regarding the Cypher language:
Its an interpreted language, so it is possible to define a completely free
syntax. In case of Scala, all we are doing has to be fit into the language
syntax, although it looks like a freely designed DSL. Cypher has some
similarities to SQL as a special query language. And to be honest, I think
using it programmatically will cause the same symtoms as SQL with respect
to runtime errors, type safety, abstraction etc.

Nevertheless, it would be interesting to create a nearly Cypher compilable
DSL, which includes type safety and transparent DAO or Case Class mapping.
Something like:

case class User(name:String)
val nodes = createNode(User("name1")) :: createNode(User("name2"))
:: createNode(User("name3")) :: Nil
. . .
for (f <- START nodes MATCH user-"friend"->follower WHERE follower.name =~
/S.*/ RETURN follower)
   println("User Follower: " + f.name)


This would be basically the same idea JPA tries with its criteria api. But
that will be hard work :-)

Christopher

On Wednesday, November 16, 2011, Peter Neubauer wrote:

> Chstopher,
> this looks really cool! I notice the similarity to the cypher syntax
> in the ASCII art part of the notation. Do you think there is a chance
> to make it even more similar to that so you could actually write
>
> start -[:KNOWS]-> intermediary - [KNOWS] -> end
>
> instead of
>
> start --> "KNOWS" --> intermediary --> "KNOWS" --> end ? Would be
> quite cool to be closely in line with
> http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html, maybe
> we could even use this for a modifying cypher in the future ...
>
> Cheers,
>
> /peter neubauer
>
> GTalk:      neubauer.peter
> Skype       peter.neubauer
> Phone       +46 704 106975
> LinkedIn   http://www.linkedin.com/in/neubauer
> Twitter      http://twitter.com/peterneubauer
>
> http://www.neo4j.org              - NOSQL for the Enterprise.
> http://startupbootcamp.org/    - Ă–resund - Innovation happens HERE.
>
>
>
> On Wed, Nov 16, 2011 at 6:36 AM, Christopher Schmidt
> <fakod...@googlemail.com> wrote:
> > Hi all,
> >
> > I released version 0.1.0 of the Neo4j Scala Wrapper neo4j-scala (base is
> > neo4j-scala by jawher).
> > Main features are
> >
> > - simple Traits for the wrapper itself, GraphDatabaseService provider,
> > index provider and batch insertion
> > - transaction wrapping:
> >
> > withTx {...}
> >
> > - natural usage of relations:
> >
> > start --> "KNOWS" --> intermediary --> "KNOWS" --> end
> >
> > - setting and getting properties:
> >
> > node("foo") = "bar"
> > node[String]("foo") match {
> >    case Some(x) => println(x)
> >    case None => println("aww")
> > }
> >
> > - easy CaseClass to/from Node/Relation properties marshaling
> >
> > withTx {
> >  implicit neo =>
> >    // create new Node with Case Class Test
> >    val node1 = createNode(Test("Something", 1, 2, 3.3, 10, true))
> >
> >    // or using Option[T] (returning Some[T] if possible)
> >    val nodeOption: Option[Test] = node.toCC[Test]
> >
> >    // create new relation with Case Class Test
> >    node1 --> "foo" --> node2 < Test("other", 0, 1, 1.3, 1, false)
> > }
> >
> > - transparent batch processing (simply replace 2 traits to use the same
> > code for batch- and non batch processing)
> >
> > For now I am using a simple Github "Maven repository".
> > Neo4j-scala should be usable with the following POM settings:
> >    <repositories>
> >      <repository>
> >        <id>fakod-releases</id>
> >        <url>https://raw.github.com/FaKod/fakod-mvn-repo/master/releases
> > </url>
> >      </repository>
> >    </repositories>
> >
> >    <dependencies>
> >      <dependency>
> >        <groupId>org.neo4j</groupId>
> >        <artifactId>neo4j-scala</artifactId>
> >        <version>0.1.0</version>
> >      </dependency>
> >    </dependencies>
> >
> > The Sources are hosted on Github:
> >
> > https://github.com/FaKod/neo4j-scala/tree/0.1.0
> >
> >
> > A simple Matrix example GIST is here:
> >
> > https://gist.github.com/1331556
> >
> >
> > Enjoy...
> >
> >
> > PS: Maybe you are using Neo4j Server via Jersey? So sjersey-client may be
> > interesting for you as well: see @
> > Github<https://github.com/FaKod/sjersey-client/tree/0.1.0> and
> > this example <https://gist.github.com/1366334>.
> >
> > --
> > Christopher
> > twitter: @fakod
> > blog: http://blog.fakod.eu
> >
> >
> >
> > --
> > Christopher
> > twitter: @fakod
> > blog: http://blog.fakod.eu
> > _______________________________________________
> > Neo4j mailing list
> > User@lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
> >
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


-- 
Christopher
twitter: @fakod
blog: http://blog.fakod.eu
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to