Re: [Neo4j] Neo4j-Scala Wrapper 0.1.0 released

2011-11-19 Thread Christopher Schmidt
I've made an dirty hack how a traversal (query) DSL could look like in
Scala. I pushed the code to
herehttps://github.com/FaKod/neo4j-scala/blob/ScalaTraverserHack/examples/eu/fakod/examples/TheMatrixTraversalHack.scala
.

The query uses a collections of nodes (nodeMap is a HashMap mapping
Strings to Node instances):

val startNodes = nodeMap(Neo) :: nodeMap(Morpheus) ::
nodeMap(Trinity) :: Nil

The Traverser can be started by calling method start on this list of nodes:

startNodes.start[Matrix](_.name.length  3)(--(CODED_BY) -- (KNOWS) --)

   - start takes type parameters. In This case its the case class
Matrix(defined by case
   class Matrix(name: String, profession: String)) used while creating the
   nodes (a neo4j-scala feature).
   - The Term (_.name.length  3) is basically the returnable evaluator,
   which dereferences the name parameter of the Matrix instance and checks its
   length.
   - The Term (--(CODED_BY) -- (KNOWS) --) evaluates to the
   relationship type and direction array (as parameterlist to call method
   traverse)


The return of the call is a List of Matrix instances. Its possible to use
Scala collection API to apply operations on this.
Like sorting:

startNodes.start[Matrix](_.name.length  3)(--(CODED_BY) -- (KNOWS)
--) sortWith (_.name  _.name)

The length of all names:

startNodes.start[Matrix](_.name.length  3)(--(KNOWS)
--).map(_.name).foldLeft(0)(_ + _.length)

Append all names:

startNodes.start[Matrix](_.name.length  3)(--(CODED_BY) -- (KNOWS)
--).map(_.name).foldLeft()(_ + _)


The Output of the Github examples
herehttps://github.com/FaKod/neo4j-scala/blob/ScalaTraverserHack/examples/eu/fakod/examples/TheMatrixTraversalHack.scalais:
Relations CODED_BY and KNOWS, sorted by name: List(Matrix(Agent
Smith,Program), Matrix(Cypher,Hacker), Matrix(Morpheus,Hacker), Matrix(The
Architect,Whatever), Matrix(Trinity,Hacker))

Relations KNOWS, length of all names: 32

Relations CODED_BY and KNOWS, all names appended:
TrinityMorpheusCypherAgent SmithThe Architect


This is really a hack. It should be possible to get rid most of the
relation parentheses and to run the traverser multithreaded automatically
for every node.

I hope this is helpful :-)

Christopher



On Fri, Nov 18, 2011 at 3:16 PM, Christopher Schmidt 
fakod...@googlemail.com wrote:

 Hi Andres,

 worries is the wrong term. I think a query language has its use case and
 its absolutely necessary for Neo4j. It maps common use cases to a powerful
 language.

 But using it programmatically is something different. Thats what I mean
 with abstraction (in the sense of software development). It is a different
 language, with a different semantic used in a compiled language (Java or
 Scala); and this is not a natural fit.

 Do I have something in mind: No - no concrete examples.
 But obviously the traverser api with return and stop evaluators is too
 generic (together with the lack of common result list operations, like
 sort, filter etc).

 In case of Scala it should be possible (using the powerful collection api)
 to create a DSL for complex queries and aggregation of results (that is
 able to support multi core processing as well, which is a important feature
 imho).

 I will try to invest some time. Maybe I can get to an example...



 On Thu, Nov 17, 2011 at 2:44 PM, Andres Taylor 
 andres.tay...@neotechnology.com wrote:

 On Thu, Nov 17, 2011 at 1:21 PM, Christopher Schmidt 
 fakod...@googlemail.com wrote:

  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.
 

 I understand your worries about runtime errors and type safety. I'd love
 to
 know what you mean by abstraction etc. Do you have any concrete examples
 in mind?

 Andrés
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




 --
 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] Neo4j-Scala Wrapper 0.1.0 released

2011-11-17 Thread Christopher Schmidt
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
 idfakod-releases/id
 urlhttps://raw.github.com/FaKod/fakod-mvn-repo/master/releases
  /url
   /repository
 /repositories
 
 dependencies
   dependency
 groupIdorg.neo4j/groupId
 artifactIdneo4j-scala/artifactId
 version0.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 @
  Githubhttps://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] Neo4j-Scala Wrapper 0.1.0 released

2011-11-15 Thread Christopher Schmidt
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
idfakod-releases/id
urlhttps://raw.github.com/FaKod/fakod-mvn-repo/master/releases
/url
  /repository
/repositories

dependencies
  dependency
groupIdorg.neo4j/groupId
artifactIdneo4j-scala/artifactId
version0.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 @
Githubhttps://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


Re: [Neo4j] Batch Inserter, Node Property error

2011-10-24 Thread Christopher Schmidt
Send a pull request (https://github.com/neo4j/community/pull/73)

On Mon, Oct 24, 2011 at 6:38 AM, Christopher Schmidt 
fakod...@googlemail.com wrote:

 Hi all,

 I am writing a Scala wrapper for the batch insertion interfaces. While
 doing so, I have the problem that properties are not written to DB.
 I wrote a little test case for Java, same error. The code below prints out:

 2 has property keys [2, 1]
 2 has property keys []

 Am I doing something wrong?

 Regards Christopher

 PS: Neo4j version 1.5-SNAPSHOT



 public class JavaMain {
 public static void main(String[] args) {

 String path = /tmp/temp-neo-batch-test;

 BatchInserter inserter = new BatchInserterImpl(path);
 BatchInserterIndexProvider provider = new
 LuceneBatchInserterIndexProvider(inserter);
 String name = users;
 BatchInserterIndex index = provider.nodeIndex(name,
 LuceneIndexImplementation.EXACT_CONFIG);

 GraphDatabaseService gds = inserter.getGraphDbService();

 Node myNode = gds.createNode();
 long id = myNode.getId();

 myNode.setProperty(1, one);
 myNode.setProperty(2, two);

 index.flush();
 System.out.println(myNode.getId() +  has property keys  +
 myNode.getPropertyKeys());

 provider.shutdown();
 inserter.shutdown();

 GraphDatabaseService db = new EmbeddedGraphDatabase(path);
 Node node1 = db.getNodeById(id);
 System.out.println(node1.getId() +  has property keys  +
 node1.getPropertyKeys());
 db.shutdown();
 }
 }

 --
 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] Batch Inserter, Node Property error

2011-10-23 Thread Christopher Schmidt
Hi all,

I am writing a Scala wrapper for the batch insertion interfaces. While doing
so, I have the problem that properties are not written to DB.
I wrote a little test case for Java, same error. The code below prints out:

2 has property keys [2, 1]
2 has property keys []

Am I doing something wrong?

Regards Christopher

PS: Neo4j version 1.5-SNAPSHOT



