Skip to content
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

Support xsd:int type coercion #178

Closed
ebremer opened this issue Jul 6, 2021 · 2 comments · Fixed by #179
Closed

Support xsd:int type coercion #178

ebremer opened this issue Jul 6, 2021 · 2 comments · Fixed by #179
Labels
enhancement New feature or request
Milestone

Comments

@ebremer
Copy link
Contributor

ebremer commented Jul 6, 2021

Describe the bug
Using titanium 1.1.0, importing triples with, RdfDocument.of with setUseNativeTypes to true is being ignored.

To Reproduce
_:B58e8ccf8X2D76bcX2D46caX2D9912X2Dec48f4fe6d83 http://iiif.io/api/image/2#height "4652"^^http://www.w3.org/2001/XMLSchema#int .
_:B58e8ccf8X2D76bcX2D46caX2D9912X2Dec48f4fe6d83 http://iiif.io/api/image/2#width "6324"^^http://www.w3.org/2001/XMLSchema#int .

with above yields:
"http://iiif.io/api/image/2#height": [
{
"@value": "4652",
"@type": "http://www.w3.org/2001/XMLSchema#int"
}
],
"http://iiif.io/api/image/2#width": [
{
"@value": "6324",
"@type": "http://www.w3.org/2001/XMLSchema#int"
}
]
Expected behavior
should have yielded:
"http://iiif.io/api/image/2#height": 4652,
"http://iiif.io/api/image/2#width": "6324"

@filip26
Copy link
Owner

filip26 commented Jul 6, 2021

Hi,
thank you for reporting that.xsd:int is not supported now as the spec lists only xsd:boolean, xsd:double, xsd:string and xsd:integer.

TODO

  • print warning about an unsupported XSD type
  • implement xsd:int support (signed 32-bit integer)

@filip26 filip26 changed the title NativeTypes not being used Support xsd:int type coercion Jul 6, 2021
@filip26 filip26 added the enhancement New feature or request label Jul 6, 2021
@ebremer
Copy link
Contributor Author

ebremer commented Jul 7, 2021

The specification listed at https://www.w3.org/TR/json-ld11/, says "...all other numbers are interpreted as typed values with type xsd:integer". As no specific number types are listed, I would think it would be safe to assume that long, int, short, byte, nonNegativeInteger, etc, which are all subclassed from integer, could be supported without breaking any rules.

@filip26 filip26 linked a pull request Jul 7, 2021 that will close this issue
@filip26 filip26 added this to the 1.2.0 milestone Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants