Update app.py
Browse files
app.py
CHANGED
@@ -47,22 +47,16 @@ def run_query_and_visualize(qtext, jsonld_url):
|
|
47 |
G.add_node(str(o), label=str(o).split('/')[-1])
|
48 |
G.add_edge(str(s), str(o), label=str(p).split('/')[-1])
|
49 |
|
|
|
|
|
|
|
50 |
# Desenha o gr谩fico usando NetworkX e Matplotlib
|
51 |
-
|
52 |
-
"Adem": (0, 0.6),
|
53 |
-
"Adem-geo": (-0.4, -0.3),
|
54 |
-
"Adem-obra": (0.4, -0.1)
|
55 |
-
}
|
56 |
-
|
57 |
-
plt.figure(figsize=(10, 8))
|
58 |
nx.draw_networkx_nodes(G, pos, node_size=3000, node_color="skyblue", alpha=0.9)
|
59 |
nx.draw_networkx_edges(G, pos, width=2, alpha=0.5, edge_color='gray')
|
60 |
nx.draw_networkx_labels(G, pos, labels=nx.get_node_attributes(G, 'label'), font_size=9, font_color="black")
|
61 |
nx.draw_networkx_edge_labels(G, pos, edge_labels=nx.get_edge_attributes(G, 'label'), font_size=9, font_color="red")
|
62 |
|
63 |
-
plt.xlim(-1, 1)
|
64 |
-
plt.ylim(-1, 1)
|
65 |
-
|
66 |
plt.title("Resultado da Consulta SPARQL", size=15)
|
67 |
plt.axis('off')
|
68 |
|
|
|
47 |
G.add_node(str(o), label=str(o).split('/')[-1])
|
48 |
G.add_edge(str(s), str(o), label=str(p).split('/')[-1])
|
49 |
|
50 |
+
# Define posi莽玫es para os n贸s
|
51 |
+
pos = nx.spring_layout(G)
|
52 |
+
|
53 |
# Desenha o gr谩fico usando NetworkX e Matplotlib
|
54 |
+
plt.figure(figsize=(15, 10))
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
nx.draw_networkx_nodes(G, pos, node_size=3000, node_color="skyblue", alpha=0.9)
|
56 |
nx.draw_networkx_edges(G, pos, width=2, alpha=0.5, edge_color='gray')
|
57 |
nx.draw_networkx_labels(G, pos, labels=nx.get_node_attributes(G, 'label'), font_size=9, font_color="black")
|
58 |
nx.draw_networkx_edge_labels(G, pos, edge_labels=nx.get_edge_attributes(G, 'label'), font_size=9, font_color="red")
|
59 |
|
|
|
|
|
|
|
60 |
plt.title("Resultado da Consulta SPARQL", size=15)
|
61 |
plt.axis('off')
|
62 |
|