问题
I am currently looking at modelling tertiary courses and other such entities (MATH101, BIOL360, BSc etc.), and one of the options we're looking at is graph databases. I am not familiar with graph databases, other than in theory.
One of the things I am trying to model is requirements, for example "MATH201 requires the student previously completed MATH101". That one seems easy - I can create a vertex between the two. Others are more complicated: "Bachelor of Computer Science requires 40 points at 200 level or higher in science papers".
What I'd like to do here is name a bunch of sets, a la Neo4J Labels, then create a relationship from one of the nodes to the set of nodes described in the labels, but I can't see a way to do this. Is this something that's possible in graph databasing engines, or am I basically running down an XY path, and should be doing something else entirely?
I've tagged Neo4J because I'm leaning towards it as (from what I can tell) it's the most widely known/used graph dbms, but I'm open to solutions in other databases too (in fact, if it's possible in the very new SQL Server offering, that would probably be ideal as other infrastructure is on that).
回答1:
Well, in the fist case, I think you can make a :REQUIREMENT
relationship between "MATH201" and "MATH101".
In the second case you can make a :REQUIREMENT
relationship between "Bachelor of Computer Science" node and an intermediate node to group all science papers, as in the image below. Also, you can put some extra properties in the relationship to what type of requirement the course has:
来源:https://stackoverflow.com/questions/49625522/how-to-model-relationships-between-sets-of-nodes