我不得不使用JanusGraph从java程序中检索并添加数据.但我不知道如何连接到db.Below的特定图形是我用于在数据库中插入数据的代码但是当我尝试从gremlin控制台看到数据时,我找不到相同的数据.
JanusGraph graph = JanusGraphFactory.open("conf/janusgraph-cassandra-es.properties");
GraphTraversalSource g = graph.traversal();
graph.addVertex("psid",psid,"firstname",firstname,"last_name",lastname, "locale", locale ,"timezone",timezone, "gender" ,gender,"channel_id",channel_id);
Run Code Online (Sandbox Code Playgroud)
我正在做的Gremlin查询:
gremlin> JanusGraph graph = JanusGraphFactory.open("conf/janusgraph-cassandra-es.properties");
gremlin> GraphTraversalSource g = graph.traversal();
gremlin> g.V().count()
Run Code Online (Sandbox Code Playgroud)
count query给出0作为输出,我在db中找不到任何数据.
我有一个如下的反应代码,它基本上创建了一个树形图:
class ChartModal extends Component{
constructor(props){
super(props)
}
callApi(){
fetch(someurl)
.then((result) => {
return result.json();
}).then((jsonResult) => {
console.log(jsonResult);
})
}
render(){
return(
<Modal
onOk={() => this.props.toggleVisibility()}
onCancel={() => this.props.toggleVisibility()}
visible={this.props.isVisible}
okText={'ok'}
cancelText={'cancel'}
confirmLoading={false}
title="Intent distribution chart"
>
<h1>HOWDY</h1>
<TreeMap
data = {this.callApi()}//this is where i want the data returned by apicall
width={400}
valueUnit={'count'}
/>
</Modal>
)
}
}
Run Code Online (Sandbox Code Playgroud)
现在我希望 api 调用返回的数据在组件内部使用tree map,但我现在的方式似乎不起作用。当我运行这个时,尽管我希望返回的数据存在,但tree map结果为空。jsonapi call