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

Improve support for numeric datatypes #707

Open
jaw111 opened this issue Oct 1, 2024 · 0 comments
Open

Improve support for numeric datatypes #707

jaw111 opened this issue Oct 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jaw111
Copy link

jaw111 commented Oct 1, 2024

Community Note

  • Please use a 👍 reaction to provide a +1/vote. This helps the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Graph Notebook Version (and Graph Database and Version used if applicable)
4.6.0 (Amazon Neptune 1.2.1.0)

Is your feature request related to a problem? Please describe.
When I use the %%sparql magic with --store-to and --store-format parameters to store the results of a SPARQL SELECT query to a dataframe, all the values in the dataframe are handled as strings, whilst the RDF literals have standard XSD datatypes like xsd:integer or xsd:decimal.

Describe the solution you'd like
When processing the results of a SELECT query, add handling for standard XSD datatypes that can be handled as numerics in a dataframe.

Also add error handling if the lexical value cannot be interpreted according to the datatype. For example a typed literal like "example"^^<http://www.w3.org/2001/XMLSchema#integer> may occur in RDF data, but the value cannot be interpreted as an integer. Could fallback to string in such cases.

Additional context
Workaround is to add a post-processing step to convert values from string to numeric for each variable/field where we expect numeric values:

df.x = pd.to_numeric(df.x, errors='coerce')
@jaw111 jaw111 added the enhancement New feature or request label Oct 1, 2024
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

No branches or pull requests

1 participant