Cool,
will rebase my fork and check it out as soon as I am not officially on
parental leave anymore ;)

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               - Your high performance graph database.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Sun, Jan 2, 2011 at 12:21 PM, Christopher Schmidt
<fakod...@googlemail.com> wrote:
> I see ...
>
> You can use
>
> val anyRef = "/index/node".GET[AnyRef]
>
> in this case anyRef.toString returns:
>
> {index2={template=
> http://localhost:7474/db/data/index/node/index2/{key}/{value},
> provider=lucene, type=fulltext}, my_nodes={template=
> http://localhost:7474/db/data/index/node/my_nodes/{key}/{value},
> provider=lucene, type=exact}}
>
> this is the most simple solution.
>
> If you know some properties and want to ignore others, you can put
> the JsonIgnoreProperties annotation to the class, like:
>
> @JsonIgnoreProperties(ignoreUnknown = true)
> case class GetIndex(@BeanProperty var my_nodes: MyNodes) {
>  def this() = this (null)
> }
>
> case class MyNodes(. . .)
>
> This would simply ignore the index2 object.
>
> I will check that in to github.
>
>
>
> However, the best thing would be to be as predictable as possible, f.e using
> an anonymous array:
>
> [
>  {
>    "name" : "index2",
>    "template" : "
> http://localhost:7474/db/data/index/node/index2/{key}/{value}";,
>    "provider" : "lucene",
>    "type" : "fulltext"
>  },
>  {
>    "name" : "my_nodes",
>    "template" : "
> http://localhost:7474/db/data/index/node/my_nodes/{key}/{value}";,
>    "provider" : "lucene",
>    "type" : "exact"
>  }
> ]
>
> Something like that...
>
> Christopher
>
> On Sat, Jan 1, 2011 at 11:01 PM, Peter Neubauer <
> peter.neuba...@neotechnology.com> wrote:
>
>> Yeah,
>> that sounds good. However, in the Index listing case, there is no
>> top-level key to pass into the class, sine alrady the root-level index
>> names are unpredictable. Is that possible to cover, too? In the
>> extensions case, there is at least the "extensions" handle to pass in,
>> even if we don't know the type of the value ...
>>
>> 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               - Your high performance graph database.
>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>
>>
>>
>> On Sat, Jan 1, 2011 at 10:57 PM, Christopher Schmidt
>> <fakod...@googlemail.com> wrote:
>> > Same as GET http://localhost:7474/db/data/ where I can not predict the
>> > extensions parameter. I used the simple data binding (see
>> > here<http://wiki.fasterxml.com/JacksonDataBinding>).
>> > Means that the parameter is of type Any
>> >
>> > case class GetRoot( . . . @BeanProperty var extensions:Any) {
>> >  . . .
>> > }
>> >
>> > Jackson "fills" it with a LinkedHashMap<String,Object>. F.e. if the
>> returned
>> > JSON is
>> >
>> > {
>> >  . . .
>> >  "extensions" : {
>> >    "GetAll" : {
>> >      "get_all_nodes" : "
>> > http://localhost:7474/db/data/ext/GetAll/graphdb/get_all_nodes";,
>> >      "getAllRelationships" : "
>> > http://localhost:7474/db/data/ext/GetAll/graphdb/getAllRelationships";
>> >    }
>> >  }
>> > }
>> >
>> > the LinkedHashMap.toString prints:
>> >
>> > {GetAll={get_all_nodes=
>> > http://localhost:7474/db/data/ext/GetAll/graphdb/get_all_nodes,
>> > getAllRelationships=
>> > http://localhost:7474/db/data/ext/GetAll/graphdb/getAllRelationships}}
>> >
>> > I don't know if there is a better way...
>> >
>> > Christopher
>> >
>> > On Sat, Jan 1, 2011 at 10:20 PM, Peter Neubauer <
>> > peter.neuba...@neotechnology.com> wrote:
>> >
>> >> Christopher,
>> >>
>> >> my problem is with the names of the index representations being able
>> >> to contain whatever, so the Scala case class can't assume a parameter
>> >> name. look at the result of an index creation and listing:
>> >>
>> >> curl -X POST -H Accept:application/json -HContent-Type:application/jon
>> >> -d '{"name":"index2",
>> >> "config":{"type":"fulltext","provider":"lucene"}}'
>> >> http://localhost:7474/db/data/index/node
>> >> {
>> >>  "template" : "
>> >> http://localhost:7474/db/data/index/node/index2/{key}/{value}";,
>> >>  "provider" : "lucene",
>> >>  "type" : "fulltext"
>> >> }
>> >>
>> >> $curl http://localhost:7474/db/data/index/node
>> >> {  "index2" : {
>> >>    "template" :
>> >> "http://localhost:7474/db/data/index/node/index2/{key}/{value}";,
>> >>    "provider" : "lucene",
>> >>    "type" : "fulltext"
>> >>  },
>> >>  "fulltext" : {
>> >>    "template" :
>> >> "http://localhost:7474/db/data/index/node/fulltext/{key}/{value}";,
>> >>    "provider" : "lucene",
>> >>    "type" : "fulltext"
>> >>  }
>> >> }
>> >>
>> >> How do I code this to be a map of Index classes in SJersey?
>> >>
>> >> 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               - Your high performance graph
>> database.
>> >> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>> >>
>> >>
>> >>
>> >> On Sat, Jan 1, 2011 at 8:43 PM, Christopher Schmidt
>> >> <fakod...@googlemail.com> wrote:
>> >> > Happy new year Peter,
>> >> >
>> >> > I did that already in my repo and added as well an example to use
>> >> > polymorphic "*node classes"* (using Scala's case classes, see
>> >> > here<
>> >>
>> https://github.com/FaKod/SJersey/blob/master/src/test/scala/org/sjersey/test/json/polymorphic/Animal.scala
>> >> >
>> >> > ).
>> >> >
>> >> > Christopher
>> >> >
>> >> > On Sat, Jan 1, 2011 at 9:59 AM, Peter Neubauer <
>> >> > peter.neuba...@neotechnology.com> wrote:
>> >> >
>> >> >> Christopher,
>> >> >> Happy New Year! I tried to fork and adapt the code to reflect the
>> >> >> updated REST API, but the variable index listing under
>> >> >> /db/data/index/node is too hard for my Scala skillz ... Feel free to
>> >> >> pull, diff and correct :)
>> >> >>
>> >> >> /Peter
>> >> >>
>> >> >> On Wednesday, December 29, 2010, Christopher Schmidt
>> >> >> <fakod...@googlemail.com> wrote:
>> >> >> > I am answering my own thread here, just in case someone is
>> >> interested...
>> >> >> >
>> >> >> > I solved my unmarshaling issue with Neo4j REST, JAXB and Jersey
>> with
>> >> >> using
>> >> >> > the Jackson JSON processor (http://jackson.codehaus.org/) instead
>> of
>> >> >> Jersey
>> >> >> > JSON.
>> >> >> >
>> >> >> > This makes it easy to write a POPO representation of Neo4j's REST
>> >> >> *objects*.
>> >> >> > I implemented some of them (in Scala), see here:
>> >> >> >
>> >> >>
>> >>
>> https://github.com/FaKod/SJersey/tree/master/src/test/scala/org/sjersey/test/json/neo4jstuff
>> >> >> >
>> >> >> > The usage is rather simple. I tested it with a *specs* test class
>> >> here:
>> >> >> >
>> >> >>
>> >>
>> https://github.com/FaKod/SJersey/blob/master/src/test/scala/org/sjersey/test/AccessTest.scala
>> >> >> >
>> >> >> > Although some idea files are checked in, it should be able to check
>> it
>> >> >> out
>> >> >> > with maven2 (pom.xml).
>> >> >> >
>> >> >> > I have written a blog post about this POC
>> >> >> > here<
>> >> >>
>> >>
>> http://blog.fakod.eu/2010/12/10/yet-another-trya-rest-client-with-jersey-and-scala/
>> >> >> >,
>> >> >> > as I said: Just in case someone is interested to use Scala, Jersey
>> and
>> >> >> the
>> >> >> > Neo4j REST server ;)
>> >> >> >
>> >> >> > Christopher
>> >> >> >
>> >> >> > On Wed, Dec 8, 2010 at 4:09 PM, Christopher Schmidt <
>> >> >> fakod...@googlemail.com
>> >> >> >> wrote:
>> >> >> >
>> >> >> >> I have a little spare time ;-) and I try to create a/another "very
>> >> >> smart"
>> >> >> >> REST client DSL in Scala.
>> >> >> >>
>> >> >> >> For testing and test data I am using the Neo4j Server from here:
>> >> >> >>
>> >> http://blog.neo4j.org/2010/04/neo4j-rest-server-part1-get-it-going.html
>> >> >> >>
>> >> >> >> Client library is Jersey, JSON marshaling and unmarshaling lib is
>> >> JAXB.
>> >> >> The
>> >> >> >> current client Scala code is:
>> >> >> >>
>> >> >> >> rest {
>> >> >> >>         implicit s =>
>> >> >> >>         val traversalPath = "node/3/traverse/path".POST[JSONArray]
>> <=
>> >> >> >> PathRequest(order = "depth first", max_depth = 4, uniqueness =
>> "node
>> >> >> path")
>> >> >> >>         println("Array length: " + traversalPath.length) // prints
>> 2
>> >> >> >>       }
>> >> >> >>
>> >> >> >> The above JSONArray works fine, but if I use Java objects
>> >> >> >> (as XmlRootElement) I get unmarshaling exceptions. It would be
>> >> helpful
>> >> >> If
>> >> >> >> there is someone out there who already created some JAXB objects
>> for
>> >> >> >> Neo4j...
>> >> >> >>
>> >> >> >> Christopher
>> >> >> >>
>> >> >> >>
>> >> >> >> On Wed, Dec 8, 2010 at 3:56 PM, Peter Neubauer <
>> >> >> >> peter.neuba...@neotechnology.com> wrote:
>> >> >> >>
>> >> >> >>> Christopher,
>> >> >> >>> are you trying to build your own server, or are you using Neo4j
>> >> Server?
>> >> >> >>>
>> >> >> >>> The REST API is now part of the server component, we are right
>> now
>> >> >> >>> defining a mechanism to mount your own server extensions without
>> >> >> >>> breaking the REST hypermedia of the existing API.
>> >> >> >>>
>> >> >> >>> What are you trying to do?
>> >> >> >>>
>> >> >> >>> 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               - Your high performance graph
>> >> >> >>> database.
>> >> >> >>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing
>> >> >> party.
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> On Wed, Dec 8, 2010 at 3:52 PM, Christopher Schmidt
>> >> >> >>> <fakod...@googlemail.com> wrote:
>> >> >> >>> > Hi all, is anyone using the REST interface and JAXB?
>> >> >> >>> >
>> >> >> >>> > I have some problems with the traversal response of POST call
>> to
>> >> >> >>> > "/node/3/traverse/path" which returns:
>> >> >> >>> >
>> >> >> >>> > [ {
>> >> >> >>> >  "start" : "http://localhost:9999/node/3";,
>> >> >> >>> >  "nodes" : [ "http://localhost:9999/node/3";, "
>> >> >> >>> http://localhost:9999/node/1";
>> >> >> >>> > ],
>> >> >> >>> >  "length" : 1,
>> >> >> >>> >  "relationships" : [ "http://localhost:9999/relationship/6"; ],
>> >> >> >>> >  "end" : "http://localhost:9999/node/1";
>> >> >> >>> > }, {
>> >> >> >>> >  "start" : "http://localhost:9999/node/3";,
>> >> >> >>> >  "nodes" : [ "http://localhost:9999/node/3";, "
>> >> >> >>> http://localhost:9999/node/2";
>> >> >> >>> > ],
>> >> >> >>> >  "length" : 1,
>> >> >> >>> >  "relationships" : [ "http://localhost:9999/relationship/2"; ],
>> >> >> >>> >  "end" : "http://localhost:9999/node/2";
>> >> >> >>--
>> >> >> > 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
>> >>
>> >
>> >
>> >
>> > --
>> > 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

Reply via email to