Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fixes #1270
- Loading branch information
1 parent
0bbeddc
commit 69c67b0
Showing
174 changed files
with
800 additions
and
9,912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>gradoop-examples</artifactId> | ||
<groupId>org.gradoop</groupId> | ||
<version>0.5.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>gradoop-examples-operators</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Gradoop Examples Operators</name> | ||
<description>Contains examples for a subset of Gradoop operators.</description> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.gradoop</groupId> | ||
<artifactId>gradoop-flink</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.gradoop</groupId> | ||
<artifactId>gradoop-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.gradoop</groupId> | ||
<artifactId>gradoop-data-integration</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.github.spotbugs</groupId> | ||
<artifactId>spotbugs-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<minimizeJar>true</minimizeJar> | ||
<artifactSet> | ||
<includes> | ||
<!-- gradoop dependencies --> | ||
<include>org.gradoop:gradoop-flink</include> | ||
<include>org.gradoop:gradoop-common</include> | ||
<include>org.gradoop:gradoop-data-integration</include> | ||
<!-- libs that are not provided by flink binary --> | ||
<include>org.apache.flink:flink-gelly_2.11</include> | ||
<include>org.apache.flink:flink-java</include> | ||
<!-- others --> | ||
<include>org.apache.hbase:hbase-common</include> | ||
<include>com.github.s1ck:gdl</include> | ||
<include>org.antlr:antlr4-runtime</include> | ||
<include>me.lemire.integercompression:*</include> | ||
<!-- capf example dependencies --> | ||
<include>org.opencypher:*</include> | ||
<include>org.apache.flink:flink-table_2.11</include> | ||
<include>org.parboiled:parboiled-scala_2.11</include> | ||
<include>com.lihaoyi:ujson_2.11</include> | ||
<include>com.lihaoyi:upickle_2.11</include> | ||
<include>org.typelevel:cats-kernel_2.11</include> | ||
<include>org.typelevel:cats-core_2.11</include> | ||
<include>org.atnos:eff_2.11</include> | ||
<include>org.parboiled:*</include> | ||
</includes> | ||
</artifactSet> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
68 changes: 68 additions & 0 deletions
68
...doop-examples-operators/src/main/java/org/gradoop/examples/common/SocialNetworkGraph.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright © 2014 - 2019 Leipzig University (Database Research Group) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.gradoop.examples.common; | ||
|
||
/** | ||
* Class to provide a example graph used by gradoop examples. | ||
*/ | ||
public class SocialNetworkGraph { | ||
|
||
/** | ||
* Private Constructor | ||
*/ | ||
private SocialNetworkGraph() { } | ||
|
||
/** | ||
* Returns the SNA Graph as GDL String. | ||
* | ||
* @return gdl string of sna graph | ||
*/ | ||
public static String getGraphGDLString() { | ||
|
||
return | ||
"db[" + | ||
"(databases:tag {name:\"Databases\"})" + | ||
"(graphs:Tag {name:\"Graphs\"})" + | ||
"(hadoop:Tag {name:\"Hadoop\"})" + | ||
"(gdbs:Forum {title:\"Graph Databases\"})" + | ||
"(gps:Forum {title:\"Graph Processing\"})" + | ||
"(alice:Person {name:\"Alice\", gender:\"f\", city:\"Leipzig\", birthday:20})" + | ||
"(bob:Person {name:\"Bob\", gender:\"m\", city:\"Leipzig\", birthday:30})" + | ||
"(carol:Person {name:\"Carol\", gender:\"f\", city:\"Dresden\", birthday:30})" + | ||
"(dave:Person {name:\"Dave\", gender:\"m\", city:\"Dresden\", birthday:40})" + | ||
"(eve:Person {name:\"Eve\", gender:\"f\", city:\"Dresden\", speaks:\"English\", birthday:35})" + | ||
"(frank:Person {name:\"Frank\", gender:\"m\", city:\"Berlin\", locIP:\"127.0.0.1\", birthday:35})" + | ||
"" + | ||
"(eve)-[:hasInterest]->(databases)" + | ||
"(alice)-[:hasInterest]->(databases)" + | ||
"(frank)-[:hasInterest]->(hadoop)" + | ||
"(dave)-[:hasInterest]->(hadoop)" + | ||
"(gdbs)-[:hasModerator]->(alice)" + | ||
"(gdbs)-[:hasMember]->(alice)" + | ||
"(gdbs)-[:hasMember]->(bob)" + | ||
"(gps)-[:hasModerator {since:2013}]->(dave)" + | ||
"(gps)-[:hasMember]->(dave)" + | ||
"(gps)-[:hasMember]->(carol)-[ckd]->(dave)" + | ||
"(databases)<-[ghtd:hasTag]-(gdbs)-[ghtg1:hasTag]->(graphs)<-[ghtg2:hasTag]-(gps)-[ghth:hasTag]->(hadoop)" + | ||
"(eve)-[eka:knows {since:2013}]->(alice)-[akb:knows {since:2014}]->(bob)" + | ||
"(eve)-[ekb:knows {since:2015}]->(bob)-[bka:knows {since:2014}]->(alice)" + | ||
"(frank)-[fkc:knows {since:2015}]->(carol)-[ckd:knows {since:2014}]->(dave)" + | ||
"(frank)-[fkd:knows {since:2015}]->(dave)-[dkc:knows {since:2014}]->(carol)" + | ||
"(alice)-[akb]->(bob)-[bkc:knows {since:2013}]->(carol)-[ckd]->(dave)" + | ||
"(alice)<-[bka]-(bob)<-[ckb:knows {since:2013}]-(carol)<-[dkc]-(dave)" + | ||
"]"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...les-operators/src/main/java/org/gradoop/examples/communities/GellyCommunitiesExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright © 2014 - 2019 Leipzig University (Database Research Group) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.gradoop.examples.communities; | ||
|
||
import org.apache.flink.api.java.ExecutionEnvironment; | ||
import org.gradoop.examples.common.SocialNetworkGraph; | ||
import org.gradoop.flink.algorithms.gelly.labelpropagation.GellyLabelPropagation; | ||
import org.gradoop.flink.model.impl.epgm.LogicalGraph; | ||
import org.gradoop.flink.util.FlinkAsciiGraphLoader; | ||
import org.gradoop.flink.util.GradoopFlinkConfig; | ||
|
||
/** | ||
* A self contained example on how to use the {@link GellyLabelPropagation} operator. | ||
* | ||
* The example uses the graph in dev-support/social-network.pdf | ||
*/ | ||
public class GellyCommunitiesExample { | ||
|
||
/** | ||
* Runs the program on the example data graph. | ||
* | ||
* The example provides an overview over the usage of the {@link GellyLabelPropagation} Operator. | ||
* Documentation for all available gelly based operators can be found in the projects wiki. | ||
* | ||
* Using the social network graph {@link SocialNetworkGraph}, the program will: | ||
* <ol> | ||
* <li>create the logical graph from the social network gdl string</li> | ||
* <li>prepare the initial community id by using a transformation function on each vertex</li> | ||
* <li>calculate the communities using label propagation</li> | ||
* <li>print the results</li> | ||
* </ol> | ||
* | ||
* @param args arguments | ||
* @see <a href="https://github.com/dbs-leipzig/gradoop/wiki/Unary-Logical-Graph-Operators"> | ||
* Gradoop Wiki</a> | ||
* @throws Exception if something goes wrong | ||
*/ | ||
public static void main(String[] args) throws Exception { | ||
|
||
// create flink execution environment | ||
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); | ||
|
||
// create loader | ||
FlinkAsciiGraphLoader loader = new FlinkAsciiGraphLoader(GradoopFlinkConfig.createConfig(env)); | ||
|
||
// load data | ||
loader.initDatabaseFromString(SocialNetworkGraph.getGraphGDLString()); | ||
|
||
// property key used for label propagation | ||
final String communityKey = "comm_id"; | ||
|
||
// load the graph and set initial community id | ||
LogicalGraph graph = loader.getLogicalGraph(); | ||
graph = graph.transformVertices((current, transformed) -> { | ||
current.setProperty(communityKey, current.getId()); | ||
return current; | ||
}); | ||
|
||
// apply label propagation to compute communities | ||
graph = graph.callForGraph(new GellyLabelPropagation(5, communityKey)); | ||
|
||
// print results | ||
graph.print(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.