Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1303] Move GraphCollection operators to BaseGraphCollection #1316

Merged
merged 32 commits into from Aug 9, 2019
Merged
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9fc1f99
[#1303] Move Limit
timo95 Jun 11, 2019
037be74
[#1303] Move set operators
timo95 Jun 11, 2019
991bba6
[#1303] Move equals
timo95 Jun 11, 2019
91d2c00
Merge branch 'develop' into 1303-gcoperators
timo95 Jun 12, 2019
73662e7
[#1303] Move reduce and its operators
timo95 Jun 12, 2019
cd3ce6b
[#1303] Move selection and distinct based operators
timo95 Jun 18, 2019
4e01a1e
[#1303] Move pattern matching
timo95 Jun 18, 2019
09798b6
[#1303] Remove not implemented sortBy
timo95 Jun 18, 2019
f4bd090
[#1303] Move graph getters
timo95 Jun 18, 2019
28641c9
[#1303] Fix style
timo95 Jun 18, 2019
e2e924a
Merge branch 'develop' into 1303-gcoperators
timo95 Jun 25, 2019
da4a105
Merge branch 'develop' into 1303-gcoperators
timo95 Jun 25, 2019
359633a
Merge branch 'develop' into 1303-gcoperators
timo95 Jun 26, 2019
e82902c
[#1303] Generify Apply
timo95 Jun 26, 2019
4af2d87
Merge branch 'develop' into 1303-gcoperators
timo95 Jul 2, 2019
cdcba66
[#1303] Improve style
timo95 Jul 2, 2019
5db2ac4
[#1303] Improve style
timo95 Jul 2, 2019
5feda92
Merge branch 'develop' into 1303-gcoperators
timo95 Jul 4, 2019
c32eced
Merge branch 'develop' into 1303-gcoperators
timo95 Jul 19, 2019
599d089
Merge branch 'develop' into 1303-gcoperators
timo95 Jul 23, 2019
da70442
Merge branch 'develop' into 1303-gcoperators
timo95 Jul 23, 2019
8207826
Merge branch 'develop' into 1303-gcoperators
timo95 Aug 6, 2019
89dc962
[#1303] Fix PR comments
timo95 Aug 6, 2019
bdc9bf5
Merge branch '1303-gcoperators' of github.com:timo95/gradoop into 130…
timo95 Aug 6, 2019
a270b35
[#1303] Change Javadoc
timo95 Aug 6, 2019
86b8430
[#1303] Change Javadoc
timo95 Aug 6, 2019
93e3979
[#1303] Fix PR comments
timo95 Aug 8, 2019
f2f881f
[#1303] Fix PR comments
timo95 Aug 8, 2019
2e57fab
Remove link
timo95 Aug 8, 2019
3589766
[#1303] Check type in constructor
timo95 Aug 8, 2019
b899c4c
Merge branch '1303-gcoperators' of github.com:timo95/gradoop into 130…
timo95 Aug 8, 2019
6ef89e4
Merge branch 'develop' into 1303-gcoperators
timo95 Aug 8, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -84,7 +84,7 @@ public IndexedCSVDataSource(String csvPath, GradoopFlinkConfig conf, Configurati

@Override
public LogicalGraph getLogicalGraph() throws IOException {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -71,7 +71,7 @@ public JSONDataSource(String graphHeadPath, String vertexPath,

@Override
public LogicalGraph getLogicalGraph() {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -78,7 +78,7 @@ public EdgeListDataSource(String edgeListPath, String tokenSeparator,

@Override
public LogicalGraph getLogicalGraph() throws IOException {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -76,7 +76,7 @@ public VertexLabeledEdgeListDataSource(String edgeListPath, String tokenSeparato

@Override
public LogicalGraph getLogicalGraph() throws IOException {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -90,7 +90,7 @@ public TLFDataSource(String tlfPath, String tlfVertexDictionaryPath,

@Override
public LogicalGraph getLogicalGraph() throws IOException {
return getGraphCollection().reduce(new ReduceCombination());
return getGraphCollection().reduce(new ReduceCombination<>());
}

@Override
@@ -15,12 +15,21 @@
*/
package org.gradoop.flink.model.api.epgm;

import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.api.java.DataSet;
import org.gradoop.common.model.api.entities.Edge;
import org.gradoop.common.model.api.entities.GraphHead;
import org.gradoop.common.model.api.entities.Vertex;
import org.gradoop.common.model.impl.id.GradoopId;
import org.gradoop.common.model.impl.id.GradoopIdSet;
import org.gradoop.flink.model.api.layouts.GraphCollectionLayout;
import org.gradoop.flink.model.impl.functions.epgm.BySameId;
import org.gradoop.flink.model.impl.functions.graphcontainment.InAnyGraph;
import org.gradoop.flink.model.impl.functions.graphcontainment.InGraph;
import org.gradoop.flink.util.GradoopFlinkConfig;

import java.util.Arrays;

/**
* Default interface of a graph collection instance.
*
@@ -37,6 +46,7 @@
LG extends BaseGraph<G, V, E, LG, GC>,
GC extends BaseGraphCollection<G, V, E, LG, GC>>
extends GraphCollectionLayout<G, V, E>, BaseGraphCollectionOperators<G, V, E, LG, GC> {

/**
* Returns the Gradoop Flink configuration.
*
@@ -57,4 +67,45 @@
* @return a factory that can be used to create a {@link LG} instance
*/
BaseGraphFactory<G, V, E, LG, GC> getGraphFactory();

//----------------------------------------------------------------------------
// Base Graph / Graph Head Getters
//----------------------------------------------------------------------------

@Override
default LG getGraph(final GradoopId graphID) {
// filter vertices and edges based on given graph id
DataSet<G> graphHead = getGraphHeads()
.filter(new BySameId<>(graphID));
DataSet<V> vertices = getVertices()
.filter(new InGraph<>(graphID));
DataSet<E> edges = getEdges()
.filter(new InGraph<>(graphID));

return getGraphFactory().fromDataSets(graphHead, vertices, edges);
}

@Override
default GC getGraphs(final GradoopId... identifiers) {
GradoopIdSet graphIds = new GradoopIdSet();
graphIds.addAll(Arrays.asList(identifiers));
This conversation was marked as resolved by timo95

This comment has been minimized.

Copy link
@p-f

p-f Aug 8, 2019

Collaborator

You can replace this with GradoopIdSet graphIds = GradoopIdSet.fromExisting(identifiers);
Or maybe not use a variable at all, like getGraphs(fromExisting(identifiers));


return getGraphs(graphIds);
}

@Override
default GC getGraphs(final GradoopIdSet identifiers) {
DataSet<G> newGraphHeads = this.getGraphHeads()
.filter((FilterFunction<G>) graphHead -> identifiers.contains(graphHead.getId()));

// build new vertex set
DataSet<V> vertices = getVertices()
.filter(new InAnyGraph<>(identifiers));

// build new edge set
DataSet<E> edges = getEdges()
.filter(new InAnyGraph<>(identifiers));

return getFactory().fromDataSets(newGraphHeads, vertices, edges);
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.