From 83e8cefa09685dc596bb0664f49238078fba4516 Mon Sep 17 00:00:00 2001 From: ioannispan Date: Mon, 2 Sep 2024 14:08:04 +0200 Subject: [PATCH] Remove defaults and limits from GenericStub and replace with user-specific parser Co-authored-by: Veselin Nikolov --- .../NodePropertyStepFactoryUsingStubs.java | 2 - .../gds/ml/pipeline/ValidationService.java | 16 ++----- .../LabelPropagationMutateProcTest.java | 4 +- .../ModularityOptimizationMutateProcTest.java | 6 +-- .../org/neo4j/gds/wcc/WccMutateProcTest.java | 6 +-- ...sificationPredictPipelineExecutorTest.java | 8 +++- .../java/org/neo4j/gds/ProcedureRunner.java | 4 +- .../stubs/ArticulationPointsMutateStub.java | 1 - .../BetaClosenessCentralityMutateStub.java | 1 - .../BetweennessCentralityMutateStub.java | 1 - .../centrality/stubs/CelfMutateStub.java | 1 - .../stubs/ClosenessCentralityMutateStub.java | 1 - .../stubs/DegreeCentralityMutateStub.java | 1 - .../stubs/HarmonicCentralityMutateStub.java | 1 - .../centrality/stubs/PageRankMutateStub.java | 1 - .../ApproximateMaximumKCutMutateStub.java | 1 - .../community/stubs/K1ColoringMutateStub.java | 1 - .../community/stubs/KCoreMutateStub.java | 1 - .../community/stubs/KMeansMutateStub.java | 1 - .../stubs/LabelPropagationMutateStub.java | 1 - .../community/stubs/LccMutateStub.java | 1 - .../community/stubs/LeidenMutateStub.java | 1 - .../community/stubs/LouvainMutateStub.java | 1 - .../ModularityOptimizationMutateStub.java | 1 - .../community/stubs/SccMutateStub.java | 1 - .../stubs/TriangleCountMutateStub.java | 1 - .../community/stubs/WccMutateStub.java | 1 - .../configuration/ConfigurationParser.java | 10 ++++- .../UserSpecificConfigurationParser.java | 11 +++++ .../embeddings/stubs/FastRPMutateStub.java | 1 - .../embeddings/stubs/GraphSageMutateStub.java | 1 - .../embeddings/stubs/HashGnnMutateStub.java | 1 - .../embeddings/stubs/Node2VecMutateStub.java | 1 - .../MachineLearningProcedureFacade.java | 19 +++----- .../machinelearning/stubs/KgeMutateStub.java | 1 - .../stubs/SplitRelationshipsMutateStub.java | 1 - .../stubs/CollapsePathMutateStub.java | 1 - .../stubs/IndexInverseMutateStub.java | 1 - .../stubs/ScalePropertiesMutateStub.java | 1 - .../stubs/ToUndirectedMutateStub.java | 1 - .../stubs/BellmanFordMutateStub.java | 1 - .../stubs/BreadthFirstSearchMutateStub.java | 1 - .../stubs/DeltaSteppingMutateStub.java | 1 - .../stubs/DepthFirstSearchMutateStub.java | 1 - .../stubs/RandomWalkMutateStub.java | 1 - ...SinglePairShortestPathAStarMutateStub.java | 1 - ...glePairShortestPathDijkstraMutateStub.java | 1 - .../SinglePairShortestPathYensMutateStub.java | 1 - ...eSourceShortestPathDijkstraMutateStub.java | 1 - .../stubs/SpanningTreeMutateStub.java | 1 - .../stubs/SteinerTreeMutateStub.java | 1 - .../similarity/FilteredKnnMutateStub.java | 1 - .../FilteredNodeSimilarityMutateStub.java | 1 - .../algorithms/similarity/KnnMutateStub.java | 1 - .../similarity/NodeSimilarityMutateStub.java | 1 - .../algorithms/stubs/GenericStub.java | 45 +++++-------------- .../AlgorithmProcedureFacadeBuilder.java | 20 ++++----- ...lgorithmProcedureFacadeBuilderFactory.java | 17 ++----- .../GraphDataScienceProcedures.java | 4 +- ...hDataScienceProceduresProviderFactory.java | 2 - 60 files changed, 71 insertions(+), 148 deletions(-) diff --git a/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/NodePropertyStepFactoryUsingStubs.java b/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/NodePropertyStepFactoryUsingStubs.java index 2b36f238d8..ac5adc7d4e 100644 --- a/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/NodePropertyStepFactoryUsingStubs.java +++ b/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/NodePropertyStepFactoryUsingStubs.java @@ -69,8 +69,6 @@ private static NodePropertyStepFactoryUsingStubs create() { // not great, one day these should be injected var configurationParser = new ConfigurationParser(DefaultsConfiguration.Instance, LimitsConfiguration.Instance); var validationService = new ValidationService( - DefaultsConfiguration.Instance, - LimitsConfiguration.Instance, configurationParser ); diff --git a/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/ValidationService.java b/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/ValidationService.java index bbb23d4374..df90277dd1 100644 --- a/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/ValidationService.java +++ b/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/ValidationService.java @@ -19,10 +19,9 @@ */ package org.neo4j.gds.ml.pipeline; +import org.neo4j.gds.api.User; import org.neo4j.gds.applications.algorithms.metadata.Algorithm; import org.neo4j.gds.config.AlgoBaseConfig; -import org.neo4j.gds.configuration.DefaultsConfiguration; -import org.neo4j.gds.configuration.LimitsConfiguration; import org.neo4j.gds.core.CypherMapWrapper; import org.neo4j.gds.core.Username; import org.neo4j.gds.procedures.algorithms.configuration.ConfigurationParser; @@ -33,17 +32,12 @@ class ValidationService { private final ConfigurationParsersForMutateMode configurationParsersForMutateMode = new ConfigurationParsersForMutateMode(); - private final DefaultsConfiguration defaultsConfiguration; - private final LimitsConfiguration limitsConfiguration; private final ConfigurationParser configurationParser; ValidationService( - DefaultsConfiguration defaultsConfiguration, - LimitsConfiguration limitsConfiguration, ConfigurationParser configurationParser ) { - this.defaultsConfiguration = defaultsConfiguration; - this.limitsConfiguration = limitsConfiguration; + this.configurationParser = configurationParser; } @@ -67,11 +61,9 @@ private void validateAnonymously( Map configuration ) { configurationParser.parseConfiguration( - defaultsConfiguration, - limitsConfiguration, - Username.EMPTY_USERNAME.username(), configuration, - (__, cmw) -> parser.apply(cmw) + parser, + new User(Username.EMPTY_USERNAME.username(),false) ); } } diff --git a/proc/community/src/integrationTest/java/org/neo4j/gds/labelpropagation/LabelPropagationMutateProcTest.java b/proc/community/src/integrationTest/java/org/neo4j/gds/labelpropagation/LabelPropagationMutateProcTest.java index ee52764334..76c059fb31 100644 --- a/proc/community/src/integrationTest/java/org/neo4j/gds/labelpropagation/LabelPropagationMutateProcTest.java +++ b/proc/community/src/integrationTest/java/org/neo4j/gds/labelpropagation/LabelPropagationMutateProcTest.java @@ -500,11 +500,9 @@ private GraphDataScienceProcedures constructFacade() { .build(); - var configurationParser = new ConfigurationParser(DefaultsConfiguration.Instance, LimitsConfiguration.Instance); + var configurationParser = new UserSpecificConfigurationParser(new ConfigurationParser(DefaultsConfiguration.Instance, LimitsConfiguration.Instance),requestScopedDependencies.getUser()); var genericStub = GenericStub.create( - DefaultsConfiguration.Instance, - LimitsConfiguration.Instance, graphStoreCatalogService, configurationParser, requestScopedDependencies diff --git a/proc/community/src/integrationTest/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationMutateProcTest.java b/proc/community/src/integrationTest/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationMutateProcTest.java index bdc1b949cb..7b2d353b68 100644 --- a/proc/community/src/integrationTest/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationMutateProcTest.java +++ b/proc/community/src/integrationTest/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationMutateProcTest.java @@ -499,7 +499,6 @@ private GraphDataScienceProcedures createFacade() { var logMock = mock(org.neo4j.gds.logging.Log.class); final GraphStoreCatalogService graphStoreCatalogService = new GraphStoreCatalogService(); - var configurationParser = new ConfigurationParser(DefaultsConfiguration.Instance, LimitsConfiguration.Instance); var requestScopedDependencies = RequestScopedDependencies.builder() .with(DatabaseId.of(db.databaseName())) .with(TaskRegistryFactory.empty()) @@ -507,9 +506,10 @@ private GraphDataScienceProcedures createFacade() { .with(new User(getUsername(), false)) .with(EmptyUserLogRegistryFactory.INSTANCE) .build(); + + var configurationParser = new UserSpecificConfigurationParser(new ConfigurationParser(DefaultsConfiguration.Instance, LimitsConfiguration.Instance),requestScopedDependencies.getUser()); + var genericStub = GenericStub.create( - DefaultsConfiguration.Instance, - LimitsConfiguration.Instance, graphStoreCatalogService, configurationParser, requestScopedDependencies diff --git a/proc/community/src/integrationTest/java/org/neo4j/gds/wcc/WccMutateProcTest.java b/proc/community/src/integrationTest/java/org/neo4j/gds/wcc/WccMutateProcTest.java index 224f8b96db..e46df1079b 100644 --- a/proc/community/src/integrationTest/java/org/neo4j/gds/wcc/WccMutateProcTest.java +++ b/proc/community/src/integrationTest/java/org/neo4j/gds/wcc/WccMutateProcTest.java @@ -602,10 +602,10 @@ private GraphDataScienceProcedures constructGraphDataScienceProcedures() { null, null ); - var configurationParser = new ConfigurationParser(DefaultsConfiguration.Instance, LimitsConfiguration.Instance); + + var configurationParser = new UserSpecificConfigurationParser(new ConfigurationParser(DefaultsConfiguration.Instance, LimitsConfiguration.Instance),requestScopedDependencies.getUser()); + var genericStub = GenericStub.create( - DefaultsConfiguration.Instance, - LimitsConfiguration.Instance, graphStoreCatalogService, configurationParser, requestScopedDependencies diff --git a/proc/machine-learning/src/test/java/org/neo4j/gds/ml/pipeline/node/classification/predict/NodeClassificationPredictPipelineExecutorTest.java b/proc/machine-learning/src/test/java/org/neo4j/gds/ml/pipeline/node/classification/predict/NodeClassificationPredictPipelineExecutorTest.java index 132eb29cfc..0920725eee 100644 --- a/proc/machine-learning/src/test/java/org/neo4j/gds/ml/pipeline/node/classification/predict/NodeClassificationPredictPipelineExecutorTest.java +++ b/proc/machine-learning/src/test/java/org/neo4j/gds/ml/pipeline/node/classification/predict/NodeClassificationPredictPipelineExecutorTest.java @@ -32,6 +32,7 @@ import org.neo4j.gds.api.DatabaseId; import org.neo4j.gds.api.DefaultValue; import org.neo4j.gds.api.GraphStore; +import org.neo4j.gds.api.User; import org.neo4j.gds.api.schema.GraphSchema; import org.neo4j.gds.applications.ApplicationsFacade; import org.neo4j.gds.applications.algorithms.machinery.RequestScopedDependencies; @@ -63,6 +64,7 @@ import org.neo4j.gds.procedures.algorithms.AlgorithmsProcedureFacade; import org.neo4j.gds.procedures.algorithms.centrality.CentralityProcedureFacade; import org.neo4j.gds.procedures.algorithms.configuration.ConfigurationParser; +import org.neo4j.gds.procedures.algorithms.configuration.UserSpecificConfigurationParser; import org.neo4j.gds.procedures.algorithms.stubs.GenericStub; import org.neo4j.gds.termination.TerminationFlag; import org.neo4j.gds.test.TestProc; @@ -428,7 +430,9 @@ void shouldEstimateMemory() { private static AlgorithmsProcedureFacade createAlgorithmsProcedureFacade() { var requestScopedDependencies = RequestScopedDependencies.builder() .with(TerminationFlag.RUNNING_TRUE) + .with(User.DEFAULT) .build(); + var applicationsFacade = ApplicationsFacade.create( null, null, @@ -447,8 +451,8 @@ private static AlgorithmsProcedureFacade createAlgorithmsProcedureFacade() { null, null ); - var configurationParser = new ConfigurationParser(null, null); - var genericStub = GenericStub.create(null, null, null, configurationParser, requestScopedDependencies); + var configurationParser = new UserSpecificConfigurationParser(new ConfigurationParser(null, null),requestScopedDependencies.getUser()); + var genericStub = GenericStub.create(null, configurationParser, requestScopedDependencies); var centralityProcedureFacade = CentralityProcedureFacade.create( genericStub, applicationsFacade, diff --git a/proc/test/src/main/java/org/neo4j/gds/ProcedureRunner.java b/proc/test/src/main/java/org/neo4j/gds/ProcedureRunner.java index 5959ca6517..4f91fc663e 100644 --- a/proc/test/src/main/java/org/neo4j/gds/ProcedureRunner.java +++ b/proc/test/src/main/java/org/neo4j/gds/ProcedureRunner.java @@ -39,8 +39,8 @@ import org.neo4j.gds.metrics.MetricsFacade; import org.neo4j.gds.metrics.procedures.DeprecatedProceduresMetricService; import org.neo4j.gds.procedures.AlgorithmProcedureFacadeBuilderFactory; -import org.neo4j.gds.procedures.GraphCatalogProcedureFacadeFactory; import org.neo4j.gds.procedures.DatabaseIdAccessor; +import org.neo4j.gds.procedures.GraphCatalogProcedureFacadeFactory; import org.neo4j.gds.procedures.GraphDataScienceProcedures; import org.neo4j.gds.procedures.ProcedureCallContextReturnColumns; import org.neo4j.graphdb.GraphDatabaseService; @@ -170,8 +170,6 @@ private static GraphDataScienceProcedures createGraphDataScienceProcedures( var modelCatalog = new OpenModelCatalog(); var algorithmFacadeBuilderFactory = new AlgorithmProcedureFacadeBuilderFactory( - DefaultsConfiguration.Instance, - LimitsConfiguration.Instance, graphStoreCatalogService ); diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/ArticulationPointsMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/ArticulationPointsMutateStub.java index 2a1f531718..cdf343fc52 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/ArticulationPointsMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/ArticulationPointsMutateStub.java @@ -54,7 +54,6 @@ public ArticulationPointsMutateConfig parseConfiguration(Map con @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, ArticulationPointsMutateConfig::of, (config) -> estimationModeBusinessFacade.articulationPoints() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/BetaClosenessCentralityMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/BetaClosenessCentralityMutateStub.java index 4aa61a08f8..24454ff6e3 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/BetaClosenessCentralityMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/BetaClosenessCentralityMutateStub.java @@ -58,7 +58,6 @@ public ClosenessCentralityMutateConfig parseConfiguration(Map co @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, ClosenessCentralityMutateConfig::of, estimationModeBusinessFacade::closenessCentrality diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/BetweennessCentralityMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/BetweennessCentralityMutateStub.java index 505a321e61..a27f7e9ef4 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/BetweennessCentralityMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/BetweennessCentralityMutateStub.java @@ -58,7 +58,6 @@ public BetweennessCentralityMutateConfig parseConfiguration(Map @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, BetweennessCentralityMutateConfig::of, estimationModeBusinessFacade::betweennessCentrality diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/CelfMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/CelfMutateStub.java index 3c187469e8..353e66bc0e 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/CelfMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/CelfMutateStub.java @@ -54,7 +54,6 @@ public InfluenceMaximizationMutateConfig parseConfiguration(Map @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, InfluenceMaximizationMutateConfig::of, estimationModeBusinessFacade::celf diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/ClosenessCentralityMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/ClosenessCentralityMutateStub.java index a1ba68fc8f..7baf1977e7 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/ClosenessCentralityMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/ClosenessCentralityMutateStub.java @@ -58,7 +58,6 @@ public ClosenessCentralityMutateConfig parseConfiguration(Map co @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, ClosenessCentralityMutateConfig::of, estimationModeBusinessFacade::closenessCentrality diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/DegreeCentralityMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/DegreeCentralityMutateStub.java index cce448fd39..8c7f9b90d5 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/DegreeCentralityMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/DegreeCentralityMutateStub.java @@ -58,7 +58,6 @@ public DegreeCentralityMutateConfig parseConfiguration(Map confi @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, DegreeCentralityMutateConfig::of, estimationModeBusinessFacade::degreeCentrality diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/HarmonicCentralityMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/HarmonicCentralityMutateStub.java index f55f4efff6..76aa8aff85 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/HarmonicCentralityMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/HarmonicCentralityMutateStub.java @@ -58,7 +58,6 @@ public HarmonicCentralityMutateConfig parseConfiguration(Map con @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, HarmonicCentralityMutateConfig::of, __ -> estimationModeBusinessFacade.harmonicCentrality() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/PageRankMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/PageRankMutateStub.java index de2655c873..b50ee6e9af 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/PageRankMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/stubs/PageRankMutateStub.java @@ -65,7 +65,6 @@ public PageRankMutateConfig parseConfiguration(Map configuration @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, configProducer, __ -> estimationModeBusinessFacade.pageRank() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/ApproximateMaximumKCutMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/ApproximateMaximumKCutMutateStub.java index 1c0262a42d..abcff07fdc 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/ApproximateMaximumKCutMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/ApproximateMaximumKCutMutateStub.java @@ -55,7 +55,6 @@ public ApproxMaxKCutMutateConfig parseConfiguration(Map configur @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, ApproxMaxKCutMutateConfig::of, estimationModeBusinessFacade::approximateMaximumKCut diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/K1ColoringMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/K1ColoringMutateStub.java index fa442a8979..5155043ae4 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/K1ColoringMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/K1ColoringMutateStub.java @@ -59,7 +59,6 @@ public K1ColoringMutateConfig parseConfiguration(Map configurati @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, K1ColoringMutateConfig::of, __ -> estimationModeBusinessFacade.k1Coloring() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/KCoreMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/KCoreMutateStub.java index d44a0f3365..6eda172f25 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/KCoreMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/KCoreMutateStub.java @@ -55,7 +55,6 @@ public KCoreDecompositionMutateConfig parseConfiguration(Map con @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, KCoreDecompositionMutateConfig::of, __ -> estimationModeBusinessFacade.kCore() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/KMeansMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/KMeansMutateStub.java index 7d90a8ea7c..9ce14e969a 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/KMeansMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/KMeansMutateStub.java @@ -60,7 +60,6 @@ public KmeansMutateConfig parseConfiguration(Map configuration) @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, KmeansMutateConfig::of, estimationModeBusinessFacade::kMeans diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LabelPropagationMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LabelPropagationMutateStub.java index 7b01f679f0..5a23638ac9 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LabelPropagationMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LabelPropagationMutateStub.java @@ -59,7 +59,6 @@ public LabelPropagationMutateConfig parseConfiguration(Map confi @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, LabelPropagationMutateConfig::of, __ -> estimationModeBusinessFacade.labelPropagation() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LccMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LccMutateStub.java index 5177be33f7..fc25397d7c 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LccMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LccMutateStub.java @@ -55,7 +55,6 @@ public LocalClusteringCoefficientMutateConfig parseConfiguration(Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, LocalClusteringCoefficientMutateConfig::of, estimationModeBusinessFacade::lcc diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LeidenMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LeidenMutateStub.java index 882720b384..5bc9e6938b 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LeidenMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LeidenMutateStub.java @@ -60,7 +60,6 @@ public LeidenMutateConfig parseConfiguration(Map configuration) @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, LeidenMutateConfig::of, estimationModeBusinessFacade::leiden diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LouvainMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LouvainMutateStub.java index e7ca87e85e..65bc161660 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LouvainMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LouvainMutateStub.java @@ -60,7 +60,6 @@ public LouvainMutateConfig parseConfiguration(Map configuration) @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, LouvainMutateConfig::of, estimationModeBusinessFacade::louvain diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/ModularityOptimizationMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/ModularityOptimizationMutateStub.java index 7fde12194f..97420f8f45 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/ModularityOptimizationMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/ModularityOptimizationMutateStub.java @@ -60,7 +60,6 @@ public ModularityOptimizationMutateConfig parseConfiguration(Map @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, ModularityOptimizationMutateConfig::of, __ -> estimationModeBusinessFacade.modularityOptimization() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/SccMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/SccMutateStub.java index d8ab398a92..161846635e 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/SccMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/SccMutateStub.java @@ -60,7 +60,6 @@ public SccMutateConfig parseConfiguration(Map configuration) { @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, SccMutateConfig::of, __ -> estimationModeBusinessFacade.scc() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/TriangleCountMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/TriangleCountMutateStub.java index 33f3ba863f..fe03f03421 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/TriangleCountMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/TriangleCountMutateStub.java @@ -55,7 +55,6 @@ public TriangleCountMutateConfig parseConfiguration(Map configur @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, TriangleCountMutateConfig::of, __ -> estimationModeBusinessFacade.triangleCount() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/WccMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/WccMutateStub.java index a6e4c8cb98..bbdbc0d7bb 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/WccMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/WccMutateStub.java @@ -59,7 +59,6 @@ public WccMutateConfig parseConfiguration(Map configuration) { @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, WccMutateConfig::of, estimationModeBusinessFacade::wcc diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/configuration/ConfigurationParser.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/configuration/ConfigurationParser.java index f9247c0d2f..9794d35ae2 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/configuration/ConfigurationParser.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/configuration/ConfigurationParser.java @@ -65,10 +65,18 @@ CONFIG parseConfiguration( return parseConfiguration(defaults, limits, user.getUsername(), configuration, lexer); } + public CONFIG parseConfigurationWithoutDefaultsAndLimits( + Map configuration, + BiFunction lexer, + String username + ) { + return parseConfiguration(DefaultsConfiguration.Empty, LimitsConfiguration.Empty, username, configuration, lexer); + } + /** * Configuration parsing using directly configured defaults and limits */ - public CONFIG parseConfiguration( + private CONFIG parseConfiguration( DefaultsConfiguration defaultsConfiguration, LimitsConfiguration limitsConfiguration, String username, diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/configuration/UserSpecificConfigurationParser.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/configuration/UserSpecificConfigurationParser.java index 3915fe4f95..230a827e1e 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/configuration/UserSpecificConfigurationParser.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/configuration/UserSpecificConfigurationParser.java @@ -46,4 +46,15 @@ public CONFIG parseConfiguration( user ); } + + public CONFIG parseConfigurationWithoutDefaultsAndLimits( + Map configuration, + Function lexer + ) { + return configurationParser.parseConfigurationWithoutDefaultsAndLimits( + configuration, + (__, cypherMapWrapper) -> lexer.apply(cypherMapWrapper), + user.getUsername() + ); + } } diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/FastRPMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/FastRPMutateStub.java index 7c7e6099ea..4b952ab3ee 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/FastRPMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/FastRPMutateStub.java @@ -55,7 +55,6 @@ public FastRPMutateConfig parseConfiguration(Map configuration) @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, FastRPMutateConfig::of, estimationModeBusinessFacade::fastRP diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/GraphSageMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/GraphSageMutateStub.java index ff559ff7dc..3f71ba2c64 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/GraphSageMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/GraphSageMutateStub.java @@ -63,7 +63,6 @@ public GraphSageMutateConfig parseConfiguration(Map configuratio @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, cypherMapWrapper -> GraphSageMutateConfig.of(username, cypherMapWrapper), configuration -> estimationModeBusinessFacade.graphSage(configuration, true) diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/HashGnnMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/HashGnnMutateStub.java index 3f6808d459..a2ec8c1a97 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/HashGnnMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/HashGnnMutateStub.java @@ -54,7 +54,6 @@ public HashGNNMutateConfig parseConfiguration(Map configuration) @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, HashGNNMutateConfig::of, estimationModeBusinessFacade::hashGnn diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/Node2VecMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/Node2VecMutateStub.java index 08b635e0d3..44055ef2ee 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/Node2VecMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/embeddings/stubs/Node2VecMutateStub.java @@ -55,7 +55,6 @@ public Node2VecMutateConfig parseConfiguration(Map configuration @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, Node2VecMutateConfig::of, estimationModeBusinessFacade::node2Vec diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/MachineLearningProcedureFacade.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/MachineLearningProcedureFacade.java index 23a2936d78..2369003c2c 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/MachineLearningProcedureFacade.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/MachineLearningProcedureFacade.java @@ -22,13 +22,12 @@ import org.neo4j.gds.algorithms.machinelearning.KGEPredictStreamConfig; import org.neo4j.gds.algorithms.machinelearning.KGEPredictWriteConfig; import org.neo4j.gds.api.GraphName; -import org.neo4j.gds.api.User; import org.neo4j.gds.applications.ApplicationsFacade; import org.neo4j.gds.applications.algorithms.machinelearning.MachineLearningAlgorithmsStreamModeBusinessFacade; import org.neo4j.gds.applications.algorithms.machinelearning.MachineLearningAlgorithmsWriteModeBusinessFacade; import org.neo4j.gds.config.AlgoBaseConfig; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.procedures.algorithms.configuration.ConfigurationParser; +import org.neo4j.gds.procedures.algorithms.configuration.UserSpecificConfigurationParser; import org.neo4j.gds.procedures.algorithms.machinelearning.stubs.KgeMutateStub; import org.neo4j.gds.procedures.algorithms.machinelearning.stubs.SplitRelationshipsMutateStub; import org.neo4j.gds.procedures.algorithms.stubs.GenericStub; @@ -45,21 +44,18 @@ public final class MachineLearningProcedureFacade { private final KgeMutateStub kgeMutateStub; private final SplitRelationshipsMutateStub splitRelationshipsMutateStub; - private final ConfigurationParser configurationParser; - private final User user; + private final UserSpecificConfigurationParser configurationParser; private MachineLearningProcedureFacade( KgeMutateStub kgeMutateStub, SplitRelationshipsMutateStub splitRelationshipsMutateStub, MachineLearningAlgorithmsStreamModeBusinessFacade streamModeBusinessFacade, MachineLearningAlgorithmsWriteModeBusinessFacade writeModeBusinessFacade, - ConfigurationParser configurationParser, - User user + UserSpecificConfigurationParser configurationParser ) { this.streamModeBusinessFacade = streamModeBusinessFacade; this.writeModeBusinessFacade = writeModeBusinessFacade; this.configurationParser = configurationParser; - this.user = user; this.kgeMutateStub = kgeMutateStub; this.splitRelationshipsMutateStub = splitRelationshipsMutateStub; } @@ -67,8 +63,7 @@ private MachineLearningProcedureFacade( public static MachineLearningProcedureFacade create( GenericStub genericStub, ApplicationsFacade applicationsFacade, - ConfigurationParser configurationParser, - User user + UserSpecificConfigurationParser configurationParser ) { var kgeMutateStub = new KgeMutateStub(genericStub, applicationsFacade.machineLearning().mutate(), applicationsFacade.machineLearning().estimate()); var splitRelationshipsMutateStub = new SplitRelationshipsMutateStub(genericStub, applicationsFacade.machineLearning().mutate(), applicationsFacade.machineLearning().estimate()); @@ -78,8 +73,7 @@ public static MachineLearningProcedureFacade create( splitRelationshipsMutateStub, applicationsFacade.machineLearning().stream(), applicationsFacade.machineLearning().write(), - configurationParser, - user + configurationParser ); } @@ -118,8 +112,7 @@ private C parseConfiguration( ) { return configurationParser.parseConfiguration( configuration, - configurationMapper, - user + configurationMapper ); } } diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/stubs/KgeMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/stubs/KgeMutateStub.java index 4f98839cbe..42b44c3379 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/stubs/KgeMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/stubs/KgeMutateStub.java @@ -54,7 +54,6 @@ public KGEPredictMutateConfig parseConfiguration(Map configurati @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, KGEPredictMutateConfig::of, __ -> estimationModeBusinessFacade.kge() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/stubs/SplitRelationshipsMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/stubs/SplitRelationshipsMutateStub.java index 77ee3ab993..e9b5382294 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/stubs/SplitRelationshipsMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/machinelearning/stubs/SplitRelationshipsMutateStub.java @@ -54,7 +54,6 @@ public SplitRelationshipsMutateConfig parseConfiguration(Map con @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, SplitRelationshipsMutateConfig::of, estimationModeBusinessFacade::splitRelationships diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/CollapsePathMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/CollapsePathMutateStub.java index db0a9568d7..f00fcfecfe 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/CollapsePathMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/CollapsePathMutateStub.java @@ -54,7 +54,6 @@ public CollapsePathConfig parseConfiguration(Map configuration) @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, CollapsePathConfig::of, __ -> estimationModeBusinessFacade.collapsePath() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/IndexInverseMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/IndexInverseMutateStub.java index 21296a65aa..33484a2e65 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/IndexInverseMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/IndexInverseMutateStub.java @@ -54,7 +54,6 @@ public InverseRelationshipsConfig parseConfiguration(Map configu @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, InverseRelationshipsConfig::of, estimationModeBusinessFacade::indexInverse diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/ScalePropertiesMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/ScalePropertiesMutateStub.java index 68c694461d..f9d26b88d7 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/ScalePropertiesMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/ScalePropertiesMutateStub.java @@ -64,7 +64,6 @@ public ScalePropertiesMutateConfig parseConfiguration(Map config @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, configFunction, estimationModeBusinessFacade::scaleProperties diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/ToUndirectedMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/ToUndirectedMutateStub.java index aa1a3e1f02..80e605d26f 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/ToUndirectedMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/miscellaneous/stubs/ToUndirectedMutateStub.java @@ -55,7 +55,6 @@ public ToUndirectedConfig parseConfiguration(Map configuration) @Override public MemoryEstimation getMemoryEstimation(String username, Map rawConfiguration) { return genericStub.getMemoryEstimation( - username, rawConfiguration, ToUndirectedConfig::of, estimationModeBusinessFacade::toUndirected diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/BellmanFordMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/BellmanFordMutateStub.java index 2c3a026257..49df850364 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/BellmanFordMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/BellmanFordMutateStub.java @@ -54,7 +54,6 @@ public AllShortestPathsBellmanFordMutateConfig parseConfiguration(Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, AllShortestPathsBellmanFordMutateConfig::of, estimationModeBusinessFacade::bellmanFord diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/BreadthFirstSearchMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/BreadthFirstSearchMutateStub.java index 7732662223..753217f726 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/BreadthFirstSearchMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/BreadthFirstSearchMutateStub.java @@ -53,7 +53,6 @@ public BfsMutateConfig parseConfiguration(Map configuration) { @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, BfsMutateConfig::of, __ -> estimationModeBusinessFacade.breadthFirstSearch() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/DeltaSteppingMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/DeltaSteppingMutateStub.java index 0c66a57779..6475177b80 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/DeltaSteppingMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/DeltaSteppingMutateStub.java @@ -55,7 +55,6 @@ public AllShortestPathsDeltaMutateConfig parseConfiguration(Map @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, AllShortestPathsDeltaMutateConfig::of, __ -> estimationModeBusinessFacade.deltaStepping() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/DepthFirstSearchMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/DepthFirstSearchMutateStub.java index 5cae407f84..2cc3462dab 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/DepthFirstSearchMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/DepthFirstSearchMutateStub.java @@ -53,7 +53,6 @@ public DfsMutateConfig parseConfiguration(Map configuration) { @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, DfsMutateConfig::of, __ -> estimationModeBusinessFacade.depthFirstSearch() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/RandomWalkMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/RandomWalkMutateStub.java index 7cb07cb974..1d7294a2fb 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/RandomWalkMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/RandomWalkMutateStub.java @@ -53,7 +53,6 @@ public RandomWalkMutateConfig parseConfiguration(Map configurati @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, RandomWalkMutateConfig::of, estimationModeBusinessFacade::randomWalkCountingVisits diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathAStarMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathAStarMutateStub.java index 87895d9dd6..019e5de0ad 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathAStarMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathAStarMutateStub.java @@ -55,7 +55,6 @@ public ShortestPathAStarMutateConfig parseConfiguration(Map conf @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, ShortestPathAStarMutateConfig::of, __ -> estimationModeBusinessFacade.singlePairShortestPathAStar() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathDijkstraMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathDijkstraMutateStub.java index 4a10163e95..6c8aa2445a 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathDijkstraMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathDijkstraMutateStub.java @@ -54,7 +54,6 @@ public ShortestPathDijkstraMutateConfig parseConfiguration(Map c @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, ShortestPathDijkstraMutateConfig::of, estimationModeBusinessFacade::singlePairShortestPathDijkstra diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathYensMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathYensMutateStub.java index 977512bbc3..7a22d50c0d 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathYensMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SinglePairShortestPathYensMutateStub.java @@ -54,7 +54,6 @@ public ShortestPathYensMutateConfig parseConfiguration(Map confi @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, ShortestPathYensMutateConfig::of, estimationModeBusinessFacade::singlePairShortestPathYens diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SingleSourceShortestPathDijkstraMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SingleSourceShortestPathDijkstraMutateStub.java index 05b1c2fa99..3d6e845f15 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SingleSourceShortestPathDijkstraMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SingleSourceShortestPathDijkstraMutateStub.java @@ -54,7 +54,6 @@ public AllShortestPathsDijkstraMutateConfig parseConfiguration(Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, AllShortestPathsDijkstraMutateConfig::of, estimationModeBusinessFacade::singleSourceShortestPathDijkstra diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SpanningTreeMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SpanningTreeMutateStub.java index 429be9a88a..ce22f52ba2 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SpanningTreeMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SpanningTreeMutateStub.java @@ -53,7 +53,6 @@ public SpanningTreeMutateConfig parseConfiguration(Map configura @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, SpanningTreeMutateConfig::of, __ -> estimationModeBusinessFacade.spanningTree() diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SteinerTreeMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SteinerTreeMutateStub.java index 2a58cf3d2f..1930fe9e9d 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SteinerTreeMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/stubs/SteinerTreeMutateStub.java @@ -54,7 +54,6 @@ public SteinerTreeMutateConfig parseConfiguration(Map configurat @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, SteinerTreeMutateConfig::of, estimationModeBusinessFacade::steinerTree diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/FilteredKnnMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/FilteredKnnMutateStub.java index 8713563d9c..830423a564 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/FilteredKnnMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/FilteredKnnMutateStub.java @@ -58,7 +58,6 @@ public FilteredKnnMutateConfig parseConfiguration(Map configurat @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, FilteredKnnMutateConfig::of, estimationModeBusinessFacade::filteredKnn diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/FilteredNodeSimilarityMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/FilteredNodeSimilarityMutateStub.java index 83c0fe12c2..fa5ab9fc01 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/FilteredNodeSimilarityMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/FilteredNodeSimilarityMutateStub.java @@ -58,7 +58,6 @@ public FilteredNodeSimilarityMutateConfig parseConfiguration(Map @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, FilteredNodeSimilarityMutateConfig::of, estimationModeBusinessFacade::filteredNodeSimilarity diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/KnnMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/KnnMutateStub.java index 16135e46cf..989e014fa3 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/KnnMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/KnnMutateStub.java @@ -58,7 +58,6 @@ public KnnMutateConfig parseConfiguration(Map configuration) { @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, KnnMutateConfig::of, estimationModeBusinessFacade::knn diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/NodeSimilarityMutateStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/NodeSimilarityMutateStub.java index 67b57a0eee..dffb178c1b 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/NodeSimilarityMutateStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/similarity/NodeSimilarityMutateStub.java @@ -57,7 +57,6 @@ public NodeSimilarityMutateConfig parseConfiguration(Map configu @Override public MemoryEstimation getMemoryEstimation(String username, Map configuration) { return genericStub.getMemoryEstimation( - username, configuration, NodeSimilarityMutateConfig::of, estimationModeBusinessFacade::nodeSimilarity diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/stubs/GenericStub.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/stubs/GenericStub.java index b554f64eb2..ad8290efe1 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/stubs/GenericStub.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/stubs/GenericStub.java @@ -20,51 +20,39 @@ package org.neo4j.gds.procedures.algorithms.stubs; import org.neo4j.gds.api.GraphName; -import org.neo4j.gds.api.User; import org.neo4j.gds.applications.algorithms.machinery.AlgorithmEstimationTemplate; import org.neo4j.gds.applications.algorithms.machinery.MemoryEstimateResult; import org.neo4j.gds.applications.algorithms.machinery.RequestScopedDependencies; import org.neo4j.gds.applications.algorithms.machinery.ResultBuilder; import org.neo4j.gds.config.AlgoBaseConfig; -import org.neo4j.gds.configuration.DefaultsConfiguration; -import org.neo4j.gds.configuration.LimitsConfiguration; import org.neo4j.gds.core.CypherMapWrapper; import org.neo4j.gds.core.loading.GraphStoreCatalogService; import org.neo4j.gds.mem.MemoryEstimation; import org.neo4j.gds.memest.DatabaseGraphStoreEstimationService; import org.neo4j.gds.procedures.algorithms.AlgorithmHandle; -import org.neo4j.gds.procedures.algorithms.configuration.ConfigurationParser; +import org.neo4j.gds.procedures.algorithms.configuration.UserSpecificConfigurationParser; import java.util.Map; import java.util.function.Function; import java.util.stream.Stream; public final class GenericStub { - private final DefaultsConfiguration defaultsConfiguration; - private final LimitsConfiguration limitsConfiguration; - private final ConfigurationParser configurationParser; - private final User user; + + private final UserSpecificConfigurationParser configurationParser; private final AlgorithmEstimationTemplate algorithmEstimationTemplate; private GenericStub( - DefaultsConfiguration defaultsConfiguration, - LimitsConfiguration limitsConfiguration, - ConfigurationParser configurationParser, - User user, + UserSpecificConfigurationParser configurationParser, AlgorithmEstimationTemplate algorithmEstimationTemplate ) { - this.defaultsConfiguration = defaultsConfiguration; - this.limitsConfiguration = limitsConfiguration; + this.configurationParser = configurationParser; - this.user = user; this.algorithmEstimationTemplate = algorithmEstimationTemplate; } public static GenericStub create( - DefaultsConfiguration defaultsConfiguration, - LimitsConfiguration limitsConfiguration, GraphStoreCatalogService graphStoreCatalogService, - ConfigurationParser configurationParser, + UserSpecificConfigurationParser configurationParser, RequestScopedDependencies requestScopedDependencies ) { var databaseGraphStoreEstimationService = new DatabaseGraphStoreEstimationService( @@ -78,10 +66,7 @@ public static GenericStub create( ); return new GenericStub( - defaultsConfiguration, - limitsConfiguration, configurationParser, - requestScopedDependencies.getUser(), algorithmEstimationTemplate ); } @@ -94,11 +79,8 @@ public CONFIGURATION parseConfiguration( Map configuration ) { return configurationParser.parseConfiguration( - defaultsConfiguration, - limitsConfiguration, - user.getUsername(), configuration, - (__, cmw) -> configurationLexer.apply(cmw) + configurationLexer ); } @@ -106,17 +88,13 @@ public CONFIGURATION parseConfiguration( * @see org.neo4j.gds.procedures.algorithms.stubs.MutateStub#getMemoryEstimation(String, java.util.Map) */ public MemoryEstimation getMemoryEstimation( - String username, Map rawConfiguration, Function configurationLexer, Function estimator ) { - var configuration = configurationParser.parseConfiguration( - DefaultsConfiguration.Empty, - LimitsConfiguration.Empty, - username, + var configuration = configurationParser.parseConfigurationWithoutDefaultsAndLimits( rawConfiguration, - (__, cmw) -> configurationLexer.apply(cmw) + configurationLexer ); return estimator.apply(configuration); @@ -131,7 +109,7 @@ public Stream estim Function configurationLexer, Function estimator ) { - var memoryEstimation = getMemoryEstimation(user.getUsername(), rawConfiguration, configurationLexer, estimator); + var memoryEstimation = getMemoryEstimation(rawConfiguration, configurationLexer, estimator); var configuration = parseConfiguration(configurationLexer, rawConfiguration); @@ -157,8 +135,7 @@ public