block by bherr2 47df504eb1c1a79d73c96e078cab16a4

Owl Ontologies + GEPHI + Vega Lite Example

Full Screen

Owl Ontologies + GEPHI + Vega Lite Example

A Vega-Lite example that uses JSON data exported from Gephi: The Open Graph Viz Platform.

An example ontology was copied from HuBMAP. It was converted, loaded into Gephi, and exported as a JSON Graph (File/Export/Graph file...). The data is embedded in the Vega-Lite spec (vis.vl.json) as two datasets: nodes and edges. The spec renders nodes and edges according to the color and size encodings created in Gephi. All attributes available to Gephi are available in the Vega-Lite spec for further customization as needed.

Specific steps for data generation are below.

1. Convert Owl Ontology to JSON

  1. Download Robot
  2. Download Your Favorite Ontology (in Owl format)
  3. Convert Owl to JSON by running: robot convert --input input.owl --output output.json

2. Extract data for GEPHI

  1. Download GEPHI and jq
  2. Extract nodes by running: jq -r '["id","type","label"], (.graphs[0].nodes[] | [.id, .type, .lbl]) | @csv' output.json > nodes.csv
  3. Extract edges by running: jq -r '["source", "type", "target"], (.graphs[0].edges[] | [.sub, .pred, .obj]) | @csv' output.json > edges.csv

2a. Specific commands for CCF partonomy

curl -L http://purl.org/ccf/latest/ccf.owl -o ccf.owl
robot convert --input ccf.owl --output ccf.json

# Extract partonomy nodes
jq -r '["id","type","label"], (.graphs[0].nodes[] | [.id, .type, .lbl]) | @csv' ccf.json | grep -v ccf.owl > ccf.nodes.csv

# Keep just ccf_part_of edges
jq -r '["source", "type", "target"], (.graphs[0].edges[] | [.sub, .pred, .obj]) | @csv' ccf.json | grep -P '\#ccf_part_of|"source"' > ccf.edges.csv

3. Layout data in GEPHI and export to JSON Graph

  1. Exported layout as a JSON Graph (File/Export/Graph file...) to ccf.graph.json

index.html

ccf.gephi

ccf.nodes.csv

vis.vl.json