hezhangjian opened a new issue, #2828:
URL: https://github.com/apache/incubator-hugegraph/issues/2828

   ### Bug Type (问题类型)
   
   None
   
   ### Before submit
   
   - [x] 我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与 
[FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have 
confirmed and searched that there are no similar problems in the historical 
issue and documents)
   
   ### Environment (环境信息)
   
   docker run --name=graph -p 8080:8080 hugegraph/hugegraph:1.5.0
   
   ### Expected & Actual behavior (期望与实际表现)
   
   期望Demo运行成功,结果
   
   ```python
   import requests
   
   GRAPH = "hugegraph"
   HOST = "http://localhost:8080";
   BASE = f"{HOST}/graphs/{GRAPH}"
   HEADERS = {"Content-Type": "application/json"}
   
   def create_property_key(name, data_type="TEXT"):
       return requests.post(
           f"{BASE}/schema/propertykeys",
           headers=HEADERS,
           json={"name": name, "data_type": data_type, "cardinality": "SINGLE"},
       ).json()
   
   def create_vertex_label(name, props):
       return requests.post(
           f"{BASE}/schema/vertexlabels",
           headers=HEADERS,
           json={"name": name, "properties": props, "primary_keys": [props[0]]},
       ).json()
   
   def add_vertex(label, props):
       return requests.post(
           f"{BASE}/vertices",
           headers=HEADERS,
           json={"label": label, "properties": props},
       ).json()
   
   def get_vertices_by_label(label):
       return requests.get(
           f"{BASE}/vertices?label={label}",
           headers=HEADERS
       ).json()
   
   def main():
       print("🔧 Creating schema...")
       print("Creating property key: name")
       print(create_property_key("name"))
       print("Creating property key: type")
       print(create_property_key("type"))
       print("Creating vertex label: device")
       print(create_vertex_label("device", ["name", "type"]))
   
       print("\n📦 Adding device vertex...")
       device = add_vertex("device", {"name": "贴片机1", "type": "chip-mounter"})
       print(device)
   
       print("\n🔍 Querying all device vertices...")
       devices = get_vertices_by_label("device")
       print(devices)
   
   if __name__ == "__main__":
       main()
   ```
   
   ```
   /Users/akka/dev/pyenv/bin/python /Users/akka/code/morn/morn-agent/graph.py 
   🔧 Creating schema...
   Creating property key: name
   {'exception': 'class org.apache.hugegraph.exception.ExistedException', 
'message': "The property key 'name' has existed", 'cause': ''}
   Creating property key: type
   {'exception': 'class org.apache.hugegraph.exception.ExistedException', 
'message': "The property key 'type' has existed", 'cause': ''}
   Creating vertex label: device
   {'exception': 'class org.apache.hugegraph.exception.ExistedException', 
'message': "The vertex label 'device' has existed", 'cause': ''}
   
   📦 Adding device vertex...
   {'exception': 'class jakarta.ws.rs.NotFoundException', 'message': 'HTTP 404 
Not Found', 'cause': ''}
   
   🔍 Querying all device vertices...
   {'exception': 'class jakarta.ws.rs.NotFoundException', 'message': 'HTTP 404 
Not Found', 'cause': ''}
   
   Process finished with exit code 0
   ```
   
   ### Vertex/Edge example (问题点 / 边数据举例)
   
   ```javascript
   
   ```
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   ```javascript
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hugegraph.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to