eaglelandsonce commited on
Commit
23028aa
·
verified ·
1 Parent(s): 5b25129

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -126,23 +126,25 @@ def main():
126
  collapsible=True)
127
 
128
 
129
-
130
  if sensors: # Check if there are sensors to display
131
  st.header("Building Sensor Network")
132
  graph_store = TripleStore()
133
  building_name = f"{data['buildings'][selected_index]['type']} ({selected_building_coords[0]}, {selected_building_coords[1]})"
134
 
135
- # Central node for the building - adding as both subject and object to ensure it appears in the graph
136
  for sensor in sensors:
137
  sensor_id = f"Sensor: {sensor}" # Label for sensor nodes
138
- # Add triple: each sensor node is connected to the central building node
139
- graph_store.add_triple(subject=building_name, predicate="has_sensor", object=sensor_id)
140
 
141
  # Configuration for the graph visualization
142
  agraph_config = Config(height=600, width=600, nodeHighlightBehavior=True, highlightColor="#F7A7A6", directed=True, collapsible=True)
143
 
144
  # Display the graph
145
- agraph(nodes=list(graph_store.getNodes()), edges=list(graph_store.getEdges()), config=agraph_config)
 
 
146
 
147
  """
148
 
 
126
  collapsible=True)
127
 
128
 
129
+
130
  if sensors: # Check if there are sensors to display
131
  st.header("Building Sensor Network")
132
  graph_store = TripleStore()
133
  building_name = f"{data['buildings'][selected_index]['type']} ({selected_building_coords[0]}, {selected_building_coords[1]})"
134
 
135
+ # Iterate through each sensor and create a triple linking it to the building
136
  for sensor in sensors:
137
  sensor_id = f"Sensor: {sensor}" # Label for sensor nodes
138
+ # Correctly add the triple without named arguments
139
+ graph_store.add_triple(building_name, "has_sensor", sensor_id)
140
 
141
  # Configuration for the graph visualization
142
  agraph_config = Config(height=600, width=600, nodeHighlightBehavior=True, highlightColor="#F7A7A6", directed=True, collapsible=True)
143
 
144
  # Display the graph
145
+ agraph(nodes=graph_store.getNodes(), edges=graph_store.getEdges(), config=agraph_config)
146
+
147
+
148
 
149
  """
150