Closed pebbie closed 3 years ago
HI @pebbie , that's excellent!
I was able to run your notebook with this
pip install pygraphviz jupyterlab pyvis networkx
and this query
#endpoint: https://sparql.rhea-db.org/sparql
PREFIX rh:<http://rdf.rhea-db.org/>
SELECT ?reaction ?reactionEquation
WHERE {
VALUES ?status { rh:Approved rh:Preliminary }
?reaction rdfs:subClassOf rh:Reaction .
?reaction rh:status ?status .
?reaction rh:equation ?reactionEquation .
}
ORDER BY ?reaction
gets visualised into this
Would you feel like adapting your code and contributing this in a PR ?
pyvis nbetworkx rdflib
are already part of the requirements and I think we could cut out pygraphviz
then right?
Sure, I'll see if I can provide into networkx
graph directly without using pygraphviz
.
Do you have any ideas/suggestions on how or where this should be integrated with kglab?
so i managed to adapt the code to generate the graph without using pygraphviz
and adding some default style.
any suggestion on how to integrate this?
@pebbie wonderful!! So glad to see :)
Perhaps as a simple approach to integration, if you'd like to add a PR for this as a utility function in https://github.com/DerwenAI/kglab/blob/main/kglab/util.py then we could refactor into the classes.
@louisguitton @Ankush-Chander: How about, this could fit well within the PyVis-related methods of SubgraphTensor
https://github.com/DerwenAI/kglab/blob/main/kglab/subg.py#L452 ?
Yeah as a first step, I would vouch for "parking" this code either in the util.py
file or even in a standalone module sparql_viz.py
or something like that.
Hi, Thank you for this nice work!
I am suggesting adding the ability to visualize the SPARQL query (the graph pattern) to help in the tutorials. I wrote this small library a year ago. I notice that kglab uses pyvis so I refactor the code a bit today so it can be used in pyvis. This is available in the example notebook.
Cheers