Skip to content

Commit

Permalink
[release] version 0.4.2
Browse files Browse the repository at this point in the history
[release] version 0.4.2
  • Loading branch information
ChrizZz110 committed Oct 9, 2018
2 parents c5b3a66 + 825f281 commit 0e63e4b
Show file tree
Hide file tree
Showing 231 changed files with 7,046 additions and 3,821 deletions.
6 changes: 4 additions & 2 deletions README.md
@@ -1,6 +1,8 @@
[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)](https://www.apache.org/licenses/LICENSE-2.0)
[![Maven Central](https://img.shields.io/badge/Maven_Central-0.4.1-blue.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Cgradoop)
[![Maven Central](https://img.shields.io/badge/Maven_Central-0.4.2-blue.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Cgradoop)
[![Build Status](https://travis-ci.org/dbs-leipzig/gradoop.svg?branch=master)](https://travis-ci.org/dbs-leipzig/gradoop)
[![Code Quality: Java](https://img.shields.io/lgtm/grade/java/g/dbs-leipzig/gradoop.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/dbs-leipzig/gradoop/context:java)
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/dbs-leipzig/gradoop.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/dbs-leipzig/gradoop/alerts)

## Gradoop: Distributed Graph Analytics on Hadoop

Expand Down Expand Up @@ -108,7 +110,7 @@ Stable:
<dependency>
<groupId>org.gradoop</groupId>
<artifactId>gradoop-flink</artifactId>
<version>0.4.1</version>
<version>0.4.2</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion gradoop-checkstyle/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.gradoop</groupId>
<artifactId>gradoop-parent</artifactId>
<version>0.4.1</version>
<version>0.4.2</version>
</parent>

<artifactId>gradoop-checkstyle</artifactId>
Expand Down
9 changes: 8 additions & 1 deletion gradoop-common/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.gradoop</groupId>
<artifactId>gradoop-parent</artifactId>
<version>0.4.1</version>
<version>0.4.2</version>
</parent>

<artifactId>gradoop-common</artifactId>
Expand Down Expand Up @@ -165,5 +165,12 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

</dependencies>
</project>
Expand Up @@ -197,6 +197,15 @@ public static PropertyValue create(Object value) {
return new PropertyValue(value);
}

/**
* Creates a deep copy of the property value.
*
* @return property value
*/
public PropertyValue copy() {
return create(getObject());
}

//----------------------------------------------------------------------------
// Type checking
//----------------------------------------------------------------------------
Expand Down
Expand Up @@ -44,7 +44,7 @@ public final class GradoopConstants {
*/
public static final GradoopId DB_GRAPH_ID = GradoopId.fromString("598349bcda43031d1ea62d3b");
/**
* Default label of an EPGM database graph.
* Default label of an database graph.
*/
public static final String DB_GRAPH_LABEL = "_DB";
}
@@ -0,0 +1,149 @@
/*
* Copyright © 2014 - 2018 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.common.model.impl.pojo;

import org.gradoop.common.model.impl.id.GradoopId;
import org.gradoop.common.model.impl.properties.Properties;
import org.junit.Test;
import static org.gradoop.common.GradoopTestUtils.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.CALLS_REAL_METHODS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.withSettings;

public class ElementTest {

@Test
public void testSetId() {
Element elementMock = mock(Element.class, CALLS_REAL_METHODS);
GradoopId id = GradoopId.get();
elementMock.setId(id);

assertSame(id, elementMock.getId());
}

@Test
public void testSetProperty() {
Element elementMock = mock(Element.class, CALLS_REAL_METHODS);
elementMock.setProperty(KEY_0, STRING_VAL_6);

Properties properties = Properties.create();
properties.set(KEY_0, STRING_VAL_6);

assertEquals(elementMock.getProperties(), properties);
}

@Test(expected = NullPointerException.class)
public void testSetPropertyNull() {
Element elementMock = mock(Element.class, CALLS_REAL_METHODS);
elementMock.setProperty(null);
}

@Test
public void testRemoveExistentProperty() {
Properties properties = Properties.create();
properties.set(KEY_0, STRING_VAL_6);
GradoopId gradoopId = GradoopId.get();

// create element mock with property
Element elementMock = mock(Element.class, withSettings()
.useConstructor(gradoopId, "someLabel", properties)
.defaultAnswer(CALLS_REAL_METHODS));

assertEquals(properties.get(KEY_0), elementMock.removeProperty(KEY_0));
assertFalse(elementMock.hasProperty(KEY_0));
}

@Test
public void testRemovePropertyNoProperties() {
GradoopId gradoopId = GradoopId.get();

// create element mock without properties
Element elementMock = mock(Element.class, withSettings()
.useConstructor(gradoopId, "someLabel", null)
.defaultAnswer(CALLS_REAL_METHODS));

assertNull(elementMock.removeProperty(KEY_1));
}

@Test(expected = NullPointerException.class)
public void testGetPropertyValueNull() {
Properties properties = Properties.create();
properties.set(KEY_0, STRING_VAL_6);
GradoopId gradoopId = GradoopId.get();

// create element mock with property
Element elementMock = mock(Element.class, withSettings()
.useConstructor(gradoopId, "someLabel", properties)
.defaultAnswer(CALLS_REAL_METHODS));

elementMock.getPropertyValue(null);
}

@Test
public void testGetPropertyNoProperties() {
GradoopId gradoopId = GradoopId.get();

// create element mock without properties
Element elementMock = mock(Element.class, withSettings()
.useConstructor(gradoopId, "someLabel", null)
.defaultAnswer(CALLS_REAL_METHODS));

assertNull(elementMock.getPropertyValue(KEY_0));
}

@Test
public void testHasPropertyNoProperties() {
GradoopId gradoopId = GradoopId.get();

// create element mock without properties
Element elementMock = mock(Element.class, withSettings()
.useConstructor(gradoopId, "someLabel", null)
.defaultAnswer(CALLS_REAL_METHODS));

assertFalse(elementMock.hasProperty(KEY_0));
}

@Test
public void testGetPropertyKeysNoProperties() {
GradoopId gradoopId = GradoopId.get();

// create element mock without properties
Element elementMock = mock(Element.class, withSettings()
.useConstructor(gradoopId, "someLabel", null)
.defaultAnswer(CALLS_REAL_METHODS));

assertNull(elementMock.getPropertyKeys());
}

@Test
public void testGetPropertyKeys() {
Properties properties = Properties.create();
properties.set(KEY_0, STRING_VAL_6);
properties.set(KEY_1, INT_VAL_2);
properties.set(KEY_2, LONG_VAL_3);
GradoopId gradoopId = GradoopId.get();

// create element mock with property
Element elementMock = mock(Element.class, withSettings()
.useConstructor(gradoopId, "someLabel", properties)
.defaultAnswer(CALLS_REAL_METHODS));

for(String key : elementMock.getPropertyKeys()) {
assertTrue(key.equals(KEY_0) || key.equals(KEY_1) || key.equals(KEY_2));
}
}
}
@@ -0,0 +1,53 @@
/*
* Copyright © 2014 - 2018 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.common.model.impl.pojo;

import org.gradoop.common.model.impl.id.GradoopId;
import org.gradoop.common.model.impl.id.GradoopIdSet;
import org.gradoop.common.model.impl.properties.Properties;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.mockito.Mockito.CALLS_REAL_METHODS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.withSettings;

public class GraphElementTest {

@Test
public void testAddGraphIdNoGraphIds() {
GraphElement graphElementMock = mock(GraphElement.class, CALLS_REAL_METHODS);

GradoopId id = GradoopId.get();
graphElementMock.addGraphId(id);

assertNotNull(graphElementMock.getGraphIds());
}

@Test
public void testResetGraphIds() {
Properties propertiesMock = mock(Properties.class);
GradoopIdSet idSet = new GradoopIdSet();
idSet.add(GradoopId.get());

GraphElement graphElementMock = mock(GraphElement.class, withSettings()
.useConstructor(GradoopId.get(), "someLabel", propertiesMock, idSet)
.defaultAnswer(CALLS_REAL_METHODS));

graphElementMock.resetGraphIds();

assertTrue(graphElementMock.getGraphIds().isEmpty());
}
}
Expand Up @@ -98,7 +98,6 @@ public void testCreate() throws Exception {
PropertyValue p = create(null);
assertTrue(p.isNull());
assertNull(p.getObject());

// boolean
p = create(BOOL_VAL_1);
assertTrue(p.isBoolean());
Expand Down Expand Up @@ -161,6 +160,25 @@ public void testCreate() throws Exception {
assertEquals(SET_VAL_f, p.getSet());
}

/**
* Test copying the property value
*/
@Test
public void testCopy() {
// copy primitive value
PropertyValue p = create(BOOL_VAL_1);
PropertyValue copy = p.copy();
assertEquals(p, copy);
assertNotSame(p, copy);

// deep copy complex value
p = create(LIST_VAL_a);
copy = p.copy();
assertEquals(p, copy);
assertNotSame(p, copy);
assertNotSame(LIST_VAL_a, copy.getObject());
}

@Test
public void testSetAndGetObject() throws Exception {
PropertyValue p = new PropertyValue();
Expand Down
2 changes: 1 addition & 1 deletion gradoop-examples/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.gradoop</groupId>
<artifactId>gradoop-parent</artifactId>
<version>0.4.1</version>
<version>0.4.2</version>
</parent>

<artifactId>gradoop-examples</artifactId>
Expand Down
Expand Up @@ -27,11 +27,13 @@
import org.gradoop.flink.io.impl.csv.CSVDataSource;
import org.gradoop.flink.io.impl.csv.indexed.IndexedCSVDataSink;
import org.gradoop.flink.io.impl.csv.indexed.IndexedCSVDataSource;
import org.gradoop.flink.io.impl.json.JSONDataSink;
import org.gradoop.flink.io.impl.json.JSONDataSource;
import org.gradoop.flink.io.impl.deprecated.json.JSONDataSink;
import org.gradoop.flink.io.impl.deprecated.json.JSONDataSource;
import org.gradoop.flink.model.api.epgm.GraphCollection;
import org.gradoop.flink.model.api.epgm.LogicalGraph;
import org.gradoop.flink.util.GradoopFlinkConfig;
import org.gradoop.flink.io.impl.deprecated.logicalgraphcsv.LogicalGraphCSVDataSource;
import org.gradoop.flink.io.impl.deprecated.logicalgraphcsv.LogicalGraphIndexedCSVDataSource;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -222,6 +224,10 @@ private static DataSource getDataSource(String directory, String format) throws
return new CSVDataSource(directory, config);
case "indexed":
return new IndexedCSVDataSource(directory, config);
case "lgcsv":
return new LogicalGraphCSVDataSource(directory, config);
case "lgindexed":
return new LogicalGraphIndexedCSVDataSource(directory, config);
default:
throw new IllegalArgumentException("Unsupported format: " + format);
}
Expand Down
Expand Up @@ -78,18 +78,19 @@ public static void main(String[] args) throws Exception {
loader.initDatabaseFromFile(EXAMPLE_DATA_FILE);

// get LogicalGraph representation of the social network graph
LogicalGraph networkGraph = loader.getDatabase().getDatabaseGraph();
LogicalGraph networkGraph = loader.getLogicalGraph();

// execute aggregations and graph-head transformations
LogicalGraph result = networkGraph
// extract subgraph with edges and vertices which are of interest
.vertexInducedSubgraph(new ByLabel<>(LABEL_PERSON))
// apply custom VertexAggregateFunction
.aggregate(new AggregateListOfNames())
// aggregate sum of vertices in order to obtain total amount of persons
.aggregate(new VertexCount())
// sum up values of the vertex property "birthday"
.aggregate(new SumVertexProperty(PROPERTY_KEY_BIRTHDAY))
.aggregate(
new AggregateListOfNames(),
// aggregate sum of vertices in order to obtain total amount of persons
new VertexCount(),
// sum up values of the vertex property "birthday"
new SumVertexProperty(PROPERTY_KEY_BIRTHDAY))
// add computed property "meanAge" to the graph head
.transformGraphHead(new AddPropertyMeanAgeToGraphHead());

Expand Down
Expand Up @@ -18,8 +18,8 @@
import org.apache.flink.api.common.ProgramDescription;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.gradoop.examples.AbstractRunner;
import org.gradoop.flink.io.impl.json.JSONDataSink;
import org.gradoop.flink.io.impl.json.JSONDataSource;
import org.gradoop.flink.io.impl.deprecated.json.JSONDataSink;
import org.gradoop.flink.io.impl.deprecated.json.JSONDataSource;
import org.gradoop.flink.model.api.epgm.GraphCollection;
import org.gradoop.flink.model.api.epgm.LogicalGraph;
import org.gradoop.flink.model.impl.operators.combination.ReduceCombination;
Expand Down Expand Up @@ -64,7 +64,7 @@
* }
*
* An example graph collection can be found under src/main/resources/data.json.
* For further information, have a look at the {@link org.gradoop.flink.io.impl.json}
* For further information, have a look at the {@link org.gradoop.flink.io.impl.deprecated.json}
* package.
*/
public class JSONExample extends AbstractRunner implements ProgramDescription {
Expand Down

0 comments on commit 0e63e4b

Please sign in to comment.