2
votes

I don't think it's possible to do what I'm seeking, but I thought I'd throw it out for creative suggestions. The Unified Medical Language System (UMLS; https://uts.nlm.nih.gov/home.html) is a semantic ontology which has a variety of bidirectional relationships between nodes. For example x isa y and y inverse_isa x. The problem is there are many such names and their reverse directed relationship. Thus, in a query, it is not enough to exclude one because the listing has many possibilities, which is cumbersome and may overlook something. The problem, in other words, is can you create a directed acyclic graph query when there are relationships that will reverse the traversal. If you have a outbound relationship from node x to y, you want to ignore the inbound relationship to x from y. I'm using Neo4j 2.3.0. The UMLS, as I'm filtering the data, has ~11M nodes and 45M relationships. There are 654 relationship types and the list is dynamically growing; this is another reason for a generic solution not dependent on a specific listing in- and out-bound relationships.

2

2 Answers

3
votes

If, in UMLS, every "inverted" relationship is paired with a corresponding "positive" relationship (i.e., they link the same 2 nodes, but go in opposite directions), then you could just omit the inverted relationship in the neo4j DB, since neo4j can navigate relationships in either direction. Would this solve your problem?

0
votes

I am sorry I have only a very little understanding of the problem.

Please see if this is of any help. For inverted relationships, you can query for something like this. Here, b will be used for the reverse relationship.

match (n)-[a]->(m)-[b]->(n) return m;