Hi,

The Neo4j documentation has been updated at:
http://hg.readify.net/neo4jclient/wiki/Home

HTH

-----Original Message-----
From: Romiko Derbynew 
Sent: Monday, 10 October 2011 10:22 AM
To: 'Bill Baker'
Cc: Tatham Oddie; 'user@lists.neo4j.org'
Subject: RE: [Neo4j] C# REST binding / wrapper

Bill,

Here is an example to create a node without any relationships.

                graphClient.Create(new WebSite { Name = "acme" });

Of course, a better example would be if you had multiple root nodes, perhaps 
different hosting sites if it was a multi-tenant portal db.

Cheers

-----Original Message-----
From: Romiko Derbynew
Sent: Monday, 10 October 2011 10:14 AM
To: 'Bill Baker'
Cc: Tatham Oddie; user@lists.neo4j.org
Subject: RE: [Neo4j] C# REST binding / wrapper

Hi Bill,


Indeed, it makes sense to have the relationships stemming from the root node.

There is a nice tool you can use to start modelling your graph, it is called 
GVEdit. You can download it from here:
http://www.graphviz.org/

What we do, is before developing, we first add the poco's to GVEdit, and this 
gives us a good idea of how we want to model the database. We always try to 
ensure that everything in the DB grows in proportion. So for example, if we add 
new nodes, there will be new relationships etc.

For reference data (Perhaps a country names etc) we just have a Countries 
Category and then off that each individual country. You can then have a drop 
down list in the UI that gets all country nodes from Countries (Grouping Node).

Here is an example of retrieving a list of countries. Each Country is a node 
and is Grouped in a Countries Node.

public IEnumerable<Node<Country>> GetCountries()
        {
            if (countries != null) return countries;

            lock (countriesLock)
            {
                if (countries != null) return countries;
                countries = graphClient
                    .RootNode
                    .Out<ReferenceDataCategory>(HasReferenceData.TypeKey)
                    .Out<CountriesCategory>(HasCountries.TypeKey)
                    .Out<Country>(HasCountry.TypeKey)
                    .OrderBy(l => l.Data.Name)
                    .ToArray();
            }

            return countries;
        }


Notice:
Root Node (g.v(0)) is built into the graphclient, so you automatically have a 
reference to g.v.(0)
RootNode->ReferenceDataCategory -> CountriesCategory ->Country

You can name your relationships any way you like, it is always nice if they are 
descriptive enough to give you an idea what direction it would be.
e.g. 
HAS_PERMISSION (Implies from User to a Permission node)

Also, you have store payload information on relationships as well, which can be 
useful in some scenarios.

I recall, mentioning a way to populate this reference data e.g. a Resource file 
with list of countries, so perhaps the first time the db starts up, you can run 
a sort of schema check.

See this link below for examples of gvedit and code using the graph client to 
create lookup data in the DB:

http://hg.readify.net/neo4jclient/wiki/samples


Cheers

-----Original Message-----
From: Bill Baker [mailto:bill...@billbak.com]
Sent: Monday, 10 October 2011 4:33 AM
To: Romiko Derbynew
Subject: RE: [Neo4j] C# REST binding / wrapper

That makes a lot of sense.  I guess my follow up question is a more generic 
Neo4j/graph question;  in your schema below, would you have N links from the 
root to N CompanyNodes or one line to a 'Companies' node and N links from there 
to the N companies?  And in either case, does it matter much what we call the 
links from the root to the companies (or groups, or people...)?  Seems like 
that relationship is either an "IsA_____" link from the root or a "BelongsTo" 
from the node.

Thanks!

BTW, any sample code helps!  Thanks.

-----Original Message-----
From: Romiko Derbynew [mailto:romiko.derby...@readify.net]
Sent: Saturday, October 08, 2011 8:03 PM
To: Bill Baker
Subject: Re: [Neo4j] C# REST binding / wrapper

Hi Bill,

Indeed you will also need to define a relationship with the participating node. 
So for example you might have node called Groups which a person belongs to.

Then you might ask but what is Groups related to, well at some point it will be 
off the ROOT node.

E.g
RootNode->CompanyNode->Groups->person

So as you see your very first node will be off Root and away you go, the 
graphclient always holds a reference to the root node. 

So, when making a node, always have the relationship and participating node.

What we have in our system is a schema manager that always checks the DB for 
the core nodes e.g Company off root Users off Company Customers off Company 

And so on.

Let me know how you go, else I can send you sample code to (initialize) your db 
schema. 

Cc me at romiko.derby...@readify.net

Sent from my iPhone

On 09/10/2011, at 6:45 AM, "Bill Baker" <bill...@billbak.com> wrote:

