RDFLib / sparqlwrapper

A wrapper for a remote SPARQL endpoint
https://sparqlwrapper.readthedocs.io/
Other
513 stars 121 forks source link

ListOfDict Support #160

Open WolfgangFahl opened 3 years ago

WolfgangFahl commented 3 years ago

To make life easier for Python developers a "ListOfDict" support would be nice as implemented in https://github.com/WolfgangFahl/pyLoDStorage/blob/master/lodstorage/sparql.py and tested in https://github.com/WolfgangFahl/pyLoDStorage/blob/master/tests/testSPARQL.py

see also http://wiki.bitplan.com/index.php/PyLoDStorage#SPARQL_unit_test

It allows for round-trip handling of list of dicts with native python datatypes and currently works for

What do you suggest about this Change Request?

I am offering to make this a separate OS project and make it availabe via pypi comparable to https://lawlesst.github.io/notebook/sparql-dataframe.html

Another way would be to directly integrate the code in sparqlwrapper.

nicholascar commented 3 years ago

In discussion with another RDFlib maintainer, it would be great to see this added to SPARQLWrapper. SPARQLWrapper is working well and extensions to it to export more modern data objects are to be encourage.

There are a couple of issues with the maintenance of SPARQLWrapper, mainly that the tests need some revision to see whey they always seem to have a couple of failures (see each PR in https://github.com/RDFLib/sparqlwrapper/pulls is failing) but, once this issue is fixed, it would be great to see a PR for this and have it merged.

WolfgangFahl commented 3 years ago

@nicholascar for the time being i decided to make this a separate project since I'd also like to get SQL and JSON support and may be later CVS and Dgraph and so on.

https://github.com/WolfgangFahl/pyLoDStorage

is the project it's available via https://pypi.org/project/pylodstorage/ and https://github.com/WolfgangFahl/pyLoDStorage/issues/6 is the issue which introduces the SPARQL support.

dhimmel commented 3 years ago

@WolfgangFahl can you update your original comment to use commit-hash versioned links (links are currently broken).

A way to get results as a list of dicts, where values used Python types, would be really nice. It would make addressing https://github.com/RDFLib/sparqlwrapper/issues/125 much easier.

WolfgangFahl commented 3 years ago

@dhimmel indeed it's better to have the links updated after the refactoring from the test project to the one that is already released and maintained and in use. If you'd like to get the pandas support integrated please file an issue at https://github.com/WolfgangFahl/pyLoDStorage/issues