I want to get a visual presentation of a rdf(.ttl) graph. I am using this code(python):
# print the ttl sources as a graph def nt_to_graph(rel_path): g = Graph() g.parse(rel_path, format="ttl") g.bind("food", "http:<some_url>/food#") G = rdflib_to_networkx_multidigraph(g) # Plot Networkx instance of RDF Graph pos = nx.spring_layout(G, scale=2) edge_labels = nx.get_edge_attributes(G, "r") nx.draw_networkx_edge_labels(G, pos, edge_labels) nx.draw(G, with_labels=True) plt.show()
The nodes have the labels as follow: "http:some_url/food#".
I want the node label to be just "food".
How can i do this?
Thanks.