spmallette commented on code in PR #3238: URL: https://github.com/apache/tinkerpop/pull/3238#discussion_r2437168083
########## gremlin-mcp/src/main/javascript/src/gremlin/property-analyzer.ts: ########## @@ -0,0 +1,209 @@ +/* + * 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. + */ + +/** + * @fileoverview Property analysis for graph schema generation. + * + * Handles analysis of vertex and edge properties including type detection, + * enum discovery, cardinality analysis, and sample value collection. + */ + +import { Effect } from 'effect'; +import type { Property } from './models/index.js'; +import type { SchemaConfig } from './types.js'; +import type { process } from 'gremlin'; +import { getSamplePropertyValues, processBatched } from './query-utils.js'; +import type { GremlinQueryError } from '../errors.js'; + +type GraphTraversalSource = process.GraphTraversalSource; + +/** + * Analyzes property characteristics from collected values. + * + * @param propertyKey - Name of the property + * @param values - Array of sample values + * @param config - Schema configuration + * @returns Property analysis result + */ +export const analyzePropertyFromValues = ( + propertyKey: string, + values: unknown[], + config: SchemaConfig +): Property => { + // Skip denylisted properties + if (config.enumPropertyDenyList.includes(propertyKey)) { + return { + name: propertyKey, + type: ['unknown'], Review Comment: https://issues.apache.org/jira/browse/TINKERPOP-3204 -- 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]
