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.
robot convert --input input.owl --output output.json
jq -r '["id","type","label"], (.graphs[0].nodes[] | [.id, .type, .lbl]) | @csv' output.json > nodes.csv
jq -r '["source", "type", "target"], (.graphs[0].edges[] | [.sub, .pred, .obj]) | @csv' output.json > edges.csv
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
File/Export/Graph file...
) to ccf.graph.json