Actually,
it might be an idea to look at this kind of DSL for Cypher, much along
the (Scala) lines of Rickards Java-DSL,
http://rickardoberg.wordpress.com/2011/11/14/creating-a-dsl-for-cypher-graph-queries/
instead of trying to mimic literal Cypher Strings.

WDYT?

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 Thu, Nov 17, 2011 at 4:04 PM, Marko Rodriguez <okramma...@gmail.com> wrote:
> Hey,
>
> It might be a little too soon to bring it up, but early December, we are 
> releasing Gremlin Scala in Gremlin 1.4 which will allow you to import Gremlin 
> into your Scala project (e.g. Neo4j-Scala Wrapper) and evaluate Gremlin 
> queries natively.
>
>        https://github.com/tinkerpop/gremlin/tree/master/gremlin-scala
>
> For example, in Gremlin Scala:
>
>        g.v(1).out("knows").out("created").filter{v:Vertex => 
> v("name").equals("marko")}
>
> This way Scala developers can use Gremlin-style traversing natively in their 
> Scala code.
>
> See ya,
> Marko.
>
> http://markorodriguez.com
>
> On Nov 17, 2011, at 5:21 AM, Christopher Schmidt wrote:
>
>> 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
>
> _______________________________________________
> 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

Reply via email to