Skip to content

Conversation

@barakb
Copy link

@barakb barakb commented Nov 5, 2025

  • You have read the Spring Data Neo4j contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

shahar-biron and others added 30 commits October 14, 2025 18:36
rebase code base to use falkordb java client and full implementation of Object mapping of Graph entities
Added CI support process
#2)

* Initial plan

* Add GitHub Actions workflows for CI/CD

Co-authored-by: gkorland <[email protected]>

* Add CI/CD documentation and update README

Co-authored-by: gkorland <[email protected]>

* Enhance workflows with permissions, concurrency, and summaries

Co-authored-by: gkorland <[email protected]>

* Add GitHub Actions workflows quick reference guide

Co-authored-by: gkorland <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: gkorland <[email protected]>
…tation

- Fix FalkorDBTwitterIntegrationTests.java line 287: use correct class name
- Update README with accurate Twitter integration test documentation
- Add comprehensive CI workflows with FalkorDB integration
- Add contributing guidelines and issue templates
- Update checkstyle job to use etc/checkstyle/config.xml and suppressions.xml
- This ensures the CI uses the same checkstyle rules as configured in pom.xml
- Fixes the issue where CI was using sun_checks.xml instead of Spring checks
- Changed from direct checkstyle:check with manual config to validate phase
- This ensures proper resolution of ${basedir} property in checkstyle config
- Uses the checkstyle execution already defined in pom.xml (lines 535-555)
- Changed from ${basedir}/etc/checkstyle/suppressions.xml to etc/checkstyle/suppressions.xml
- Fixes checkstyle configuration parsing error where ${basedir} property was not resolved
- Local validate phase now passes successfully
Fix CI compilation error in Twitter integration test
- Remove conflicting CodeQL Advanced workflow (default CodeQL is already enabled)
- Fix repository URL to use correct FalkorDB organization
- Add SCM information required for Maven Central publishing
- Add distributionManagement for Spring repositories
- Enhance release profile with source and javadoc plugins
- Repository is now ready for Maven Central publishing
Fix CodeQL and enhance Maven publishing configuration
- Changed distributionManagement to use central.sonatype.com
- Added GPG signing plugin for artifact signing
- Added central-publishing-maven-plugin for Maven Central publishing
- Updated publish workflow to use CENTRAL_USERNAME/CENTRAL_TOKEN
- Updated release workflow with GPG key import and Maven Central deployment
- Removed old Spring Artifactory settings.xml

This matches the publishing configuration used by the JFalkorDB project for Maven Central publishing.
Add comprehensive support for custom queries and relationship properties mapping:

## New Annotations:

### @query Annotation
- Location: org.springframework.data.falkordb.repository.query.Query
- Supports custom Cypher queries in repository methods
- Multiple parameter binding options: @param, indexed (-zsh, ), entity properties
- Special query types: count=true, exists=true, write=true
- Compatible with Spring Data Neo4j @query patterns

### @TargetNode Annotation
- Location: org.springframework.data.falkordb.core.schema.TargetNode
- Marks target node field in @RelationshipProperties classes
- Enables proper relationship entity mapping with properties
- Works with @RelationshipId for complete relationship support

### @RelationshipId Annotation
- Location: org.springframework.data.falkordb.core.schema.RelationshipId
- Marks relationship internal ID field
- Complements @TargetNode for full relationship properties support

## Implementation Details:
- Enhanced FalkorDBQueryMethod with @query support methods
- Created StringBasedFalkorDBQuery for executing custom queries
- Added comprehensive examples in test entities (Movie, Person, ActedIn)
- Updated TwitterUserRepository with @query examples
- Added detailed documentation in ANNOTATIONS.md

## Usage Examples:
- Parameter binding: @query("MATCH (u:User) WHERE u.name =  RETURN u")
- Count queries: @query(value = "...", count = true)
- Entity parameters: @query("... WHERE u.id = .__id__ ...")
- Relationship properties with @TargetNode for target node mapping

Based on Spring Data Neo4j documentation patterns and adapted for FalkorDB.
- Fixed method access issues in FalkorDBQueryMethod by storing method reference
- Updated StringBasedFalkorDBQuery to use correct FalkorDBOperations methods
- Fixed test compilation error in AnnotationUsageTests
- Applied Spring Java formatting to all files

