afs commented on issue #2248:
URL: https://github.com/apache/jena/issues/2248#issuecomment-1930402344

   I thought the mistake probably arose at the RDF 1.0 to RDF 1.1 boundary. 
   
   In RDF 1.0 strings don't have a datatype; in RDF 1.1, they do (xsd:string). 
That then explains "For typed literals" -- strings are typed literals nowadays.
   
   But its the same code in Jena 2.
   
   Just above `getString`
   ```
    @Override
       public double getDouble()  {
           if (isPlainLiteral()) {
               return Double.parseDouble(getLexicalForm());
           } else {
               return asNumber(getValue()).doubleValue();
           }
       }
   ```
   
   Operations like "getDouble" attempt to parse the lexical form 
`Double.parseDouble(getLexicalForm())`. These operations are not "get if 
double" despite that being the natural reading (nowadays). So "getString" 
returning the lexical form is "parse as string".
   
   There is a good case for a redone Model-like API using more modern idioms 
and expected naming.
   
   Binary compatibility does seem to be appreciated by users.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to