|
| 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