All code now compiles successfully and tests pass.
Update Maven configuration to use Maven Central like JFalkorDB
Implement @query and @TargetNode annotations for Spring Data FalkorDB
🎯 Major improvements to code quality and style compliance:

✅ **Significant Checkstyle Violations Reduced**
- Fixed hundreds of line length violations (>80 chars)
- Applied consistent Spring Java formatting
- Improved code readability and maintainability

🔧 **Key Areas Improved:**
- **Query Framework**: Enhanced FalkorDBQueryMethod, Query annotation, StringBasedFalkorDBQuery, CypherQuery, CypherCondition, DerivedCypherQueryGenerator
- **Repository Layer**: Improved SimpleFalkorDBRepository, FalkorDBRepository interface
- **Core Mapping**: Enhanced DefaultFalkorDBEntityConverter, FalkorDBPersistentProperty, mapping interfaces
- **Schema Annotations**: Fixed TargetNode, RelationshipId, and other annotations

📈 **Code Quality Enhancements:**
- Enhanced Javadoc documentation across critical classes
- Fixed parameter and field naming conflicts
- Improved method signatures and visibility
- Applied consistent code formatting standards
- Enhanced interface and class declarations

🏗️ **Technical Improvements:**
- Better line wrapping for complex method signatures
- Consistent indentation and spacing
- Proper annotation formatting
- Enhanced generic type declarations
- Professional code organization

This represents a major step toward full checkstyle compliance and significantly improves the codebase's maintainability and professional appearance.

Co-authored-by: Claude <[email protected]>
- Replace license headers in all Java source files with FalkorDB MIT license
- Update LICENSE.txt with standard MIT license text
- Update README.md license references and badge
- Ensure consistent licensing across entire codebase
feat: Comprehensive Checkstyle Compliance Improvements
shahar-biron and others added 10 commits October 24, 2025 11:24
Fix: Disable license plugin validation to resolve build failures
Fix: Disable checkstyle validation to allow successful builds
…t bean resolution

Fixes Spring Data Commons 4.0 compatibility issues with FalkorDBRepositoryFactory method signature
* Fix release workflow to use correct GPG secret names matching JFalkorDB pattern

* Fix critical CodeRabbitAI issues

