There are several use cases where more control over RelationshipTypes is
desirable.
You may want to state that a RelationshipType is functional (ie. there is at
most one outgoing relationship of a certain type per node),you may want to
state that a RelationshipType is injective (ie. there is at most one incoming
relationship of a certain type per node),You may want to state that a
RelationshipType is transitive (eg. PART_OF; if x is part of y and y is part of
z, then x is part of z).You may want to state that a RelationshipType is a
subtype of another RelationshipType.etc.
Right now RelationshipTypes are just names and all constraints need to be built
on top of Neo4J. This is actually a good thing and allows each user to create
his/her own type/meta layer.
What I am missing though is one hook in the core API to link a node to a
RelationshipType to store the additional information needed to maintain these
constraints.Currently, it is necessary to store the name of the
RelationshipType in Lucene and do an index lookup to retrieve the associated
RelationshipType node.
My request is the addition of two methods to RelationshipType:void
setNodeId(long id), which can be used to attach a certain node to a certain
RelationshipTypelong getNodeId, which returns the id of the node attached to
the RelationshipType.
For those who don't use a type/meta layer, no additional nodes will be
created.For those who do use a type/meta layer, nodes may be attached to
RelationshipTypes to facilitate lookups.
Niels
> From: [email protected]
> Date: Mon, 18 Jul 2011 13:45:10 -0400
> To: [email protected]
> Subject: Re: [Neo4j] Reification of RelationshipType
>
> This is a bit above my head, as we're users of the REST API rather than
> working with the core server in Java directly, but I just want to ask: will
> this pollute the database's pool of node IDs?
>
> Not the end of the world if it will, but it would be nice if it didn't. =)
> Maybe I just don't understand the use case or am not affected by it. I'm
> also not sure whether we "need" or use RelationshipType (we do of course
> specify relationship types when traversing, etc.).
>
> Aseem
>
> On Mon, Jul 18, 2011 at 12:53 PM, Niels Hoogeveen <[email protected]
> > wrote:
>
> >
> > Thanks for the cheer. Would someone currently working on core be able to
> > look at the feasibility of this request?
> > Niels
> >
> > > Date: Mon, 18 Jul 2011 18:30:23 +0200
> > > From: [email protected]
> > > To: [email protected]
> > > Subject: Re: [Neo4j] Reification of RelationshipType
> > >
> > > Nils,
> > > Sounds great, I am on parental leave all summer so I can only cheer :)
> > >
> > > /peter
> > >
> > > Sent from my phone.
> > > On Jul 18, 2011 5:22 PM, "Niels Hoogeveen" <[email protected]>
> > > wrote:
> > > >
> > > > In fact, this feature request wouldn't have to be more than a
> > > setNodeId(long id) and getNodeId() method on RelationshipType. This would
> > > eliminate the need to look up additional relationship type information
> > > through the Lucene Index.
> > > > Niels
> > > >
> > > >> From: [email protected]
> > > >> To: [email protected]
> > > >> Date: Mon, 18 Jul 2011 15:10:25 +0200
> > > >> Subject: [Neo4j] Reification of RelationshipType
> > > >>
> > > >>
> > > >> In another thread today, I defended the schemaless nature of Neo4J,
> > > however I believe there is one area where Neo4J has some sense of schema,
> > > which could use some improvement in my opinion, the RelationshipType.
> > > >> Whenever creating a typing layer on top of Neo4J, some duplication of
> > > functionality will be introduced with regard to RelationshipTypes.
> > > >> There is the RelationshipType in core, which is basically a name,
> > > >> and there will be a node in the typing layer, which will represent
> > that
> > > same RelationshipType as a node.
> > > >> Linking these two RelationshipTypes needs to be done by means of the
> > > Lucene index, which is not necessarily the fastest operation.
> > > >> Would it be possible to reify the RelationshipType as a node in core,
> > so
> > > relationshiptypes can be traversed. Different typing layers can then use
> > > that node to add additional information to the relationship (for example
> > > stating the transitivity, symmetry, reflexivity of the relationship, or
> > > whether the relationship is functional, injective or one-to-one, or the
> > > domain and range of the relationship).
> > > >> Different typing layers may implement the relationshiptype
> > differently,
> > > but having a node to attach this information to would suffice for all
> > > possible scenarios.
> > > >> The creation of a RelationshipType-node, can even be done lazy,
> > > >> so Neo4J users that don't need a RelationshipType-node won't be
> > bothered
> > > with additional nodes in the database.
> > > >> Niels
> > > >>
> > > >>
> > > >> _______________________________________________
> > > >> Neo4j mailing list
> > > >> [email protected]
> > > >> https://lists.neo4j.org/mailman/listinfo/user
> > > >
> > > > _______________________________________________
> > > > Neo4j mailing list
> > > > [email protected]
> > > > https://lists.neo4j.org/mailman/listinfo/user
> > > _______________________________________________
> > > Neo4j mailing list
> > > [email protected]
> > > https://lists.neo4j.org/mailman/listinfo/user
> >
> > _______________________________________________
> > Neo4j mailing list
> > [email protected]
> > https://lists.neo4j.org/mailman/listinfo/user
> >
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user