You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by "TelicentPaul (via GitHub)" <gi...@apache.org> on 2024/02/28 14:49:21 UTC

[PR] GH-2270: Properly process objects passed in as xsd:string literals. [jena]

TelicentPaul opened a new pull request, #2301:
URL: https://github.com/apache/jena/pull/2301

   GitHub issue resolved #2270 
   
   Pull request Description:
   As illustrated in the sample code on the linked issue, when creating literal nodes of xsd:string type we are not converting the given objects to Strings but rather are leaving them as the original classes. Instead of UUIDs, the same effect can be made if passed Integers, Floats or any other object type. 
   `
   NodeFactory.createLiteralByValue(UUID.randomUUID(), XSDDatatype.XSDstring);
   NodeFactory.createLiteralByValue(9, XSDDatatype.XSDstring);
   NodeFactory.createLiteralByValue(9.99f, XSDDatatype.XSDstring);
   `
   What's interesting is that for numeric types, this isn't the case and if passing a (valid) string to numeric type everything works as expected.
   `
   NodeFactory.createLiteralByValue("9", XSDDatatype.XSDint);
   NodeFactory.createLiteralByValue("9.99", XSDDatatype.XSDfloat);
   `
   
   The fix is relatively simple. When processing the canonised form (using the "cannonicalise" (sic) method) of the XSDBaseStringType the original value is being returned. By contrast, if you look at the equivalent XSDBaseNumericType the value is converted into the appropriate type. 
   
   To that end, I've added some tests to illustrate this by creating both string and numerical literal nodes passing in differing classes.
   
   ----
   
    - [x] Tests are included.
    - [x] Documentation change and updates are provided for the [Apache Jena website](https://github.com/apache/jena-site/)
    - [x] Commits have been squashed to remove intermediate development commit messages.
    - [x] Key commit messages start with the issue number (GH-xxxx, or if in JIRA, JENA-xxxx)
   
   By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the [Contributor's Agreement](https://www.apache.org/licenses/contributor-agreements.html).
   
   ----
   
   See the [Apache Jena "Contributing" guide](https://github.com/apache/jena/blob/main/CONTRIBUTING.md).
   


-- 
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: pr-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


Re: [PR] GH-2270: Properly process objects passed in as xsd:string literals. [jena]

Posted by "rvesse (via GitHub)" <gi...@apache.org>.
rvesse merged PR #2301:
URL: https://github.com/apache/jena/pull/2301


-- 
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: pr-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


Re: [PR] GH-2270: Properly process objects passed in as xsd:string literals. [jena]

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on PR #2301:
URL: https://github.com/apache/jena/pull/2301#issuecomment-1969411318

   Please use "squash and merge" with care - the commit message isn't going to be great (requires human checking) and the merge is often being done by a different person to the contributor.


-- 
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: pr-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


Re: [PR] GH-2270: Properly process objects passed in as xsd:string literals. [jena]

Posted by "TelicentPaul (via GitHub)" <gi...@apache.org>.
TelicentPaul commented on PR #2301:
URL: https://github.com/apache/jena/pull/2301#issuecomment-1969223729

   Of course. For future reference, you can enable that within Pull Request themselves to remove manual steps, which can be potentially error prone in my experience. I'll also rebase the branch too while I'm at it. 
   
   https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests


-- 
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: pr-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org