Skip to content

Commit

Permalink
Merge pull request #8392 from lassewesth/ihatebaseproc
Browse files Browse the repository at this point in the history
reducing usage of BaseProc
  • Loading branch information
lassewesth authored Nov 14, 2023
2 parents 275976e + db822de commit 95a5591
Show file tree
Hide file tree
Showing 65 changed files with 219 additions and 230 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.betweenness;

import org.neo4j.gds.BaseProc;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.centrality.CentralityMutateResult;
import org.neo4j.gds.results.MemoryEstimateResult;
Expand All @@ -31,16 +30,16 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.betweenness.BetweennessCentrality.BETWEENNESS_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class BetweennessCentralityMutateProc extends BaseProc {

public class BetweennessCentralityMutateProc {
@Context
public GraphDataScience facade;


@Procedure(value = "gds.betweenness.mutate", mode = READ)
@Description(BetweennessCentrality.BETWEENNESS_DESCRIPTION)
@Description(BETWEENNESS_DESCRIPTION)
public Stream<CentralityMutateResult> mutate(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand All @@ -49,12 +48,11 @@ public Stream<CentralityMutateResult> mutate(
}

@Procedure(value = "gds.betweenness.mutate.estimate", mode = READ)
@Description(BetweennessCentrality.BETWEENNESS_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
) {
return facade.centrality().betweenessCentralityMutateEstimate(graphNameOrConfiguration, algoConfiguration);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.betweenness;

import org.neo4j.gds.BaseProc;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.centrality.CentralityStatsResult;
import org.neo4j.gds.results.MemoryEstimateResult;
Expand All @@ -31,16 +30,16 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.betweenness.BetweennessCentrality.BETWEENNESS_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.STATS_MODE_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class BetweennessCentralityStatsProc extends BaseProc {

public class BetweennessCentralityStatsProc {
@Context
public GraphDataScience facade;

@Procedure(value = "gds.betweenness.stats", mode = READ)
@Description(BETWEENNESS_DESCRIPTION)
@Description(STATS_MODE_DESCRIPTION)
public Stream<CentralityStatsResult> stats(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand All @@ -49,12 +48,11 @@ public Stream<CentralityStatsResult> stats(
}

@Procedure(value = "gds.betweenness.stats.estimate", mode = READ)
@Description(BETWEENNESS_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
) {
return facade.centrality().betweenessCentralityStatsEstimate(graphNameOrConfiguration, algoConfiguration);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.betweenness;

import org.neo4j.gds.BaseProc;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.centrality.CentralityStreamResult;
import org.neo4j.gds.results.MemoryEstimateResult;
Expand All @@ -32,10 +31,10 @@
import java.util.stream.Stream;

import static org.neo4j.gds.betweenness.BetweennessCentrality.BETWEENNESS_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class BetweennessCentralityStreamProc extends BaseProc {

public class BetweennessCentralityStreamProc {
@Context
public GraphDataScience facade;

Expand All @@ -49,7 +48,7 @@ public Stream<CentralityStreamResult> stream(
}

@Procedure(value = "gds.betweenness.stream.estimate", mode = READ)
@Description(BETWEENNESS_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.betweenness;

import org.neo4j.gds.BaseProc;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.centrality.CentralityWriteResult;
import org.neo4j.gds.results.MemoryEstimateResult;
Expand All @@ -32,11 +31,11 @@
import java.util.stream.Stream;

import static org.neo4j.gds.betweenness.BetweennessCentrality.BETWEENNESS_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;
import static org.neo4j.procedure.Mode.WRITE;

public class BetweennessCentralityWriteProc extends BaseProc {

public class BetweennessCentralityWriteProc {
@Context
public GraphDataScience facade;

Expand All @@ -50,12 +49,11 @@ public Stream<CentralityWriteResult> write(
}

@Procedure(value = "gds.betweenness.write.estimate", mode = READ)
@Description(BETWEENNESS_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
) {
return facade.centrality().betweenessCentralityWriteEstimate(graphNameOrConfiguration, algoConfiguration);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.approxmaxkcut;

import org.neo4j.gds.BaseProc;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.community.approxmaxkcut.ApproxMaxKCutStreamResult;
import org.neo4j.gds.results.MemoryEstimateResult;
Expand All @@ -33,12 +32,13 @@
import java.util.stream.Stream;

import static org.neo4j.gds.approxmaxkcut.ApproxMaxKCut.APPROX_MAX_K_CUT_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class ApproxMaxKCutStreamProc extends BaseProc {

public class ApproxMaxKCutStreamProc {
@Context
public GraphDataScience facade;

@Procedure(value = "gds.maxkcut.stream", mode = READ)
@Description(APPROX_MAX_K_CUT_DESCRIPTION)
public Stream<ApproxMaxKCutStreamResult> stream(
Expand All @@ -49,7 +49,7 @@ public Stream<ApproxMaxKCutStreamResult> stream(
}

@Procedure(value = "gds.maxkcut.stream.estimate", mode = READ)
@Description(APPROX_MAX_K_CUT_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
Expand All @@ -75,7 +75,7 @@ public Stream<ApproxMaxKCutStreamResult> streamAlpha(
@Deprecated
@Internal
@Procedure(value = "gds.alpha.maxkcut.stream.estimate", mode = READ, deprecatedBy = "gds.maxcut.stream.estimate")
@Description(APPROX_MAX_K_CUT_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimateAlpha(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
Expand All @@ -85,5 +85,4 @@ public Stream<MemoryEstimateResult> estimateAlpha(
.warn("Procedure `gds.alpha.maxkcut.stream.estimate` has been deprecated, please use `gds.maxkcut.stream.estimate`.");
return estimate(graphNameOrConfiguration, algoConfiguration);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.stream.Stream;

import static org.neo4j.gds.k1coloring.K1ColoringSpecificationHelper.K1_COLORING_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class K1ColoringMutateProc extends BaseProc {
Expand All @@ -50,7 +51,7 @@ public Stream<K1ColoringMutateResult> mutate(
}

@Procedure(value = "gds.k1coloring.mutate.estimate", mode = READ)
@Description(ESTIMATE_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.stream.Stream;

import static org.neo4j.gds.k1coloring.K1ColoringSpecificationHelper.K1_COLORING_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class K1ColoringStatsProc extends BaseProc {
Expand All @@ -50,7 +51,7 @@ public Stream<K1ColoringStatsResult> stats(
}

@Procedure(value = "gds.k1coloring.stats.estimate", mode = READ)
@Description(ESTIMATE_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
import java.util.stream.Stream;

import static org.neo4j.gds.k1coloring.K1ColoringSpecificationHelper.K1_COLORING_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class K1ColoringStreamProc extends BaseProc {

@Context
public GraphDataScience facade;

@Procedure(name = "gds.k1coloring.stream", mode = READ)
@Description(K1_COLORING_DESCRIPTION)
public Stream<K1ColoringStreamResult> stream(
Expand All @@ -49,7 +51,7 @@ public Stream<K1ColoringStreamResult> stream(
}

@Procedure(value = "gds.k1coloring.stream.estimate", mode = READ)
@Description(ESTIMATE_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
Expand All @@ -73,7 +75,7 @@ public Stream<K1ColoringStreamResult> betaStream(
}

@Procedure(value = "gds.beta.k1coloring.stream.estimate", mode = READ, deprecatedBy = "gds.k1coloring.stream.estimate")
@Description(ESTIMATE_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
@Internal
@Deprecated(forRemoval = true)
public Stream<MemoryEstimateResult> betaEstimate(
Expand All @@ -86,6 +88,4 @@ public Stream<MemoryEstimateResult> betaEstimate(
"Procedure `gds.beta.k1coloring.stream.estimate` has been deprecated, please use `gds.k1coloring.stream.estimate`.");
return estimate(graphNameOrConfiguration,algoConfiguration);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.stream.Stream;

import static org.neo4j.gds.k1coloring.K1ColoringSpecificationHelper.K1_COLORING_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;
import static org.neo4j.procedure.Mode.WRITE;

Expand All @@ -51,7 +52,7 @@ public Stream<K1ColoringWriteResult> write(
}

@Procedure(value = "gds.k1coloring.write.estimate", mode = READ)
@Description(ESTIMATE_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.kcore;

import org.neo4j.gds.BaseProc;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.community.kcore.KCoreDecompositionMutateResult;
import org.neo4j.gds.results.MemoryEstimateResult;
Expand All @@ -32,12 +31,13 @@
import java.util.stream.Stream;

import static org.neo4j.gds.kcore.KCoreDecomposition.KCORE_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class KCoreDecompositionMutateProc extends BaseProc {

public class KCoreDecompositionMutateProc {
@Context
public GraphDataScience facade;

@Procedure(value = "gds.kcore.mutate", mode = READ)
@Description(KCORE_DESCRIPTION)
public Stream<KCoreDecompositionMutateResult> mutate(
Expand All @@ -48,12 +48,11 @@ public Stream<KCoreDecompositionMutateResult> mutate(
}

@Procedure(value = "gds.kcore.mutate.estimate", mode = READ)
@Description(KCORE_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
) {
return facade.community().kCoreEstimateMutate(graphNameOrConfiguration, algoConfiguration);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.kcore;

import org.neo4j.gds.BaseProc;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.community.kcore.KCoreDecompositionStatsResult;
import org.neo4j.gds.results.MemoryEstimateResult;
Expand All @@ -34,9 +33,10 @@
import static org.neo4j.gds.kcore.KCoreDecomposition.KCORE_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class KCoreDecompositionStatsProc extends BaseProc {
public class KCoreDecompositionStatsProc {
@Context
public GraphDataScience facade;

@Procedure(value = "gds.kcore.stats", mode = READ)
@Description(KCORE_DESCRIPTION)
public Stream<KCoreDecompositionStatsResult> mutate(
Expand All @@ -46,15 +46,12 @@ public Stream<KCoreDecompositionStatsResult> mutate(
return facade.community().kCoreStats(graphName, configuration);
}


@Procedure(value = "gds.kcore.stats.estimate", mode = READ)
@Description(KCORE_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
) {
return facade.community().kCoreEstimateStats(graphNameOrConfiguration, algoConfiguration);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.kcore;

import org.neo4j.gds.BaseProc;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.community.kcore.KCoreDecompositionStreamResult;
import org.neo4j.gds.results.MemoryEstimateResult;
Expand All @@ -32,9 +31,10 @@
import java.util.stream.Stream;

import static org.neo4j.gds.kcore.KCoreDecomposition.KCORE_DESCRIPTION;
import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class KCoreDecompositionStreamProc extends BaseProc {
public class KCoreDecompositionStreamProc {
@Context
public GraphDataScience facade;

Expand All @@ -47,13 +47,11 @@ public Stream<KCoreDecompositionStreamResult> stream(
return facade.community().kCoreStream(graphName, configuration);
}
@Procedure(value = "gds.kcore.stream.estimate", mode = READ)
@Description(KCORE_DESCRIPTION)
@Description(MEMORY_ESTIMATION_DESCRIPTION)
public Stream<MemoryEstimateResult> estimate(
@Name(value = "graphNameOrConfiguration") Object graphNameOrConfiguration,
@Name(value = "algoConfiguration") Map<String, Object> algoConfiguration
) {
return facade.community().kCoreEstimateStream(graphNameOrConfiguration, algoConfiguration);

}

}
Loading

0 comments on commit 95a5591

Please sign in to comment.