GraphGists

Domain

A pharmaceutical portfolio is a collection of drug compounds, their respective indications, and their targets. A pharmaceutical company or drugstore organizes its pharmaceutical products into one or more portfolios. A drug portfolio thus contains multiple pharmaceuticals, with each pharmaceutical containing a link to one or more of its targets in the human body. This lends itself to be modeled as a graph. Each pharmaceutical and drug target can also have a distinct set of attributes which also fit nicely into the property graph model. Within the examples found in this use case, most drug targets happen to be G-protein coupled receptors (GPCRs), for which structures have only recently been solved in the last several years.

A drug can have one or more targets. A target can be targeted by one or more drugs. This is not a complete solution for all the drug portfolio use cases but provides a good starting point.

Domain Model
Figure 1. Domain Model

Setup

The sample data set uses a pharmaceutical portfolio.

Try other queries yourself!

Use Cases

All portfolios

MATCH (c:Portfolio)
RETURN c.name AS Portfolios

All categories by Depth

MATCH p=(cats:Category)-[:PARENT|PARENT*]->(cat:Portfolio)
RETURN LENGTH(p) AS Depth, COLLECT(cats.name) AS Categories
ORDER BY Depth ASC

All categories of a given depth

MATCH p=(cats:Category)-[:PARENT*]->(cat:Portfolio)
WHERE cat.name='Pharmaceutical Portfolio' AND length(p)=1
RETURN cats.name AS `Categories of Given Level`
ORDER BY cats.name

All sub-categories of a given category

MATCH (cats:Category)-[:PARENT]->(parentCat:Category)
MATCH (parentCat)-[:PARENT*]->(c:Portfolio)
RETURN parentCat.name AS Parent, COLLECT(cats.name) AS SubCategories

All parents and their child categories

MATCH (child:Category)-[:PARENT*]->(parent)
RETURN parent.name AS Parent, COLLECT(child.name) AS Children

All parent and their IMMEDIATE children

MATCH (child:Category)-[:PARENT]->(parent)
RETURN labels(parent), parent.name AS Parent, COLLECT(child.name) AS Children