You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by "WhiteHSBG (via GitHub)" <gi...@apache.org> on 2024/03/20 10:38:16 UTC
[I] 如何在代码里直接给顶点设置颜色呢? [incubator-hugegraph]
WhiteHSBG opened a new issue, #2489:
URL: https://github.com/apache/incubator-hugegraph/issues/2489
### Problem 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 (环境信息)
- Server Version: 1.0.0 (Apache Release Version)
- Backend: RocksDB x nodes, HDD or SSD
- OS: xx CPUs, xx G RAM, Ubuntu 2x.x / CentOS 7.x
- Data Size: xx vertices, xx edges <!-- (like 1000W 点, 9000W 边) -->
### Your Question (问题描述)
如何在定义顶点的时候直接给顶点设置颜色呢?
### Vertex/Edge example (问题点 / 边数据举例)
_No response_
### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
_No response_
--
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-unsubscribe@hugegraph.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] 如何在代码里直接给顶点设置颜色呢? [incubator-hugegraph]
Posted by "WhiteHSBG (via GitHub)" <gi...@apache.org>.
WhiteHSBG commented on issue #2489:
URL: https://github.com/apache/incubator-hugegraph/issues/2489#issuecomment-2009245895
麻烦说明一下,谢谢
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [I] 如何在代码里直接给顶点设置颜色呢? [incubator-hugegraph]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #2489:
URL: https://github.com/apache/incubator-hugegraph/issues/2489#issuecomment-2009254647
<!-- Answer -->
In Apache HugeGraph, you can set the color of a vertex by defining a property for the vertex that represents its color. This involves creating a `PropertyKey` for the color property and then setting this property on the vertex at the time of its creation.
Here is a conceptual example of how you might set a color property on a `HugeVertex` object, assuming a `PropertyKey` for color has already been defined in your graph schema:
```java
// Assuming 'graph' is your HugeGraph instance and 'tx' is your GraphTransaction instance
HugeVertex vertex = new HugeVertex(graph, IdGenerator.of("vertexId"), vertexLabel);
// Assuming the color property key is named "color" and you want to set it to "blue"
vertex.property("color", "blue");
// Add or update the vertex in the graph
tx.addVertex(vertex);
```
This example is conceptual and intended to illustrate how you might approach setting a color property on a vertex within the transactional context of your HugeGraph server. The exact implementation details, such as how you obtain or create the `HugeVertex` instance (`vertex` in the example), will depend on your application's logic and the specifics of how you manage transactions and vertex operations in your code.
Remember, the actual method calls and mechanisms for defining schema elements (like `PropertyKey`) and for adding or updating vertices might differ based on the version of HugeGraph you are using and the specifics of your application's architecture. Always refer to the official documentation and API guides of HugeGraph for the most accurate and up-to-date information.
For more details, you can refer to the source code of HugeGraph:
- [GraphTransaction.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java)
- [PropertyKey.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java)
- [HugeVertex.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java)
I hope this helps! If you have any more questions, feel free to ask.
-[Dosu](https://dosu.dev)
## Sources
- [hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java)
- [hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/PropertyKey.java)
- [hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java)
<!-- Dosu Comment Footer -->
<details open>
<summary>
#### About Dosu
</summary>
This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
</details>
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [I] 如何在代码里直接给顶点设置颜色呢? [incubator-hugegraph]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #2489:
URL: https://github.com/apache/incubator-hugegraph/issues/2489#issuecomment-2009242883
<!-- Greeting -->
你好,@WhiteHSBG!我是[Dosu](https://dosu.dev),一个在这里为你解决问题、回答问题并帮助你成为贡献者的机器人。我在等待人类维护者的同时,随时准备为你提供帮助。现在我来看看你的问题,并将很快给你一个完整的答案。
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org