[Neo] Newbie: neo4j doubts

Mattias Persson mattias at neotechnology.com
Fri Feb 19 14:11:48 CET 2010


Hi Sunil,

2010/2/19 Sunil Khedar <sunil at truesparrow.com>:
> Hi All,
>
> I was going through the neo4j API. There are few things in API that are not
> clear to me:
>
> 1. What other configuration options can be set for neo4j, apart from
> storeDir? As in API all configuration related parameter methods are either
> depricated or will be soon.
A new configuration API will hopefully make it into version 1.1. Until
then, please look at
http://wiki.neo4j.org/content/Configuration_Settings
>
> 2. Can I traverse nodes using "INCOMING" or "OUTGOING" directions, if they
> have BOTH direction relations?
Relationships are always directed, so they always have a start node
and an end node. This means that a relationship only have a direction
given a context, i.e. what is the direction of relationship (A) if
you're looking at it from node (N). Direction can be ignored in
traversals and when you get relationships for a node, and this is
where the BOTH direction is used.
>
> 3. How DynamicRelationshipType is different from RelationshipType? Following
> is mentioned in API:
> "Dynamic relationship type is persisted only when the first relationship of
> this type is created."
>   I think DynamicRelationshipType is of no use untill it's used for the
> first time. Please correct me if I am wrong.
DynamicRelationshipType is just a simple implementation of
RelationshipType interface in that it only implements the name()
method. RelationshipType is just a wrapper around a String really and
it specifies the name of the relationship type. Either you use enums
to list your relationship type, so that they become compile-time
checked in your code, f.ex:

public enum MyRelationshipTypes implements RelationshipType
{
    KNOWS,
    LOVES,
}

...or you can do it on the fly at runtime via f.ex.
DynamicRelationshipType.withName( "KNOWS" ). The result of using the
one or the other is identical.
>
> 4. How EmbeddedReadOnlyGraphDatabase and EmbeddedGraphDatabase are
> different? As both of them are able to create nodes? Are nodes created by
> EmbeddedReadOnlyGraphDatabase non-persistent? I think I am missing something
> here.
You cannot modify the graph in an EmbeddedReadOnlyGraphDatabase. The
methods are there, but you'll get a RuntimeException when calling
f.ex. createNode().
>
> 5. How to make sure that ASYNC_OTHER_TX related indexing jobs are not lost?
> How these jobs are triggered?
Currently they aren't persisted, so if your indexing is critical,
stick with the default configuration.
>
> 6. Can we define custom ReturnableEvaluator and StopEvaluator?
Sure, just create implementations of those classes and pass such
instances into the Node.traverse method.
>
> 7. While creating a node can we define the node id? If no, I think we have
> to use lucene in-order to get the node ids. Please correct me if there is
> any other way.
No, the node (and relationship) ids are internal and you could rely on
an IndexService (see http://components.neo4j.org/neo4j-index/) for
lookups about other properties, f.ex. "uri" or "username" or such.
>
>
> Thanks,
> Sunil
>
> --
> Sr. Software Architect
> Center of Excellence (COE)
> True Sparrow Systems
> _______________________________________________
> Neo mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [mattias at neotechnology.com]
Neo Technology, www.neotechnology.com


More information about the User mailing list