2

I'm looking forward to use NeoJ4 for some researchs. However I have to check if it can do what I want first.

I would like to build a graph that says :

StatementID1 = Cannabidiol hasPositiveEffectOn ChronicPain
    StatementID1 isSupportedBy Study1
    StatementID1 isSupportedBy Study2
    StatementID1 isNotSupportedBy Study3

This is easy to add key:Value properties to a relationship in NeoJ4.

The difficulty is that I want Study1,2,3 to be nodes. So that these can have them own set of properties.

This can be done in a triplestore where each triple has an ID like "Statment1" here. This is a matter of adding triples where the object is another triple ID.

url:TripleID1 = url:Cannabidiol url:hasPositiveEffectOn url:ChronicPain
url:TripleID2 = url:TripleID1 url:isSupportedBy url:Study1
url:TripleID3 = url:TripleID1 url:isSupportedBy url:Study2
url:TripleID4 = url:TripleID1 url:isNotSupportedBy url:Study3

For the moment I can't find how to do it simplely in NeoJ4.

I could add the DOI of the study as a property :

Study 1 :
    DOI:123/123

Then add the same DOI in the link :

isSupportedBy:
    DOI:123/123

Since the DOI is unique it could be possible to make some searchs. However this will make things much more complex.

Is there a simpler method to achieve that?

Xiiryo
  • 3,021
  • 5
  • 31
  • 48

2 Answers2

2

I suppose this is a database design issue.

Would a node/relationship model something like the following fit your data and make your queries easy?

Graph Database Model

rickhg12hs
  • 10,638
  • 6
  • 24
  • 42
  • That's it but since the Cannaidiol can have positive effects on other medical conditions, we need 2 links : Statement -> Subjet and statement -> object. Yet another problem is that there could be studies that say that Cannabidiol has postive effect on chronic pain and studies that says it has no effect. So that we need to point also Statement -> HAS_POSITIVE_EFFECT, what is impossible, or double store the link name in the statment properties. Wich is complex... – Xiiryo Mar 28 '19 at 09:41
  • An option could be to do : Cannabidiol -> HAS -> Effect {type:positive} -> ON -> ChronicPain. Then we can add a Statement that has 3 links : SUBJECT -> Cannabidiol, EFFECT -> Effect, OBJECT -> ChronicPain, and is linked from studies... – Xiiryo Mar 28 '19 at 09:53
  • We could even delet the statement node if the Effect node is unique to this statement. Then all Studies nodes would point to the Effect node. – Xiiryo Mar 28 '19 at 12:10
  • 1
    @Thib Or even link the `:Object` directly to the `:Statement`. It really depends on the data you have (or plan to have) and the queries you expect to do. And, if after a while you have a better model, you can just change it (as long as there aren't lots of other things/people depending on the database not changing). – rickhg12hs Mar 29 '19 at 09:08
2

Neo4j doesn’t support edges going from an edge to a node. Edges are always between nodes. So you’ll have to convert your positiveEffect edge to a node (as proposed in rickhg12hs’s answer) or model the positiveEffect as a non-edge (as you yourself proposed).

cygri
  • 9,412
  • 1
  • 25
  • 47