-
Notifications
You must be signed in to change notification settings - Fork 3
Solving Compatibility Issues with AllegroGraph #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
raphael-melo
approved these changes
Mar 21, 2023
…aph to make it more generic and close N3Lexe`s logic
…roperly unescaped
srfiorini
approved these changes
Mar 24, 2023
srfiorini
reviewed
Mar 24, 2023
srfiorini
reviewed
Mar 24, 2023
srfiorini
reviewed
Mar 24, 2023
… properly handle custom metaproperties (not XSD)
…Triples to properly handle custom metaproperties (not XSD)
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.
1. Changing default xsd type for non-integer numbers to decimal (from double)
Motivated by the recently detected differences between the number of decimal cases supported for double XSD in Jena Fuseki and AllegroGraph, as well as several external references that point towards the more general nature the decimal XSD, I propose we change the default serialization of non-integer numbers (frequently present in properties of an HKEntity) to decimal XSD.
External references:
OBS: I'm considering this to be a major release as it introduces a potentially (but not necessarily) breaking change.
2. Adding automatic unescaping of literals objects in JSONGraph
As detected in recent tests with Jena Fuseki and AllegroGraph, some literals with escaped double quotes were being retrieved unescaped in Jena's configuration and escaped in AllegroGraph's configuration. The main reason for this is that our TrigGraph implementation (based on N3.js library) that automatically unescapes literals stored in objects (such as JSON stored within a literal) was being used when retrieving SPARQL query results from Jena (which were in
application/trig
format), while in AllegroGraph's configuration is was not. This occurred because AllegroGraph retrieved the results inapplication/json
format, forcing the usage of our JSONGraph implementation, that does not perform automatic unescaping (since it is not based on N3.js library), instead of the TrigGraph implementation.As we could not find the list of supported SPARQL response mime types in AllegroGraph's HTTP Reference we tried using "application/trig", "application/n-quads", and "text/turtle" (which could be parsed with the TrigGraph) . For all of those, AllegroGraph retrieved an error response with 406 status code and an error message similar to the following:
We've also tried using the
application/sparql-results+ttl
mime type, which seemed to be similar to "text/turtle" (although it has not been explicitly mentioned SPARQL Protocol Specification) and parse the results as a TrigGraph pretending that it was in "text/turtle" format. Unfortunately this did not work and we had to pursue a different solution.Therefore, to maintain this behavior (of automatic unescaping) when using AllegroGraph, we reproduced part of the unescaping logic present in the N3.js library (used by the TriGraph) within our JSONGraph implementation.
3. Handling redundant escaping of quotes in AllegroGraph
During our tests, we also detected that some literals contained redundant escaping of double quotes and, to properly handle those cases, the
unescapeLiteral
method implemented in JSONGraph needed to be refactored to perform as many unescapes where necessary to produce a completely unescaped string. Nonetheless, this also required that we added an additional treatment in theupdateTriples
method the SPARQLFactory class, to properly escape those literals when generatingINSERT DATA
clauses of a SPARQL update query.