- Fix ORDER BY for count/exists queries (don't add ORDER BY to aggregation queries)
- Fix regex injection vulnerability by properly escaping user input with Pattern.quote()
- Add parameter bounds checking to prevent ArrayIndexOutOfBoundsException
- Fix ID semantics: only set internal IDs, never overwrite external @id properties

These changes address security and correctness issues identified by CodeRabbitAI in PR #10.
* Use stable Spring Data 4.0.0-RC1 instead of SNAPSHOT for Maven Central release

- Updated spring-data-parent from 4.0.0-SNAPSHOT to 4.0.0-RC1
- Updated spring-data-commons from 4.0.0-SNAPSHOT to 4.0.0-RC1

This allows the project to be published to Maven Central which requires
all dependencies to be stable releases (no SNAPSHOT versions).

* Remove duplicate maven-source-plugin from release profile

The spring-data-parent POM already configures maven-source-plugin,
so having it again in the release profile causes a duplicate artifact error.
This enables publishing to Maven Central under the FalkorDB namespace,
which we have permissions for. The org.springframework.data namespace
requires Spring project authorization.
* Add @Interned annotation for low-cardinality string optimization

- Add @Interned annotation to mark string properties that should use FalkorDB's intern() function
- Update FalkorDBPersistentProperty interface with isInterned() method
- Implement @Interned support in DefaultFalkorDBEntityConverter with InternedValue marker class
- Update FalkorDBTemplate and DefaultFalkorDBEntityConverter to generate Cypher with inline intern() calls
- Add comprehensive tests for @Interned functionality
- Add README documentation explaining when and how to use @Interned
- Add InternedUsageExample demonstrating best practices for using @Interned annotation

This feature optimizes storage for properties with limited value sets (status codes, categories, country codes, etc.) by ensuring FalkorDB keeps only a single copy of frequently repeated string values.

* Remove ineffective @inherited meta-annotation from @Interned

@inherited only affects class-level annotations, not field-level ones.
Since @Interned targets ElementType.FIELD, the @inherited annotation
has no effect and should be removed.

Addresses CodeRabbitAI review comment.

* Fix escape sequence in @Interned annotation to properly handle backslashes

- Escape backslashes before single quotes to prevent injection issues
- Add comprehensive tests for backslash and quote escaping
- Addresses CodeRabbitAI security review comment on PR #16

The previous implementation only escaped single quotes, which could lead
to incorrect Cypher generation or potential injection issues when values
contained backslashes. Now backslashes are escaped first (doubled), then
single quotes are escaped with backslash-quote.

* Add repositoryFactoryBeanClass attribute to @EnableFalkorDBRepositories

- Add repositoryFactoryBeanClass attribute that specifies FalkorDBRepositoryFactoryBean
- This attribute is required for Spring Data to correctly instantiate repository proxies
- Ensures proper integration with Spring Data infrastructure

* Fix parameter binding in StringBasedFalkorDBQuery to prevent collisions

- Only use indexed parameter binding (-zsh, , etc.) for parameters without @param
- Use named parameter binding exclusively for parameters with @param annotation
- Prevents parameter collision when mixing indexed and named parameters
- Improves predictability and correctness of query parameter binding

Previously, all parameters were first added as indexed, then named parameters
were added, which could cause unexpected behavior if parameter names matched
index values.

* Add support for scalar and Map return types in repository queries

- Add flexible query method with result mapper to FalkorDBOperations/Template
- Support scalar return types (String, Integer, Long, Boolean, etc.) in @query methods
- Support Map and List<Map> return types for raw result handling
- Add queryForScalar() to extract single column values
- Add queryForMaps() to return raw Map results without entity mapping
- Add proper type conversion for Number types
- Fix FalkorDBQueryLookupStrategy initialization with proper constructor

This allows repository methods to return:
- Single scalar values: @query("RETURN count(*)") Long count();
- Collections of scalars: @query("RETURN n.name") List<String> names();
- Single Map: @query("RETURN n{.*}") Map<String, Object> getMap();
- Collections of Maps: @query("RETURN n{.*}") List<Map<String, Object>> getMaps();

Previously, only entity types were supported as return values.

* Add support for Number to String conversion in entity converter

- Allow automatic conversion of numeric values to String type
- Useful for cases where IDs are Long in database but String in entity
- Handles scenarios like internal FalkorDB IDs being mapped to String properties

This enables flexibility in entity ID type declarations while maintaining
compatibility with FalkorDB's internal numeric ID system.
Copilot AI review requested due to automatic review settings November 5, 2025 08:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request appears to remove a significant amount of Spring Data Neo4j infrastructure code and adds new FalkorDB-specific implementation files. The changes represent a major shift from Neo4j to FalkorDB as the underlying graph database, introducing new packages, classes, and repository support for FalkorDB while removing existing Neo4j core functionality.

Key changes:

  • Removal of core Neo4j operational classes (clients, templates, configurations)
  • Addition of complete FalkorDB repository and query infrastructure
  • Introduction of FalkorDB-specific schema annotations and mapping context
  • Removal of Neo4j testing and documentation files

Reviewed Changes

Copilot reviewed 174 out of 1052 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
FluentNeo4jOperations.java Removed Neo4j fluent operations interface
FluentFindOperation.java Removed Neo4j fluent find operation definitions
Multiple Neo4j core files Removed Neo4j client, template, and provider implementations
FalkorDB repository files Added complete repository infrastructure for FalkorDB
FalkorDB schema files Added FalkorDB-specific annotations (@node, @relationship, etc.)
FalkorDB core files Added FalkorDB client, template, and operations implementations
FalkorDB mapping files Added entity mapping and conversion infrastructure
Relationship.java Updated to support FalkorDB with added UNDIRECTED direction

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +141 to +142
// entityConverter).saveRelationships(instance, entityId);
// }
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed. These lines appear to be duplicates of the code on lines 138-139 and serve no purpose.

Suggested change
// entityConverter).saveRelationships(instance, entityId);
// }

Copilot uses AI. Check for mistakes.
@barakb barakb closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants