Skip to content

Commit 9800adc

Browse files
Mats-SXvnickolov
authored andcommitted
Fix bad query example for model.publish
- adds a DocTest - test is no-result and invisible setup because alpha
1 parent e866081 commit 9800adc

File tree

2 files changed

+94
-4
lines changed

2 files changed

+94
-4
lines changed

doc/asciidoc/model-catalog/model-catalog-publish.adoc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
[.enterprise-edition]
32
[[model-catalog-publish-ops]]
43
= Publishing models
@@ -14,22 +13,32 @@ Making a model accessible to other users can be achieved by publishing it.
1413
[[catalog-model-publish]]
1514
== Publishing a model
1615

16+
[role=query-example, no-result=true]
17+
--
1718
.Publishing trained model:
1819
[source,cypher]
1920
----
2021
CALL gds.alpha.model.publish('my-model')
2122
YIELD
2223
modelInfo,
23-
configuration,
24+
trainConfig,
25+
graphSchema,
26+
stored,
27+
loaded,
2428
creationTime,
2529
shared
2630
----
31+
--
32+
33+
The full set of fields returned from this procedure are:
2734

28-
.Results
2935
* `modelInfo`: detailed information for the trained model
3036
** `modelName: String`: the saved model name.
3137
** `modelType: String`: the type of the model, i.e. `GraphSAGE`.
3238
** can also contain algorithm specific model details.
33-
* `configuration`: the configuration used for training the model.
39+
* `trainConfig`: the configuration used for training the model.
40+
* `graphSchema`: the schema of the graph on which the model was trained.
41+
* `stored`: True, if the model is <<catalog-model-store,stored>> on disk.
42+
* `loaded`: True, if the model is <<catalog-model-load,loaded>> in the in-memory model catalog.
3443
* `creationTime`: the time at which the model was registered in the catalog.
3544
* `shared`: a boolean flag indicating if the model is published.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.graphalgo.doc;
21+
22+
import org.junit.jupiter.api.AfterEach;
23+
import org.junit.jupiter.api.BeforeEach;
24+
import org.junit.jupiter.api.io.TempDir;
25+
import org.neo4j.configuration.Config;
26+
import org.neo4j.gds.embeddings.graphsage.Layer;
27+
import org.neo4j.gds.embeddings.graphsage.ModelData;
28+
import org.neo4j.gds.embeddings.graphsage.SingleLabelFeatureFunction;
29+
import org.neo4j.gds.embeddings.graphsage.algo.GraphSage;
30+
import org.neo4j.gds.embeddings.graphsage.algo.ImmutableGraphSageTrainConfig;
31+
import org.neo4j.graphalgo.api.schema.GraphSchema;
32+
import org.neo4j.graphalgo.compat.GraphDatabaseApiProxy;
33+
import org.neo4j.graphalgo.core.GdsEdition;
34+
import org.neo4j.graphalgo.core.ModelStoreSettings;
35+
import org.neo4j.graphalgo.core.model.Model;
36+
import org.neo4j.graphalgo.core.model.ModelCatalog;
37+
import org.neo4j.graphalgo.model.catalog.ModelPublishProc;
38+
39+
import java.nio.file.Path;
40+
import java.util.List;
41+
42+
class ModelCatalogPublishDocTest extends DocTestBase {
43+
44+
@TempDir
45+
Path modelStoreLocation;
46+
47+
@Override
48+
@BeforeEach
49+
void setUp() throws Exception {
50+
super.setUp();
51+
GraphDatabaseApiProxy
52+
.resolveDependency(db, Config.class)
53+
.set(ModelStoreSettings.model_store_location, modelStoreLocation);
54+
GdsEdition.instance().setToEnterpriseEdition();
55+
ModelCatalog.set(Model.of(
56+
getUsername(),
57+
"my-model",
58+
GraphSage.MODEL_TYPE,
59+
GraphSchema.empty(),
60+
ModelData.of(new Layer[0], new SingleLabelFeatureFunction()),
61+
ImmutableGraphSageTrainConfig.builder().modelName("my-model").degreeAsProperty(true).build(),
62+
Model.Mappable.EMPTY
63+
));
64+
}
65+
66+
@AfterEach
67+
void tearDown() {
68+
ModelCatalog.removeAllLoadedModels();
69+
GdsEdition.instance().setToCommunityEdition();
70+
}
71+
72+
@Override
73+
List<Class<?>> procedures() {
74+
return List.of(ModelPublishProc.class);
75+
}
76+
77+
@Override
78+
String adocFile() {
79+
return "model-catalog/model-catalog-publish.adoc";
80+
}
81+
}

0 commit comments

Comments
 (0)