-
Notifications
You must be signed in to change notification settings - Fork 88
Gradoop HBase Store
手不要乱摸 edited this page Aug 5, 2018
·
4 revisions
Apache HBase Apache HBase™ is the Hadoop database, a distributed, scalable, big data store.
With this adapter implementation you can use Apache HBase as DataSource or DataSink for your graph data.
Compile gradoop hbase with
mvn clean install -DskipTests=true
Copy gradoop-store/gradoop-hbase/target/gradoop-hbase-<ver>.jar into your client lib.
Or you can simply use maven pom as below:
<!-- Maven Gradoop HBase -->
<dependency>
<groupId>org.gradoop</groupId>
<artifactId>gradoop-hbase</artifactId>
<version>${gradoop.version}</version>
</dependency>
// create gradoop HBase configuration
GradoopHBaseConfig config = GradoopHBaseConfig.getDefaultConfig();
// create store
HBaseEPGMStore graphStore = new HBaseEPGMStore(config);
let's just add some graph elements
graphStore.writeGraphHead(graphHead);
graphStore.wirteVertex(vertex);
graphStore.writeEdge(edge);
graphStore.flush();
Read data from store with flink
// data source
GradoopFlinkConfig flinkConfig = GradoopFlinkConfig.createConfig(getExecutionEnvironment());
DataSource hbaseDataSource = new HBaseDataSource(graphStore, flinkConfig);
GraphCollection result = HBaseDataSource.cypher(
"MATCH (u1:Person)<-[:hasModerator]-(f:Forum)" +
"(u2:Person)<-[:hasMember]-(f)" +
"WHERE u1.name = \"Alice\"");
Write data from store with flink
// data sink
GradoopFlinkConfig flinkConfig = GradoopFlinkConfig.createConfig(getExecutionEnvironment());
DataSink HBaseSink = new HBaseDataSink(graphStore, flinkConfig);
HBaseSink.write(result);
GraphData (table 'graph_heads')
----------*-------------*-------------------------*---------------*-----------------------
row | cf | cq | timestamp | value
----------*-------------*-------------------------*---------------*-----------------------
| m | l | | {label}
{id} *-------------*-------------------------*---------------*-----------------------
| p_type | {property key} | | {property type byte}
*-------------*-------------------------*---------------*-----------------------
| p_value | {property key} | | {property value}
----------*-------------*-------------------------*---------------*-----------------------
VertexData (table 'vertices')
----------*-------------*-------------------------*---------------*-----------------------
row | cf | cq | timestamp | value
----------*-------------*-------------------------*---------------*-----------------------
| m | l | | {label}
{id} *-------------*-------------------------*---------------*-----------------------
| m | g | | {graph id}
*-------------*-------------------------*---------------*-----------------------
| p_type | {property key} | | {property type byte}
*-------------*-------------------------*---------------*-----------------------
| p_value | {property key} | | {property value}
----------*-------------*-------------------------*---------------*-----------------------
EdgeData (table 'edges')
----------*-------------*-------------------------*---------------*-----------------------
row | cf | cq | timestamp | value
----------*-------------*-------------------------*---------------*-----------------------
| m | l | | {label}
*-------------*-------------------------*---------------*-----------------------
| m | g | | {graph id}
{id} *-------------*-------------------------*---------------*-----------------------
| m | s | | {source vertex id}
*-------------*-------------------------*---------------*-----------------------
| m | t | | {varget vertex id}
*-------------*-------------------------*---------------*-----------------------
| p_type | {property key} | | {property type byte}
*-------------*-------------------------*---------------*-----------------------
| p_value | {property key} | | {property value}
----------*-------------*-------------------------*---------------*-----------------------
