-
Notifications
You must be signed in to change notification settings - Fork 88
Gradoop HBase Store
Christopher Rost edited this page Nov 1, 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 and 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 HBase configuration
HBaseConfiguration hbconfig = HBaseConfiguration.create();
// create store
HBaseEPGMStore graphStore = HBaseEPGMStoreFactory
.createOrOpenEPGMStore(hbconfig, config);
Now let's add some graph elements
graphStore.writeGraphHead(graphHead);
graphStore.wirteVertex(vertex);
graphStore.writeEdge(edge);
graphStore.flush();
Read data from store
// 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 to store
// 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}
----------*-------------*-----------------------*------------*-----------------------