cbqiao commented on code in PR #729: URL: https://github.com/apache/geaflow/pull/729#discussion_r2715623430
########## geaflow-ai/src/main/java/org/apache/geaflow/ai/consolidate/function/KeywordRelationFunction.java: ########## @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.geaflow.ai.consolidate.function; + +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import org.apache.geaflow.ai.GraphMemoryServer; +import org.apache.geaflow.ai.common.ErrorCode; +import org.apache.geaflow.ai.common.config.Constants; +import org.apache.geaflow.ai.graph.*; +import org.apache.geaflow.ai.graph.io.Edge; +import org.apache.geaflow.ai.graph.io.EdgeSchema; +import org.apache.geaflow.ai.index.EntityAttributeIndexStore; +import org.apache.geaflow.ai.index.vector.KeywordVector; +import org.apache.geaflow.ai.search.VectorSearch; +import org.apache.geaflow.ai.verbalization.SubgraphSemanticPromptFunction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class KeywordRelationFunction implements ConsolidateFunction { + + private static final Logger LOGGER = LoggerFactory.getLogger(KeywordRelationFunction.class); + + @Override + public void eval(GraphAccessor graphAccessor, MutableGraph mutableGraph) { + EntityAttributeIndexStore indexStore = new EntityAttributeIndexStore(); + indexStore.initStore(new SubgraphSemanticPromptFunction(graphAccessor)); + LOGGER.info("Success to init EntityAttributeIndexStore."); + GraphMemoryServer server = new GraphMemoryServer(); + server.addGraphAccessor(graphAccessor); + server.addIndexStore(indexStore); + LOGGER.info("Success to init GraphMemoryServer."); + + if (null == mutableGraph.getSchema().getSchema( + Constants.CONSOLIDATE_KEYWORD_RELATION_LABEL)) { + int code = mutableGraph.addEdgeSchema(new EdgeSchema( Review Comment: If the graph schema is changed or updated inside a function rather than being created by the caller before execution, is there a risk that the updated schema will not be visible to subsequent steps? ########## geaflow-ai/src/main/java/org/apache/geaflow/ai/GeaFlowMemoryServer.java: ########## @@ -0,0 +1,230 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.geaflow.ai; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.geaflow.ai.common.util.SeDeUtil; +import org.apache.geaflow.ai.graph.*; +import org.apache.geaflow.ai.graph.io.*; +import org.apache.geaflow.ai.index.EntityAttributeIndexStore; +import org.apache.geaflow.ai.index.vector.KeywordVector; +import org.apache.geaflow.ai.search.VectorSearch; +import org.apache.geaflow.ai.service.ServerMemoryCache; +import org.apache.geaflow.ai.verbalization.Context; +import org.apache.geaflow.ai.verbalization.SubgraphSemanticPromptFunction; +import org.noear.solon.Solon; +import org.noear.solon.annotation.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Controller +public class GeaFlowMemoryServer { Review Comment: Is there a need for an API to start the ConsolidateServer? I don't see any explicit startup command for it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