> Romiko,
> 
> I'm back to trying Neo4jClient and honestly,  am missing something critical I 
> think.  I read the post below, and I appreciate the type safety built into 
> the mechanism.  But in my over-tired state, I'm seeing that I can only create 
> a node if I create a relationship at the same time.  I'm missing something...
> 
> What is the simple way to create a node of type Person (where Person is 
> defined by a class in my code)?
> 
> 
> I modeled the PersonBelongsTo on the UserBelongsTo class from the blog post.  
> But my reading suggests I need an already created (Club) node in order to 
> initialize the PersonBelongsTo class.  
> 
> Then I can do NodeReference node = client.Create<Person>(bob, new 
> PersonBelongsTo (????));  [Where bob is an instance of  a Person
> class.)
> 
> Thanks!!
> 
> Bill
> 
> 
>    public class PersonBelongsTo :
>    Relationship,
>    IRelationshipAllowingSourceNode<Person>,
>    IRelationshipAllowingTargetNode<Club>
>    {
>        public PersonBelongsTo(NodeReference targetNode)
>            : base(targetNode)
>        {
>        }
> 
>        public const string TypeKey = "PERSON_BELONGS_TO";
>        public override string RelationshipTypeKey
>        {
>            get { return TypeKey; }
>        }
>    }
> 
> 
> 
> -----Original Message-----
> From: user-boun...@lists.neo4j.org
> [mailto:user-boun...@lists.neo4j.org] On Behalf Of Romiko Derbynew
> Sent: Monday, October 03, 2011 1:30 AM
> To: Neo4j user discussions
> Cc: Neo4j user discussions
> Subject: Re: [Neo4j] C# REST binding / wrapper
> 
> There is some examples at http://romikoderbynew.com
> 
> Cheers
> 
> Sent from my iPhone
> 
> On 03/10/2011, at 6:36 PM, "Bill Baker" <bill...@billbak.com> wrote:
> 
>> Thank you.  I have started using it.  I have to take a week off the project 
>> for other things going on, but will pick it up again soon.  If anyone knows 
>> of any examples of using it, that would be cool too.
>> 
>> -----Original Message-----
>> From: user-boun...@lists.neo4j.org
>> [mailto:user-boun...@lists.neo4j.org] On Behalf Of Tatham Oddie
>> Sent: Sunday, October 02, 2011 4:49 PM
>> To: Neo4j user discussions
>> Subject: Re: [Neo4j] C# REST binding / wrapper
>> 
>> Thanks for the mention Peter.
>> 
>> Bill - we're currently building a mission critical system using ASP.NET MVC 
>> + Neo4j. We are developing the Neo4jClient as we go, adding features as we 
>> need them.
>> 
>> So far this covers:
>> 
>> * all the CRUD operations
>> * most of the Gremlin operations via a nice fluent interface
>> * all of the Gremlin operations if you want to pass in Gremlin script 
>> directly
>> * index creation, management and querying
>> * shutting down the neo4j server cleanly (send a shutdown command via 
>> REST before tearing the process down)
>> 
>> You'll notice on our NuGet page that new builds are getting published almost 
>> daily.
>> 
>> 
>> -- Tatham
>> 
>> -----Original Message-----
>> From: user-boun...@lists.neo4j.org
>> [mailto:user-boun...@lists.neo4j.org] On Behalf Of Peter Neubauer
>> Sent: Friday, 30 September 2011 2:13 AM
>> To: Neo4j user discussions
>> Subject: Re: [Neo4j] C# REST binding / wrapper
>> 
>> Bill,
>> I think the most active C# REST client is 
>> http://nuget.org/List/Packages/Neo4jClient by Romiko and Tatham. It seems 
>> very complete - we are in the process of updating the wiki and pulling it 
>> into docs.neo4j org so it doesn't get outdated ...
>> 
>> 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 Thu, Sep 29, 2011 at 6:07 PM, Bill Baker <bill...@billbak.com> wrote:
>>> I checked the FAQ but didn't see this item.
>>> (http://wiki.neo4j.org/content/FAQ)
>>> 
>>> I've downloaded and used two of the wrappers out there, Neo4RestNet and 
>>> Neo4jRestSharp.  I haven't been able to convince myself they are complete; 
>>> but I'm still very new at Neo4j so my issues may be more my inexperience 
>>> than incompleteness of either of these.
>>> 
>>> So some quick questions:
>>> 
>>> Can I do everything using REST that I can using the Java API?
>>> Do either or both of these wrap every REST request?  (I haven't yet 
>>> doped out how to do indexing in RestNet, but am still trying.) What 
>>> else is there for us .Net types?  (I know, I know, it's
>>> Neo-for-JAY!)
>>> 
>>> Thanks!
>>> 
>>> --------------------------------------------------
>>> Bill Baker, Investor, Advisor, Board Member My other house is a data 
>>> warehouse
>>> 
>>> _______________________________________________
>>> 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
>> _______________________________________________
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>> 
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to