Description
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')