The Open Anzo Project

Semantic Application Middleware

Ticket #370 (closed defect: fixed)

Opened 7 months ago

Last modified 5 months ago

Invalid date in typed literal string causes exception

Reported by: jpbetz Assigned to: lee
Priority: minor Milestone: 3.0 milestone3
Component: openanzo-core Version: 3.0
Keywords: date time invalid parse Cc: lee, jordi

Description

The typed literal """1930-11-193"""^^xsd:date caused an exception to be thrown from new MemTypedLiteral(String,URI) because the date is an invalid format.

The error occurs when we attempt to construct a native object representing the date.

Change History

05/29/08 15:22:11 changed by jpbetz

(In [2375]) re #370 reviewer: lee

Set native value to null if lexical value cannot be parsed.

Lee, is this reasonable? Would it be better to fall back to a default value instead of null?

05/29/08 15:22:59 changed by jpbetz

  • owner changed from jpbetz to lee.

Lee,

Would you review and close if this is okay?

Thanks

05/29/08 15:52:33 changed by lee

Not really sure what's best.

For some applications, early detection (and exception) is best ... for others, invalid typed literals is OK and the app. chooses to deal with it as it chooses. IIRC, Jena and Sesame provide a configuration option as to how early / whether or not typed literals are checked for validity.

[2375] looks fine, just not sure if it's the best design. I'll leave open for further discussion; if we don't have any other guiding direction for now, please feel free to close.

08/14/08 15:36:00 changed by jordi

  • cc changed from lee to lee, jordi.
  • status changed from new to closed.
  • resolution set to fixed.

I believe that returning null is correct. It views the native value as a convenience for converting to Java types that only handles certain datatypes and only when they are well-formed.

The type conversion work done as part of #377 and documented at wiki:AnzoTypeConversions uses this approach which I believe is the correct one. If we change our minds and make it configurable in the future, then we can create an new ticket.

Copyright © 2007 - 2008 OpenAnzo.org