fix(cloudext): do not JSON-encode scalar String property values - #621
Open
JJUN99 wants to merge 2 commits into
Open
fix(cloudext): do not JSON-encode scalar String property values#621JJUN99 wants to merge 2 commits into
JJUN99 wants to merge 2 commits into
Conversation
Neo4jSinkWriter JSON-encodes any property value for which TypeChecker.isArrayOrCollectionOfPrimitives() returns false. Since the check returned false for scalar strings (and String was missing from isPrimitiveOrWrapper), every string property was stored double-encoded with surrounding quotes (e.g. 102191 -> "102191"). The reasoner reads raw property values, so numeric functions in concept rules (sum, date_diff, ...) silently fail to match on such values and rule-derived properties all resolve to null. Reading the value directly raises NumberFormatException: For input string: '"102191"'. Treat scalar strings as storable as-is, and accept String elements inside arrays/collections for the same reason. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
JJUN99
requested review from
andylau-55,
caszkgui,
leywar and
matthewhyx
as code owners
August 11, 2026 03:33
Contributor
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
andylau-55
added a commit
to OpenSPG/cla-assistant
that referenced
this pull request
Aug 11, 2026
Author
|
Note on the failing |
This was referenced Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
After ingesting data through the local builder (e.g. the supplychain example), every property value except
id/nameis stored in Neo4j double-encoded with surrounding quotes, e.g.transAmt="102191"instead of102191.Because the reasoner reads raw property values, numeric functions in concept rules (
sum,date_diff, ...) silently match 0 rows on such values, so all rule-derived virtual properties (e.g.fundTrans1Month) resolve tonull. Returning the value directly raises:Root cause
Neo4jSinkWriter.writeNode/writeEdgeJSON-encode any value for whichTypeChecker.isArrayOrCollectionOfPrimitives()returnsfalse. That check returnsfalsefor scalar strings, andStringis also missing fromisPrimitiveOrWrapper(), so every string property gets passed throughJSON.toJSONString()and picks up an extra pair of quotes. The write side and the read side (reasoner expects raw values) are asymmetric.Fix
Treat scalar strings as storable as-is, and accept
Stringelements inside arrays/collections for the same reason. Two lines inTypeChecker.Verification
Applied this change to a running 0.8 server (hot-patched jar), rebuilt the supplychain example: all properties are stored clean, and concept rules computing over numeric string fields (fund transaction aggregates) produce correct non-null values.