INCATools / semantic-sql

SQL and SQLite builds of OWL ontologies
https://incatools.github.io/semantic-sql/
BSD 3-Clause "New" or "Revised" License
37 stars 3 forks source link

Extract subgraphs for visualization #5

Closed cmungall closed 3 years ago

cmungall commented 3 years ago

I'd like to be able to extract subgraphs for visualization in https://github.com/cmungall/obographviz

(the extract subgraph would be similar to gizmos extract, cc @jamesoverton @rebeccajackson but it may serve a different purpose for now)

I think this can be done with a VIEW like

SELECT
            edge.*,
            ee.predicate AS ancestor_predicate,
            ee.object AS ancestor_object
          FROM edge JOIN entailed_edge AS ee ON (edge.subject = ee.subject)

this allows queries like

SELECT * FROM sg_edge WHERE ancestor_object='UBERON:0002101' AND ancestor_predicate='BFO:0000050'

in procedural terms, this will

note this will result in some dangling edges. It should be easy to have more refined views that check if both sub and obj is in the descendant closure

entailed_edge is populated via @balhoff's relation-graph

to get to something like:

img

it would be just a matter of turning the TSV that is exported into an obojson file. But we may want to change the obograph javascript code to accept other formats