1 of 15

n0

un

n2

TRAPI query: goal is to fill out the blue parts

e0

e1

e2

Set to 1 ID, like

PUBCHEM.COMPOUND:5291 (imatinib)

Set to 1 ID, like

MONDO:0004979 (asthma)

2 of 15

Early step: transform TRAPI query into 1-hop

  • Basically removing the un QNode and e0/e1 QEdges

Then the following steps should be easier:

  • Matching to pathfinder templates
  • Running the "normal inferred-mode execution"

n0

n2

e2

Set to 1 ID, like

PUBCHEM.COMPOUND:5291 (imatinib)

Set to 1 ID, like

MONDO:0004979 (asthma)

3 of 15

At the end of "normal inferred-mode execution", there'll be 1 result.

n0

n2

PUBCHEM.COMPOUND:5291 (imatinib)

MONDO:0004979 (asthma)

e2 = mega_edge

The mega_edge will have tons of support-graphs. 1 of these support-graphs = 1 result from a template

4 of 15

Each template-result represents a "basically linear" path of intermediate nodes

(templates will be designed so they produce this) (1)

n0

n2

PUBCHEM.COMPOUND:5291 (imatinib)

MONDO:0004979 (asthma)

A

There could be multiple edges between two nodes

5 of 15

n0

n2

PUBCHEM.COMPOUND:5291 (imatinib)

MONDO:0004979 (asthma)

A

These KG edges may have their own sub-graphs due to subclassing.

Right now, we think it'll be easier to ignore them for special pathfinder-results-formatting. Still preserve the content though (these sub-graphs/nodes/edges should still exist)

AKA intermediate nodes mapped to un QNode won't be subclass-nodes

Each template-result represents a "basically linear" path of intermediate nodes

(templates will be designed so they produce this) (2)

A

Specific kind of asthma

asthma

6 of 15

special pathfinder-results-formatting (1)

Iterate through each support-graph aka result from a template

New result format:

This initial support-graph can be kept on e2

Then pick out the intermediate node -> un, set e0 and e1 accordingly

n0

n2

PUBCHEM.COMPOUND:5291 (imatinib)

MONDO:0004979 (asthma)

A

un

e0

e1

e2

7 of 15

special pathfinder-results-formatting (2)

If there's multiple intermediate nodes, it'll be split into multiple new results - 1 per intermediate node. The results will have the same e2 subgraph

un

e0

e1

n0

n2

A

B

For A:

un

e0

e1

n0

n2

A

B

For B:

8 of 15

Optional?

There may be "new" results at the end that have the same un node (intermediate). We're okay with that for now, but we could also have a step of trying to merge these results together

un

n0

A

n2

un

n0

A

B

n2

e0: in this case, the same actual KG edge for both "new" results

e1: KG edges differ between the "new" results

e2: union of KG edges from both results

9 of 15

Multiple-edge clarification (1)

It’s possible the following structure might show up in inferred-handler output by two template results (as support graphs in inferred-handler mega-result):

n0

A

B

n2

n0

A

n2

n0

A

B

n2

Template result 1

Template result 2

Overall KG

10 of 15

Multiple-edge clarification (2)

Iterating by template results:

First template result is decomposed into the final result format

(note how e2 support graph is just the template result – make sure it’s a copy, you’ll see why later)

n0

A

n2

n0

A

A

n0

A

n2

n2

n0

A

n2

Template result 1

A as unpinned node

e0 support graph

e1 support graph

e2 support graph

11 of 15

Multiple-edge clarification (3)

Template Result 2: Iterate over all intermediate nodes and make results for each.

When constructing a result, check if a result with that pinned node exists: if so, merge the support graphs instead.

n0

A

n2

n0

A

A

n0

A

n2

n2

A as unpinned node

e0 support graph

e1 support graph

e2 support graph

Template result 2

n0

A

B

n2

B

B

12 of 15

Multiple-edge clarification (4)

Now, using B as the pinned node. No result exists for B so decompose into a new one. Be careful! A new e2 support graph must be made, so e2 support graphs should be ID’d by intermediate node.

Template result 2

n0

A

B

n2

n0

B

n2

n0

A

B

A

B

n2

B

n2

e2 support graph

n0

e0 support graph

e1 support graph

13 of 15

Multiple-edge clarification (5) (desired results format)

We’re left with two results, one with A pinned, one with B pinned.

n0

B

n2

n0

A

B

A

B

n2

B

n2

e2 support graph

n0

e0 support graph

e1 support graph

n0

A

n2

n0

A

A

n0

A

n2

n2

e0 support graph

e1 support graph

e2 support graph

B

B

14 of 15

Multiple-edge clarification alternate handling (not preferred)

The final results would look like this (again, fine that two have the same un):

n0

A

n2

n0

A

n2

A

n2

n0

A

n0

A

n2

n0

A

B

A

B

n0

A

n2

n2

n0

B

n2

n0

A

B

A

B

n2

B

n2

e2 support graph

e2 support graph

e2 support graph

n0

e0 support graph

e0 support graph

e0 support graph

e1 support graph

e1 support graph

e1 support graph

Same edge/support graph

15 of 15

Another alternate handling (not preferred)

Achieved by adding support graphs to support graph array, rather than merging

A

n2

n0

A

n2

n0

A

B

A

B

n0

A

n2

n2

n0

B

n2

n0

A

B

n0

B

n2

B

n2

Second support graph

A

n2

n0

Second support graph