public class JavaMain {
public static void main(String[] args) {

String path = /tmp/temp-neo-batch-test;

BatchInserter inserter = new BatchInserterImpl(path);
BatchInserterIndexProvider provider = new
LuceneBatchInserterIndexProvider(inserter);
String name = users;
BatchInserterIndex index = provider.nodeIndex(name,
LuceneIndexImplementation.EXACT_CONFIG);

GraphDatabaseService gds = inserter.getGraphDbService();

Node myNode = gds.createNode();
long id = myNode.getId();

myNode.setProperty(1, one);
myNode.setProperty(2, two);

index.flush();
System.out.println(myNode.getId() +  has property keys  +
myNode.getPropertyKeys());

provider.shutdown();
inserter.shutdown();

GraphDatabaseService db = new EmbeddedGraphDatabase(path);
Node node1 = db.getNodeById(id);
System.out.println(node1.getId() +  has property keys  +
node1.getPropertyKeys());
db.shutdown();
}
}

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


Re: [Neo4j] neo4j-scala improvements

2011-09-27 Thread Christopher Schmidt
Hi Peter,
I updated both pom.xml to use Neo4j 1.5-SNAPSHOT

Let me know if I can help.

Christopher

On Tue, Sep 27, 2011 at 2:11 PM, Peter Neubauer 
peter.neuba...@neotechnology.com wrote:

 Building it right now ...

 Maybe we can set it up against Neo4j 1.5-SNAPSHOT and put it on our
 build server to start with?

 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://startupbootcamp.org/- Öresund - Innovation happens HERE.
 http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



 On Wed, Sep 21, 2011 at 4:29 PM, Christopher Schmidt
 fakod...@googlemail.com wrote:
  Hi all
 
  I did...
  - Split it up to Neo4j Scala, which is mainly the old available
 neo4j-scala
  version. A little refactored and enhanced with Case Class to Node
  properties marshaling and some Traits for graph service provider
 handling
  (- https://github.com/FaKod/neo4j-scala)
  - Neo4j Spatial Scala with some spatial convenience methods (-
  https://github.com/FaKod/neo4j-spatial-scala)
  - I updated both READMEs to reflect the current state
  - lowered both version numbers to 0.1.0-SNAPSHOT (the old where 0.9.9...
 too
  high I think)
  - Updated Scala to 2.9.1 and Neo4j to the last available Neo4j Spatial
  compatible version (1.4.1)
  - started to add some more Specs2 test cases (still far away from enough)
 
  Should be a good starting point for playing, testing and discussing
 various
  design and DSL decisions :-)
 
  Cheers Christopher
 
  On Mon, Sep 12, 2011 at 9:17 PM, Peter Neubauer 
  peter.neuba...@neotechnology.com wrote:
 
  Awesome Christopher,
  let us know when things are stabilizing, so we can start to put the
  scala bindings onto the build server and run regular tests against
  Neo4j master!
 
  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://startupbootcamp.org/- Öresund - Innovation happens HERE.
  http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
 
 
 
  On Mon, Sep 12, 2011 at 9:03 PM, Christopher Schmidt
  fakod...@googlemail.com wrote:
   OK. I will
   - use my forked neo4j-scala repository for the Neo4j part
   - push the spatial part into my neo4j-spatial-scala repository which
 will
   have a dependancy to neo4j-scala.
  
   On Mon, Sep 12, 2011 at 9:58 AM, Anders Nawroth 
  and...@neotechnology.comwrote:
  
   Hi!
  
   So far Neo4j and Neo4j Spatial don't share the same release cycle, so
 it
   makes sense to split the scala wrapper in two projects.
  
   /anders
  
   On 09/12/2011 06:14 AM, Christopher Schmidt wrote:
Yes - thats possible. I think to have a repo would ease the usage
 of
neo4j-scala.
The next days (hope there is enough time) I will clean up and
 document
   the
sources so that they are easier to understand.
Next would be to update to the current versions of Neo4j, Neo4j
  Spatial
   and
Scala.
   
Actual, neo4j-scala includes the spatial wrapper as well, do you
 think
  it
is necessary to split it into two projects (neo4j-scala and
neo4j-spatial-scala)?
   
On Fri, Sep 9, 2011 at 3:21 PM, Peter Neubauer
peter.neuba...@neotechnology.com  wrote:
   
Very cool Christopher!
   
We are testing to pull in some of the bindings for Neo4j into the
manual - would it be possible, when things stabilize, to pull in
 the
Scala bindings to the Neo4j repo. build them and start documenting
some test cases so we can put them into there, too?
   
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://startupbootcamp.org/- Öresund - Innovation happens
 HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing
  party.
   
   
   
On Fri, Sep 9, 2011 at 8:10 AM, Christopher Schmidt
fakod...@googlemail.com  wrote:
Neo4j Scala (https://github.com/FaKod/neo4j-scala) has got some
improvements
- Scala (non nested) Case Class de- serialization to or from a
 Neo4j
   Node
(see example)
- index convenience methods (see example)
- create and get Relation Objects, like val relation = start --
   foo
--
end;
   
It's still alpha, but worth to look at :-)
   
case class Test(s: String, i: Int, ji: java.lang.Integer, d:
 Double,
  l:
Long, b: Boolean)
   
object

Re: [Neo4j] neo4j-scala improvements

2011-09-21 Thread Christopher Schmidt
Hi all

I did...
- Split it up to Neo4j Scala, which is mainly the old available neo4j-scala
version. A little refactored and enhanced with Case Class to Node
properties marshaling and some Traits for graph service provider handling
(- https://github.com/FaKod/neo4j-scala)
- Neo4j Spatial Scala with some spatial convenience methods (-
https://github.com/FaKod/neo4j-spatial-scala)
- I updated both READMEs to reflect the current state
- lowered both version numbers to 0.1.0-SNAPSHOT (the old where 0.9.9... too
high I think)
- Updated Scala to 2.9.1 and Neo4j to the last available Neo4j Spatial
compatible version (1.4.1)
- started to add some more Specs2 test cases (still far away from enough)

Should be a good starting point for playing, testing and discussing various
design and DSL decisions :-)

Cheers Christopher

On Mon, Sep 12, 2011 at 9:17 PM, Peter Neubauer 
peter.neuba...@neotechnology.com wrote:

 Awesome Christopher,
 let us know when things are stabilizing, so we can start to put the
 scala bindings onto the build server and run regular tests against
 Neo4j master!

 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://startupbootcamp.org/- Öresund - Innovation happens HERE.
 http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



 On Mon, Sep 12, 2011 at 9:03 PM, Christopher Schmidt
 fakod...@googlemail.com wrote:
  OK. I will
  - use my forked neo4j-scala repository for the Neo4j part
  - push the spatial part into my neo4j-spatial-scala repository which will
  have a dependancy to neo4j-scala.
 
  On Mon, Sep 12, 2011 at 9:58 AM, Anders Nawroth 
 and...@neotechnology.comwrote:
 
  Hi!
 
  So far Neo4j and Neo4j Spatial don't share the same release cycle, so it
  makes sense to split the scala wrapper in two projects.
 
  /anders
 
  On 09/12/2011 06:14 AM, Christopher Schmidt wrote:
   Yes - thats possible. I think to have a repo would ease the usage of
   neo4j-scala.
   The next days (hope there is enough time) I will clean up and document
  the
   sources so that they are easier to understand.
   Next would be to update to the current versions of Neo4j, Neo4j
 Spatial
  and
   Scala.
  
   Actual, neo4j-scala includes the spatial wrapper as well, do you think
 it
   is necessary to split it into two projects (neo4j-scala and
   neo4j-spatial-scala)?
  
   On Fri, Sep 9, 2011 at 3:21 PM, Peter Neubauer
   peter.neuba...@neotechnology.com  wrote:
  
   Very cool Christopher!
  
   We are testing to pull in some of the bindings for Neo4j into the
   manual - would it be possible, when things stabilize, to pull in the
   Scala bindings to the Neo4j repo. build them and start documenting
   some test cases so we can put them into there, too?
  
   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://startupbootcamp.org/- Öresund - Innovation happens HERE.
   http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing
 party.
  
  
  
   On Fri, Sep 9, 2011 at 8:10 AM, Christopher Schmidt
   fakod...@googlemail.com  wrote:
   Neo4j Scala (https://github.com/FaKod/neo4j-scala) has got some
   improvements
   - Scala (non nested) Case Class de- serialization to or from a Neo4j
  Node
   (see example)
   - index convenience methods (see example)
   - create and get Relation Objects, like val relation = start --
  foo
   --
   end;
  
   It's still alpha, but worth to look at :-)
  
   case class Test(s: String, i: Int, ji: java.lang.Integer, d: Double,
 l:
   Long, b: Boolean)
  
   object DeSerializingSpec extends Specification with Neo4jWrapper
 with
   EmbeddedGraphDatabaseServiceProvider {
  
 def neo4jStoreDir = /tmp/temp-neo-test
  
 Node should {
   be serializable in {
 var o = Test(This is a String, 1, 2, 3.3, 10, true)
 var node: Node = null
 withTx {
   implicit neo =
 node = createNode(o)
 }
  
 var oo = deSerialize[Test](node)
 oo must beEqual(o)
   }
 }
   }
  
  
   object IndexTestSpec extends Specification with Neo4jWrapper with
   EmbeddedGraphDatabaseServiceProvider with Neo4jIndexProvider {
  
 def neo4jStoreDir = /tmp/temp-neo-index-test
  
 override def NodeIndexConfig = (MyTestIndex, Map(provider -
   lucene,
   type -  fulltext)) :: Nil
  
  
 Neo4jIndexProvider should {
   use the fulltext search index in {
  
 val nodeIndex = getNodeIndex(MyTestIndex).get
  
 withSpatialTx {
   implicit db =
  
   val theMatrix

Re: [Neo4j] neo4j-scala improvements

2011-09-12 Thread Christopher Schmidt
OK. I will
- use my forked neo4j-scala repository for the Neo4j part
- push the spatial part into my neo4j-spatial-scala repository which will
have a dependancy to neo4j-scala.

On Mon, Sep 12, 2011 at 9:58 AM, Anders Nawroth and...@neotechnology.comwrote:

 Hi!

 So far Neo4j and Neo4j Spatial don't share the same release cycle, so it
 makes sense to split the scala wrapper in two projects.

 /anders

 On 09/12/2011 06:14 AM, Christopher Schmidt wrote:
  Yes - thats possible. I think to have a repo would ease the usage of
  neo4j-scala.
  The next days (hope there is enough time) I will clean up and document
 the
  sources so that they are easier to understand.
  Next would be to update to the current versions of Neo4j, Neo4j Spatial
 and
  Scala.
 
  Actual, neo4j-scala includes the spatial wrapper as well, do you think it
  is necessary to split it into two projects (neo4j-scala and
  neo4j-spatial-scala)?
 
  On Fri, Sep 9, 2011 at 3:21 PM, Peter Neubauer
  peter.neuba...@neotechnology.com  wrote:
 
  Very cool Christopher!
 
  We are testing to pull in some of the bindings for Neo4j into the
  manual - would it be possible, when things stabilize, to pull in the
  Scala bindings to the Neo4j repo. build them and start documenting
  some test cases so we can put them into there, too?
 
  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://startupbootcamp.org/- Öresund - Innovation happens HERE.
  http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
 
 
 
  On Fri, Sep 9, 2011 at 8:10 AM, Christopher Schmidt
  fakod...@googlemail.com  wrote:
  Neo4j Scala (https://github.com/FaKod/neo4j-scala) has got some
  improvements
  - Scala (non nested) Case Class de- serialization to or from a Neo4j
 Node
  (see example)
  - index convenience methods (see example)
  - create and get Relation Objects, like val relation = start --  foo
  --
  end;
 
  It's still alpha, but worth to look at :-)
 
  case class Test(s: String, i: Int, ji: java.lang.Integer, d: Double, l:
  Long, b: Boolean)
 
  object DeSerializingSpec extends Specification with Neo4jWrapper with
  EmbeddedGraphDatabaseServiceProvider {
 
def neo4jStoreDir = /tmp/temp-neo-test
 
Node should {
  be serializable in {
var o = Test(This is a String, 1, 2, 3.3, 10, true)
var node: Node = null
withTx {
  implicit neo =
node = createNode(o)
}
 
var oo = deSerialize[Test](node)
oo must beEqual(o)
  }
}
  }
 
 
  object IndexTestSpec extends Specification with Neo4jWrapper with
  EmbeddedGraphDatabaseServiceProvider with Neo4jIndexProvider {
 
def neo4jStoreDir = /tmp/temp-neo-index-test
 
override def NodeIndexConfig = (MyTestIndex, Map(provider -
  lucene,
  type -  fulltext)) :: Nil
 
 
Neo4jIndexProvider should {
  use the fulltext search index in {
 
val nodeIndex = getNodeIndex(MyTestIndex).get
 
withSpatialTx {
  implicit db =
 
  val theMatrix = createNode
  val theMatrixReloaded = createNode
 
  // add to index
  nodeIndex += (theMatrix, title, The Matrix)
  nodeIndex += (theMatrixReloaded, title, The Matrix
 Reloaded)
 
  val found = nodeIndex.query(title, reloAdEd)
  found.size must beGreaterThanOrEqualTo(1)
 
  // remove from index
  nodeIndex -= theMatrix
  nodeIndex -= theMatrixReloaded
}
  }
}
  }
 
  --
  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




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


Re: [Neo4j] neo4j-scala improvements

2011-09-11 Thread Christopher Schmidt
Yes - thats possible. I think to have a repo would ease the usage of
neo4j-scala.
The next days (hope there is enough time) I will clean up and document the
sources so that they are easier to understand.
Next would be to update to the current versions of Neo4j, Neo4j Spatial and
Scala.

Actual, neo4j-scala includes the spatial wrapper as well, do you think it
is necessary to split it into two projects (neo4j-scala and
neo4j-spatial-scala)?

On Fri, Sep 9, 2011 at 3:21 PM, Peter Neubauer 
peter.neuba...@neotechnology.com wrote:

 Very cool Christopher!

 We are testing to pull in some of the bindings for Neo4j into the
 manual - would it be possible, when things stabilize, to pull in the
 Scala bindings to the Neo4j repo. build them and start documenting
 some test cases so we can put them into there, too?

 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://startupbootcamp.org/- Öresund - Innovation happens HERE.
 http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



 On Fri, Sep 9, 2011 at 8:10 AM, Christopher Schmidt
 fakod...@googlemail.com wrote:
  Neo4j Scala (https://github.com/FaKod/neo4j-scala) has got some
 improvements
  - Scala (non nested) Case Class de- serialization to or from a Neo4j Node
  (see example)
  - index convenience methods (see example)
  - create and get Relation Objects, like val relation = start -- foo
 --
  end ;
 
  It's still alpha, but worth to look at :-)
 
  case class Test(s: String, i: Int, ji: java.lang.Integer, d: Double, l:
  Long, b: Boolean)
 
  object DeSerializingSpec extends Specification with Neo4jWrapper with
  EmbeddedGraphDatabaseServiceProvider {
 
   def neo4jStoreDir = /tmp/temp-neo-test
 
   Node should {
 be serializable in {
   var o = Test(This is a String, 1, 2, 3.3, 10, true)
   var node: Node = null
   withTx {
 implicit neo =
   node = createNode(o)
   }
 
   var oo = deSerialize[Test](node)
   oo must beEqual(o)
 }
   }
  }
 
 
  object IndexTestSpec extends Specification with Neo4jWrapper with
  EmbeddedGraphDatabaseServiceProvider with Neo4jIndexProvider {
 
   def neo4jStoreDir = /tmp/temp-neo-index-test
 
   override def NodeIndexConfig = (MyTestIndex, Map(provider -
 lucene,
  type - fulltext)) :: Nil
 
 
   Neo4jIndexProvider should {
 use the fulltext search index in {
 
   val nodeIndex = getNodeIndex(MyTestIndex).get
 
   withSpatialTx {
 implicit db =
 
 val theMatrix = createNode
 val theMatrixReloaded = createNode
 
 // add to index
 nodeIndex += (theMatrix, title, The Matrix)
 nodeIndex += (theMatrixReloaded, title, The Matrix Reloaded)
 
 val found = nodeIndex.query(title, reloAdEd)
 found.size must beGreaterThanOrEqualTo(1)
 
 // remove from index
 nodeIndex -= theMatrix
 nodeIndex -= theMatrixReloaded
   }
 }
   }
  }
 
  --
  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] Java PaaS with Neo4j (slightly off topic)

2011-09-08 Thread Christopher Schmidt
Hi all,

I am using (the embedded version of) Neo4j together with a webapplication
(WAR file for Tomcat).
Does anyone know a PaaS provider (like CloudBees) that allow a local file
storage?

(This would be a simple solution beside implementing the Neo4j Server
REST interface and f.e. using a Neo4j Heroku Addon)

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


[Neo4j] Neo4j Spatial and gtype property

2011-07-27 Thread Christopher Schmidt
Hi all,

is it allowed to use the gtype-property to get the geometry type numbers?

(Which are defined in org.neo4j.gis.spatial.Constants)

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


Re: [Neo4j] Neo4j Spatial and gtype property

2011-07-27 Thread Christopher Schmidt
So best is to use SpatialDatabaseRecord.getGeometry()?

Christopher

On Wed, Jul 27, 2011 at 10:50 PM, Craig Taverner cr...@amanzi.com wrote:

 Actually we do allow multiple geometry types in the same layer, but some
 actions, like export to shapely, will fail. We even test for this in
 TestDynamicLayers.

 You can use the gtype if you want, but it is specific to some
 GeometryEncoders, and might change in future releases. It would be better
 to
 get the layers geometry encoder and use that.
 On Jul 27, 2011 6:04 PM, Peter Neubauer 
 peter.neuba...@neotechnology.com
 wrote:
  Christopher,
  What do you mean by allowing to use? Yes, these properties are used to
  store the Geometry Type for a Layer and for geometry nodes. Sadly, you
  cannot have more than one Geometry in Layers due to the limitations of
  e.g. the GeoTools stack.
 
  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://startupbootcamp.org/- Öresund - Innovation happens HERE.
  http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
 
 
 
  On Wed, Jul 27, 2011 at 4:07 AM, Christopher Schmidt
  fakod...@googlemail.com wrote:
  Hi all,
 
  is it allowed to use the gtype-property to get the geometry type
 numbers?
 
  (Which are defined in org.neo4j.gis.spatial.Constants)
 
  --
  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




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


[Neo4j] neo4j-spatial roadmap/stability

2011-06-23 Thread Christopher Schmidt
Hi Neo4j...

I am working for the largest German speaking travel and holiday portal.
Currently we are using a relatively simple MySQL based spatial distance
functionality. We plan to enhance this by something which is capable of a
flexible set of spatial queries. We will evaluate Neo4j-Spatial for that and
benchmark it against PostGIS/PostGreSQL.

I found some Roadmap descriptions in the Neo4j Wiki (
http://wiki.neo4j.org/content/Neo4j_Spatial_Project_Plan), but I am not sure
that these are still valid. Craig said (somewhere) that Neo4j Spatial is
still alpha (I hope that this means that only the interfaces are still
unstable). And I know that neo4j-spatial is an open source project where
there is no Neo Technology responsibility.

Can you drop a few words about the Spatial roadmap, its stability and
planned licensing (all based on using it on a high volume web site)?

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


[Neo4j] Lake Constance Hackathon (South of Germany)

2011-06-09 Thread Christopher Schmidt
Hi all,

we will do a Hackathon in Friedrichshafen and we have some ideas for Neo4j
projects as well (see
http://lcgtug.mixxt.de/networks/wiki/index.graphdb_project_proposals).

So who ever is located at Lake Constance in Germany and is interested in
Neo4j (-Spatial) is invited to attend :-)

More Infos are here: http://lcgtug.mixxt.de/

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


Re: [Neo4j] free slides for Neo4j Introduction

2011-04-28 Thread Christopher Schmidt
Thx Jim, it's good to see that there is a free tutorial available. Hopefully
the next step we'll take...

Christopher

On Thu, Apr 28, 2011 at 12:48 AM, Jim Webber j...@neotechnology.com wrote:

 Hi Chris,

 The Neo4j tutorial that Ian Robinson and I are working on has a
 (PowerPoint) slide deck associated with it.

 See: https://github.com/jimwebber/neo4j-tutorial

 Jim

 ___
 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] Neo4j/Spatial and Scala

2011-04-19 Thread Christopher Schmidt
Hi all,

I am evaluating the advantages of using Neo4j and its spatial extension. For
testing I have extended (forked) the neo4j-scala with some spatial
convenience methods. So that something written in Java like:

SpatialDatabaseService db = new SpatialDatabaseService( graphDb() );
EditableLayer layer = (EditableLayer) db.getOrCreateEditableLayer( test );
SpatialDatabaseRecord record = layer.add(
layer.getGeometryFactory().createPoint(new Coordinate( 15.3, 56.2 ) ) );

Will be converted to:

class Neo4jTest extends Neo4jSpatialWrapper with
EmbeddedGraphDatabaseServiceProvider with SpatialDatabaseServiceProvider {
  def neo4jStoreDir = NEO4J_STORE_DIR

  withLayer(getOrCreateEditableLayer(test)) {
implicit layer =
val myRecord = add newPoint ((15.3, 56.2))
  }
}

Please refer the github (https://github.com/FaKod/neo4j-scala) Readme or the
test cases for more examples .

Since we will try (if we have enough time) to extend Neo4j Scala, I would
love to get some comments from some of the Scala enthusiasts in this list
(hope there are any ;-). Now or later, here or to my email adress.
What do you think? Does it help? Is it OK how we use the Traits or
the implicits? How should we do POPO to Node serialization? With annotations
like those in jo4neo?

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


[Neo4j] 1.3.M03 version conflict?

2011-03-15 Thread Christopher Schmidt
Hi,

I am playing with Neo4j Spatial and Neo4j for Scala with the following
versions (using Maven):

scala.version2.8.1/scala.version
neo4j.version1.3.M03/neo4j.version
neo4j.shell.version1.1/neo4j.shell.version
neo4j.spatial.version0.5-SNAPSHOT/neo4j.spatial.version

Running the tests I get the following exception

Caused by: java.lang.NoSuchMethodError:
org.neo4j.kernel.impl.transaction.xaframework.XaContainer.create(Ljava/lang/String;Lorg/neo4j/kernel/impl/transaction/xaframework/XaCommandFactory;Lorg/neo4j/kernel/impl/transaction/xaframework/XaTransactionFactory;Ljava/util/Map;)Lorg/neo4j/kernel/impl/transaction/xaframework/XaContainer;
at org.neo4j.index.lucene.LuceneDataSource.init(LuceneDataSource.java:126)


The pom I am using is here:
https://github.com/FaKod/neo4j-scala/blob/master/pom.xml


Seems to be a version conflict. Is it my fault?

Thanks

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


Re: [Neo4j] 1.3.M03 version conflict?

2011-03-15 Thread Christopher Schmidt
Yes - I overlooked that there is a shell version 1.3.M03.

Thanks :-)

On Tue, Mar 15, 2011 at 6:45 PM, Anders Nawroth and...@neotechnology.comwrote:

 Hi!

 It's the shell version, it should be 1.3.M03.

 /anders

 2011-03-15 18:13, Christopher Schmidt skrev:
  Hi,
 
  I am playing with Neo4j Spatial and Neo4j for Scala with the following
  versions (using Maven):
 
   scala.version2.8.1/scala.version
   neo4j.version1.3.M03/neo4j.version
   neo4j.shell.version1.1/neo4j.shell.version
   neo4j.spatial.version0.5-SNAPSHOT/neo4j.spatial.version
 
  Running the tests I get the following exception
 
  Caused by: java.lang.NoSuchMethodError:
 
 org.neo4j.kernel.impl.transaction.xaframework.XaContainer.create(Ljava/lang/String;Lorg/neo4j/kernel/impl/transaction/xaframework/XaCommandFactory;Lorg/neo4j/kernel/impl/transaction/xaframework/XaTransactionFactory;Ljava/util/Map;)Lorg/neo4j/kernel/impl/transaction/xaframework/XaContainer;
  at
 org.neo4j.index.lucene.LuceneDataSource.init(LuceneDataSource.java:126)
 
 
  The pom I am using is here:
  https://github.com/FaKod/neo4j-scala/blob/master/pom.xml
 
 
  Seems to be a version conflict. Is it my fault?
 
  Thanks
 
 ___
 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


Re: [Neo4j] Neo4j REST API and JAXB

2011-01-02 Thread Christopher Schmidt
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
  herehttp://wiki.fasterxml.com/JacksonDataBinding).
  Means that the parameter is of type Any
 
  case class GetRoot( . . . @BeanProperty var extensions:Any) {
   . . .
  }
 
  Jackson fills it with a LinkedHashMapString,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

Re: [Neo4j] Neo4j REST API and JAXB

2011-01-01 Thread Christopher Schmidt
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
herehttps://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:/node/3;,
nodes : [ http://localhost:/node/3;, 
  http://localhost:/node/1;
   ],
length : 1,
relationships : [ http://localhost:/relationship/6; ],
end : http://localhost:/node/1;
   }, {
start : http://localhost:/node/3;,
nodes : [ http://localhost:/node/3;, 
  http://localhost:/node/2;
   ],
length : 1,
relationships : [ http://localhost:/relationship/2; ],
end : http://localhost:/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


Re: [Neo4j] Neo4j REST API and JAXB

2011-01-01 Thread Christopher Schmidt
Same as GET http://localhost:7474/db/data/ where I can not predict the
extensions parameter. I used the simple data binding (see
herehttp://wiki.fasterxml.com/JacksonDataBinding).
Means that the parameter is of type Any

case class GetRoot( . . . @BeanProperty var extensions:Any) {
  . . .
}

Jackson fills it with a LinkedHashMapString,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

Re: [Neo4j] Neo4j REST API and JAXB

2010-12-30 Thread Christopher Schmidt
Hi Jim, all I can say is, that I was not able to unmarshal the anonymous
array containing a anonymous object returned from a POST to traverse/path.
All I got was a ArrayOutOfBounds exception (I used the
maven jersey-json dependency). Maybe just an issue with the combination of
Jersey and JAXB.

Normally this code should work:

GenericTypeCollectionTraverse genericType = new
GenericTypeCollectionTraverse() {};

CollectionTraverse ja = webResource.path(node/3/traverse/path)
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.post(genericType, {\order\:\depth first\, \max
depth\: 1});

for this JAXB Entity:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
public class Traverse {
public String start;
. . .
}

And I did not get any answer from the Jersey users list.
Java.net is currently down once again :-( so I can not post the link to my
question.

Christopher


On Thu, Dec 30, 2010 at 5:15 PM, Jim Webber j...@neotechnology.com wrote:

 Hi Christoper, Peter,

 I wonder if this is some horrid coupling creeping in since AFAIK we also
 use Jackson for JSON production. Perhaps its own eccentricities are escaping
 our service boundary.

 Anyone know if Jackson is/isn't very compliant?

 Jim

 On 29 Dec 2010, at 23:41, Peter Neubauer wrote:

  Very cool Christopher,
  Tis looks like a perfect way to test the server. As we are considering
  using more scale in at least our testing, we really should look into
  this for easing web testing to start with! I guess Andres and Andreas
  will be all over this after New Year :)
 
  /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:/node/3;,
   nodes : [ http://localhost:/node/3;, 
  http://localhost:/node/1;
  ],
   length : 1,
   relationships : [ http://localhost:/relationship/6; ],
   end : http://localhost:/node/1;
  }, {
   start : http

Re: [Neo4j] Neo4j REST API and JAXB

2010-12-29 Thread Christopher Schmidt
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
herehttp://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:/node/3;,
   nodes : [ http://localhost:/node/3;, 
 http://localhost:/node/1;
  ],
   length : 1,
   relationships : [ http://localhost:/relationship/6; ],
   end : http://localhost:/node/1;
  }, {
   start : http://localhost:/node/3;,
   nodes : [ http://localhost:/node/3;, 
 http://localhost:/node/2;
  ],
   length : 1,
   relationships : [ http://localhost:/relationship/2; ],
   end : http://localhost:/node/2;
  } ]
 
  Does anyone know how to define the JAXB objects?
 
  --
  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




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


Re: [Neo4j] Transaction and REST API

2010-12-20 Thread Christopher Schmidt
I written a couple of REST services and clients over the past years and it
is always a subject of discussions: How to map transactions with a stateless
RESTful service?

We always did it like Neo4j, every REST call is a implicit transaction. If
this is not sufficient we implemented BULK or combined calls for bulk
deletions or creations etc. But the question is: Is it really impossible to
implement transactions?

We can use
- the session context with invalidating a session or timeout is a rollback
(this will be expensive...)
- or POSTing a new transaction returning a Trx ID, subsequent write or
update operations are containing a transaction ID
- using custom HTTP header
- (whatever)

All this violates the stateless paradigm. But the reality of the Web is: we
do have HTTP sessions, cookies, baskets etc. And scalability is a question
of server implementation, isn't it?

What do you think?

On Mon, Dec 20, 2010 at 12:28 PM, Jim Webber j...@neotechnology.com wrote:

 Hi Ido,

 Those make good sense. And I think I have some reasonable RESTful
 approaches in mind for tackling them which don't need transactions (using
 Ian Robinson's typed links to forms approach here).

 1. Bulk create of nodes and relations:
  - PUT a set of nodes and relations to the server, relative to some node,
 or to the graph itself.

  - Work needed: define a graph format (e.g. using JSON) to describe nodes
 and relations.

 2. Remove relations:
  - GET a removal form (optional, will be cacheable for a long time
 anyway)
  - Populate the removal form with the nodes to be deleted, POST it to the
 server
  - Server responds with the URI of a (transient) resource that represents
 all the nodes and relations you previously specified.
  - DELETE the transient resource

  - Work needed: design a removal form (effectively a deletion manifest),
 a little processing logic on the server side

 3. Clone subgraphs
  - Use a form to select a start node, terminating condition (e.g. depth),
 POST its URI to the cloning URI with a traversal description (or just
 something as simple as a termination condition for a df/bf search) which
 itself is created by filling in a form.

  - Work needed: a clone algorithm for the server; form that allows us to
 describe the graph for the clone; URI to POST back the form to the graph.



 OK, so there's some substantial work to be done here. But there's a
 positive point to take away from this. In the latest milestone release we
 have a Plugin mechanism where end users are able to extend the behaviour of
 graphs/nodes in order to implement all these kinds of domain specific
 things.

 Right now as we're testing the new Plugin stuff, I'm going to implement a
 simple clone subgraph plugin. I'll post the code and the wire-level HTTP
 here when I'm done so you can see how you might implement similar stuff for
 your domain (the code will also be in SVN under examples/server-extension).

 Jim

 PS - It occurs to me though, that if 3rd party plugins become very popular,
 we could over time bring them into core and take some responsibility for
 them. Perhaps.

 ___
 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


Re: [Neo4j] Neo4j REST API and JAXB

2010-12-09 Thread Christopher Schmidt
Thx Jim, I updated to V1.2.M05


I had to change port and base URI. Is this
http://components.neo4j.org/neo4j-rest is still valid?

Christopher

PS: Bought your REST book yesterday ;-) Nice to have you here.

On Thu, Dec 9, 2010 at 5:21 AM, Jim Webber j...@neotechnology.com wrote:

 Hi Christopher,

 Although I can't immediately give you a solution to your JAXB question, I
 can give you another minor problem :-)

 The REST api is now merged with the Neo4j server and all current and future
 work is happening on the server component. It shouldn't involve any code
 changes for you, but can you switch to server to host your DB just so I know
 you're on the latest version?

 Jim

 PS - There might be a config change needed, the default port changed to
 7474 compared to the old, deprecated REST api.
 ___
 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] Neo4j REST API and JAXB

2010-12-08 Thread Christopher Schmidt
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:/node/3;,
  nodes : [ http://localhost:/node/3;, http://localhost:/node/1;
],
  length : 1,
  relationships : [ http://localhost:/relationship/6; ],
  end : http://localhost:/node/1;
}, {
  start : http://localhost:/node/3;,
  nodes : [ http://localhost:/node/3;, http://localhost:/node/2;
],
  length : 1,
  relationships : [ http://localhost:/relationship/2; ],
  end : http://localhost:/node/2;
} ]

Does anyone know how to define the JAXB objects?

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


Re: [Neo4j] Neo4j REST API and JAXB

2010-12-08 Thread Christopher Schmidt
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:/node/3;,
   nodes : [ http://localhost:/node/3;, 
 http://localhost:/node/1;
  ],
   length : 1,
   relationships : [ http://localhost:/relationship/6; ],
   end : http://localhost:/node/1;
  }, {
   start : http://localhost:/node/3;,
   nodes : [ http://localhost:/node/3;, 
 http://localhost:/node/2;
  ],
   length : 1,
   relationships : [ http://localhost:/relationship/2; ],
   end : http://localhost:/node/2;
  } ]
 
  Does anyone know how to define the JAXB objects?
 
  --
  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


Re: [Neo4j] Neo4j REST API and JAXB

2010-12-08 Thread Christopher Schmidt
Hi Ivan, there is only one JAXB object here:
https://github.com/ept/neo4j-scala-template/blob/master/src/main/scala/com/example/models/Moo.scala

But thanks anyway :-)

BTW: For this Rest GET index call:

rest {
implicit s =
val index = /index.GET[GetIndex]
  }

the following JAXB objects do work fine:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
class GetIndex {
  var node:Array[Node] = _
}

@XmlAccessorType(XmlAccessType.FIELD)
class Node {
  var template:String = _
  var `type`:String = _
}

The returned JSON object to unmarshal is:

{
  node : [ {
template : http://localhost:/index/node/{key}/{value};,
type : lookup
  } ]
}

On Wed, Dec 8, 2010 at 4:08 PM, ivan Brusic i...@brusic.com wrote:

 I have not tried it, but the scala-template project uses JAXB:
 https://github.com/ept/neo4j-scala-template

 The project contains a few working examples of Scala + JAXB.  Perhaps it
 will provide some further insights.

 --
 Ivan

 On Wed, Dec 8, 2010 at 9:52 AM, 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:/node/3;,
   nodes : [ http://localhost:/node/3;, 
 http://localhost:/node/1
  
  ],
   length : 1,
   relationships : [ http://localhost:/relationship/6; ],
   end : http://localhost:/node/1;
  }, {
   start : http://localhost:/node/3;,
   nodes : [ http://localhost:/node/3;, 
 http://localhost:/node/2
  
  ],
   length : 1,
   relationships : [ http://localhost:/relationship/2; ],
   end : http://localhost:/node/2;
  } ]
 
  Does anyone know how to define the JAXB objects?
 
  --
  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


Re: [Neo4j] [SPAM] Re: REST Server API

2010-11-19 Thread Christopher Schmidt
Yes - URIs are opaque. But f.e. the Jersey Client API explicitly supports
adding query parameters to a WebResource object. So I think it would be a
good idea to support that. For me a URI (in a sense of a path) should define
a resource and should not be dependent of an internal state (what it's the
case if we append query parameter to an URI). Nevertheless I know that query
parameter do belong to an URI, so it's more a personal thing.

I have nothing against JSON. It's a really simple, non type safe way to
handle objects, but simplicity can be an advantage. It is fast and I can use
it with Jersey and with JavaScript very easy, all what I need is already
there.

I am very curios about how it will feel to get a complete graph from the
Neo4j Rest server using a sequence of REST calls with jQuery/native
JavaScript (the little project I am doing in my spare time)

Christopher

On Thu, Nov 18, 2010 at 3:42 PM, Rick Bullotta 
rick.bullo...@burningskysoftware.com wrote:

 There is nothing fundamentally wrong with JSON (o.k. maybe a *few* things),
 but with the right structures, it or any format can be completely
 self-describing. I have found that including a bit of additional metadata
 in
 the content helps IMMENSELY for both loosely-coupled and tightly-coupled
 applications.  The more it self-describes the content, the better.

 Jim, now that you're on the Neo team, I would like to show you the
 (domain-specific) REST API we've put around Neo for our application
 sometime.  Might stimulate some thoughts on your work and provide us some
 valuable feedback as well.

 We were planning to do a demo for Peter  team sometime next week, so LMK
 if
 you're interested and your availability off-list.

 Cheers,

 Rick

 -Original Message-
 From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org]
 On
 Behalf Of Jim Webber
 Sent: Thursday, November 18, 2010 9:04 AM
 To: Neo4j user discussions
 Subject: [SPAM] Re: [Neo4j] REST Server API

 Hi Christopher,

  Yes I know what you mean, the {} are part of the JAX-RS specification.

 They're part of the URI template specification. JAX-RS uses these URI
 templates.

  The Neo4j Rest server uses HTTP and JSON thats true, but it violates IMHO
  some of the REST principles. I think that a technical interface should
  contain, if the content is a link, a well formed URI. I know that a
 String
  like GET /node/123/relationships/{dir}/{-list||types} means that there
  are optional parameter or something like this. Thats OK for a description
 in
  a Wiki page but not in a returned JSON object.

 It's OK for both, but I agree that in general I prefer fully formed URIs.
 We'll need to tweak the response representations to include this.

  The String GET /node/123/relationships/out/KNOWSLOVES is used as a
  query parameter. If it is used as a parameter for a query it should be a
  URL-query parameter.

 Not necessarily. URIs are opaque, it's only because you're a smart human
 that you can infer something from a string like that, but a machine can't.

  Using POST /node/123/traverse/{returnType} I can traverse though the
  nodes, where returnType is the definition of the kind of objects I want
 to
  have returned. In the basic REST sense POST is a Insert method where a
 newly
  created ressource will be returned in the Location tag of a HTTP Header.
 For
  me this POST is a GET as well, maybe with some query parameter.

 Agree with you on that - a traversal is a query and so should be a GET.
 There was a thread on that a while back if I remember correctly. The API
 will change in future iterations, this would be one of the changes I'd
 favour.

  If you want to distinguish the returned Types, maybe it is a good idea to
  use custom mime types for node, path and relation, if you want to use the
  same URI for all.

 I don't like creating custom mime types, but at the same time I don't like
 JSON (because it's not a hypermedia format, it doesn't understand links).
 My
 preference would be to use Clojure data structures (once the Clojure guys
 have embedded the URI abstraction in the core), and create a standard media
 type based on Clojure - but I am a dreamer.

 In the meantime, I suspect we're stuck with this non-standard use of JSON.

 Jim

 PS - Bring on the controversial comments about the REST API, they're good
 possible requirements for us.
 PPS - I wrote a book about some of this REST stuff with Savas Parastatidis
 and Ian Robinson. See: http://restinpractice.com


  And to be clear, I like this interface very much :-)
 
  Christopher
 
  On Thu, Nov 18, 2010 at 9:53 AM, Jim Webber j...@neotechnology.com
 wrote:
 
  Hi Christopher,
 
  http://localhost:/node/1/relationships/in/{-list||types}
 
  This is a URI template, inviting you to replace the {...} with values of
  your own. In this case it's giving you the opportunity to provide a list
 of
  ampersand separated types.
 
  Now I believe this URI template syntax is out of date compared to the
  current 

[Neo4j] REST Server API

2010-11-18 Thread Christopher Schmidt
Hi all, I am checking out the Neo4j REST Server.

I put in the MATRIX examples and used curl -H Accept:application/json -H
Content-Type:application/json -X POST -d '{order:depth first}'
http://localhost:/node/3/traverse/node; to traverse the relations.

While doing that I have seen that the server returns something like

...
traverse : http://localhost:/node/1/traverse/{returnType};,
incoming_typed_relationships : 
http://localhost:/node/1/relationships/in/{-list||types}
...

I have some problems to understand the {} values. IMO these are kind of
usage hints, which should not be part of a technical interface.
Isn't it better to place a normal URI there? Or from where does that come
from?

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


Re: [Neo4j] REST Server API

2010-11-18 Thread Christopher Schmidt
Hi Jim,

Yes I know what you mean, the {} are part of the JAX-RS specification.

I hope that I am not too controversy :-)

The Neo4j Rest server uses HTTP and JSON thats true, but it violates IMHO
some of the REST principles. I think that a technical interface should
contain, if the content is a link, a well formed URI. I know that a String
like GET /node/123/relationships/{dir}/{-list||types} means that there
are optional parameter or something like this. Thats OK for a description in
a Wiki page but not in a returned JSON object.

The String GET /node/123/relationships/out/KNOWSLOVES is used as a
query parameter. If it is used as a parameter for a query it should be a
URL-query parameter.

Using POST /node/123/traverse/{returnType} I can traverse though the
nodes, where returnType is the definition of the kind of objects I want to
have returned. In the basic REST sense POST is a Insert method where a newly
created ressource will be returned in the Location tag of a HTTP Header. For
me this POST is a GET as well, maybe with some query parameter.

If you want to distinguish the returned Types, maybe it is a good idea to
use custom mime types for node, path and relation, if you want to use the
same URI for all.

And to be clear, I like this interface very much :-)

Christopher

On Thu, Nov 18, 2010 at 9:53 AM, Jim Webber j...@neotechnology.com wrote:

 Hi Christopher,

  http://localhost:/node/1/relationships/in/{-list||types}

 This is a URI template, inviting you to replace the {...} with values of
 your own. In this case it's giving you the opportunity to provide a list of
 ampersand separated types.

 Now I believe this URI template syntax is out of date compared to the
 current spec, but I'll have to validate that.

 Perhaps it's even worth thinking about designing this out of the REST API
 as we move forwards with Neo4j server. Hmmm

 Jim



 ___
 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


Re: [Neo4j] Spatial search using Lucene-spatial?

2010-11-13 Thread Christopher Schmidt
Hi,

I think Lucene provides a simple way to do distance queries.
The limit is, that you can use only points (and a circle to define a
distance). No interception with lines, polylines or stuff like that is
possible. If you do not need it - fine...

BTW:
There is currently a discussion about changing lucenes spatial
implementation. See
http://www.mail-archive.com/d...@lucene.apache.org/msg03593.html and
http://www.mail-archive.com/d...@lucene.apache.org/msg09654.html. Mainly due
to the sinusoidal projection.

(and if you are interested, I did Mikes spatial example with Lucene 3.0.2
and in Scala
http://blog.fakod.eu/2010/11/02/spatial-lucene-example-in-scala/)

-- 
Christopher
twitter: @fakod
blog: http://blog.fakod.eu

On Sat, Nov 13, 2010 at 11:05 PM, Peter Neubauer 
peter.neuba...@neotechnology.com wrote:

 Hi there,
 I just tried the examples for searching spatial with Lucene at
 http://develop.nydi.ch/2010/10/lucene-spatial-example/

 I am wondering if this still fits into the current Lucene framework
 integration, so we could add spatial indexing for simple Nodes with
 lat/lon properties into the existing index component, or simply have
 another (spatial) index backed by neo4j-lucene-index and exposed
 through the index framework? This is not on the level of Neo4j
 Spatial, but it would give a simple geo-lookup boundary for nodes or
 relationships. Is the support for adding the required Lucene spatial
 document fields already exposed so this could be added without bigger
 modifications to existing code?

 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   - Your high performance graph database.
 http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
 ___
 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] Neo4j REST Server with path prefix

2010-11-08 Thread Christopher Schmidt
Hi all,

how can I setup the REST server to use a standard url path prefix?

E. g. 
http://localhost:/MyPathPrefix/node/0/relationshipshttp://localhost:/node/0/relationships

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


Re: [Neo4j] Graph visualization

2010-10-12 Thread Christopher Schmidt
I think that the most tricky thing will be the algorithm, that places the
nodes and associations in a 3D space.

Christopher

Am 2010 10 12 11:08 schrieb Andreas Kollegger 
andreas.kolleg...@neotechnology.com:
That would be super cool. 3D could be beautiful, and possibly allow more
interesting visualizations of a graph. In addition to an overview of the
scene, it would be fun to play with 1st person and 3rd person views of the
current node.

What would be an easy proof-of-concept?

/Andreas


On Oct 12, 2010, at 1:19 AM, Andrew Andkjar wrote:

 I have not seen one in my Internet travels, h...
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Graph visualization

2010-10-12 Thread Christopher Schmidt
Great. Seems that this in general has something to do with:
http://en.wikipedia.org/wiki/Force-based_algorithms_(graph_drawing)

Check out these examples: http://code.google.com/p/webglsamples/ working
with dev version of Chrome.

Flying through a 3D graph would be really fancy :)

Am 2010 10 12 12:44 schrieb Andreas Kollegger 
andreas.kolleg...@neotechnology.com:
Googling around for force directed layout java reveals Graphael, which
might be an option -- http://graphael.cs.arizona.edu/



On Oct 12, 2010, at 12:24 PM, Alex Averbuch wrote:

 Hey,
 igraph already supports 3D layouts an...
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Graph visualization

2010-10-12 Thread Christopher Schmidt
Mathieu, I saw your screenshots - awesome.

Do you have any experience with HTML5/WebGL? The advantage would be
that the model could be completely created and rendered in a Browser
(simply using the REST interface). This is, of course, heavy
JavaScript programming :)

Christopher

On Tuesday, October 12, 2010, Mathieu Bastian mathieu.bast...@gmail.com wrote:
 Hi, I'm Gephi main developer and I would like to inform you that we have
 have some common aims. We would like to build a standard WebGL library for
 large graph visualization on the web. You can find more informations on the
 Gephi wiki:
 http://wiki.gephi.org/index.php/Specification_-_Graph_Visualization_on_the_web

 And, you may not be aware but you're about to release the Neo4j plug-in for
 Gephi. It is described here:
 http://gephi.org/2010/gsoc-2010-mid-term-adding-support-for-neo4j-in-gephi/

 And for 3D layouts, I think they are difficult to use. I prefer when a
 representation is 2D and I can explore it like a geographical map. 3D is
 fancy but if you have more than 100 elements on screen, users get lost.

 For force-directed layout implementations in Java, I recommend to look into
 Gephi, Cytoscape or JUNG source code.

 Hope this helps,

 Mathieu

 On Tue, Oct 12, 2010 at 1:32 PM, Christopher Schmidt 
 fakod...@googlemail.com wrote:

 Great. Seems that this in general has something to do with:
 http://en.wikipedia.org/wiki/Force-based_algorithms_(graph_drawing)http://en.wikipedia.org/wiki/Force-based_algorithms_%28graph_drawing%29

 Check out these examples: http://code.google.com/p/webglsamples/ working
 with dev version of Chrome.

 Flying through a 3D graph would be really fancy :)

 Am 2010 10 12 12:44 schrieb Andreas Kollegger 
 andreas.kolleg...@neotechnology.com:
 Googling around for force directed layout java reveals Graphael, which
 might be an option -- http://graphael.cs.arizona.edu/



 On Oct 12, 2010, at 12:24 PM, Alex Averbuch wrote:

  Hey,
  igraph already supports 3D layouts an...
 ___
 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