[Neo] Newbie: neo4j doubts
mattias at neotechnology.com
Fri Feb 19 14:11:48 CET 2010
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
> 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
...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
You cannot modify the graph in an EmbeddedReadOnlyGraphDatabase. The
methods are there, but you'll get a RuntimeException when calling
> 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.
> Sr. Software Architect
> Center of Excellence (COE)
> True Sparrow Systems
> Neo mailing list
> User at lists.neo4j.org
Mattias Persson, [mattias at neotechnology.com]
Neo Technology, www.neotechnology.com
More information about the User