2010/9/19 Martin Aryee <martin.ar...@gmail.com>

> Thanks for the responses. Since I'm new to this graph db thing I might very
> well just be setting up my model wrong.
>

Yeah, since there are more than one way to model your domain it's not always
clear which solution is the best.


> I'm representing a group of scientists and want to somehow capture the list
> of publications they have coauthored. Each publication has a set of keywords
> representing research areas (e.g. "diabetes", "clinical trial"). I don't
> know a priori what all the research areas will be as new ones will be added
> over time.  I'd like to be able to do queries like "find all the people who
> have worked with scientist A on diabetes. For each partner I also want the
> list of their shared publications"
>
> For example, l I might have 3 scientists (A, B and C), 3 publications (1,2
> and 3) and 3 research areas (cancer , clinical trial and diabetes):
>   A and B have coauthored publication 1 on cancer and clinical trials
>   A and C have coauthored publications 2 and 3 on diabetes.
>
> I had originally planned to have a relationship type for each research
> area, but maybe I should just be using a single relationship type
> ("is_coauthor_with") and then add  properties where the key is a research
> area and the value is a list of publications?  Sorry if this is a bit
> confused - I'm still trying to get my head around the basic concepts...
>

It's hard to know what would be the right thing to do here, I probably don't
know enough about your whole domain. If you have a fixed (or rather fixed)
and small number of research areas it could be an idea to have each area as
a relationship type, but it may not give you any extra benefits. It would
give a performance benefit if some of your nodes would have many
relationships to many different research areas and you wanted to query for a
specific research area... then it'd be faster (once the node and its
relationships had been cached into memory from disk) to find those
relationships as opposed to the case where you only had a "is_coathor_with"
and had to look at all the relationships to sort out the ones you wanted.
But if the number of research areas were very big or if you wouldn't ask
queries which would benefit from having separate relationship types then you
could go with only one relationships type. So it depends some on what types
of queries you're going to ask it.


>
> Martin.
>
>
> On Sep 19, 2010, at 4:45 PM, Jawad - CitizenPlace wrote:
>
> >  Hi,
> >
> > you can easily create a relationship type with a name that is not
> > detemined from an enum. In fact, you can use any string.
> >
> > You have to create a DynamicRelationshipType
> > (
> http://api.neo4j.org/current/org/neo4j/graphdb/DynamicRelationshipType.html
> ).
> > You can then write:
> >
> > relationship_type = "knows"
> > n1.has_relationship(n2,
> DynamicRelationshipType.withName(relationship_type))
> >
> > Jawad
> >
> > Le 19/09/10 22:12, Victor Augusto de Campos a écrit :
> >> Sorry if I'm saying something silly, I started playing with neo a couple
> of
> >> weeks ago only, but afaik relationships can only be created using enums
> >> because of the nature of enums (representing fixed set of constants) and
> how
> >> that helps to maintain consistent relationship types that your
> application
> >> has without the overhead of string manipulation, is that correct?
> >>
> >> I can't see any benefit on using strings to store those relationship
> types,
> >> why would you like to do it?
> >>
> >> On Sun, Sep 19, 2010 at 4:18 PM, Martin Aryee<martin.ar...@gmail.com
> >wrote:
> >>
> >>> Hi,
> >>>
> >>> I was wondering if it's possible to create a new relationship type with
> a
> >>> name that's determined by a variable.
> >>>
> >>> For example, when creating a relationship "knows" I'd typically write:
> >>>
> >>> n1 = graphdb.node()
> >>> n2 = graphdb.node()
> >>> n1.knows(n2)
> >>>
> >>> Instead of the last line, I'd like to do something like:
> >>>
> >>> relationship_type = "knows"
> >>> n1.has_relationship(n2, relationship_type)
> >>>
> >>> Is that possible at all?
> >>>
> >>> Thanks,
> >>> Martin.
> >>>
> >>> _______________________________________________
> >>> 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
> >
> >
> > --
> > *Jawad, * pour l'équipe CitizenPlace
> > Tél : +33 9 52 31 26 45
> > Mobile : +33 6 20 08 16 13
> > E-mail : ja...@citizenplace.com <mailto:ja...@citizenplace.com>
> > _______________________________________________
> > 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
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to