-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add SPARQL support #19
Comments
For Oxigraph I have build a SPARQL parser and a SPARQL algebra representation. Algebra: https://github.com/Tpt/oxigraph/blob/master/lib/src/sparql/algebra.rs It might be interesting to build it as a separated crate and make Sophia and Oxigraph depend on it, just like Rio. The parser is a bit slow at the moment, I am planning to rewrite it using a more efficient parsing library, probably nom. But I plan to make a working 0.1 release of Oxigraph first. |
Thanks @Tpt for chiming in.
I have considered this. But as I mentioned above, in sophia it would be more natural to reuse the |
Huge +1. We could maybe have the parser in a separated crate with a fairly cheap algebra representation. Then Sophia could expose an easy to use algebra tree on top of it and Oxigraph could build from it its query plans. An other way to go would be to have an "rdf-api" crate similar to what RDF/JS is doing for the RDF models and its commons extensions. And have Oxigraph and Sophia and hopefully the other RDF related libraries in Rust use it. But it might be hard to build a nice and efficient API without GAT. |
This should probably be discussed in a separate thread. I created #23 for this. And yes, GAT would be a huge help in this direction. |
Isaac Newton invented calculus while quarantined, so I guess I can write a SPARQL parser? I've used the oxigraph library quite a bit, and I like it, but the slowest part of it is its parser (acknowledged by @Tpt). I guess I can just start writing one and then ask for feedback? I'd like to to parse into a common AST. I guess using the oxigraph algebra is sufficient? |
@dwhitney that would awesome... :-) Sophia has evolved quite a bit in the meantime, in order to be more usable as a common API for RDF in Rust. @Tpt and I have agreed (in a discussion offline) that a good way forward would be to extract oxigraph's SPARQL parser and AST into a separate crate, using sophia's FYI, the |
@dwhitney Great! Thank you! I have done some changes in the parser that have significantly improve the speed of the current parser (migration to peg 0.6 and avoiding duplicate parsing). |
Haven't had as much time as I'd like to look at this (still working from home). I found this parser. Have either of you taken a look at it? https://github.com/mattsse/nom-sparql |
@dwhitney I was not aware of this paper, thanks! There seems to be no code related to testing the parser against the W3C testsuite, I don't know how correct it is. |
Yeah if your parser's performance has increased enough, perhaps there is no
need to invest the time in a new one, but before you made your
improvements, parsing was often the slowest part of the query by several
orders of magnitude.
…On Sun, Mar 22, 2020, 2:22 PM Thomas Tanon ***@***.***> wrote:
@dwhitney <https://github.com/dwhitney> I was not aware of this paper,
thanks! There seems to be no code related to testing the parser against the
W3C testsuite, I don't know how correct it is.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAIFIIH7HSAOK7GVOURAT3RIZJO3ANCNFSM4JY2PGVA>
.
|
I was also thinking of implementing a SPARQL parser with nom before I found https://github.com/mattsse/nom-sparql which was mentioned by @dwhitney. It says it's a WIP in the README and there was no development for more than a year. I wonder whether @mattsse would be willing to adapt it to fit into A question for @pchampin is whether having |
Hi there 👋 it's been a while since I've worked on it. It was a small side project I only hacked on for few weeks. Unfortunately I did not finish it so far that I was pleased with it and felt good about publishing it and moved on... 🙈 Currently I've got some time on my hands and if that crate could be useful for
I wasn't aware that there is a test suite, If you can point me to where i can find it, I'd be happy to test against it @Tpt fwiw the parser should be already feature complete(ish), so the most work would probably be
|
I'm not the owner of The aim of @YEver, @mattsse Nice to see new people working on @mattsse You can find out about the SPARQL test suite here: https://www.w3.org/2009/sparql/docs/tests/README.html |
@mattsse The recent versions of the test suite are here: https://github.com/w3c/rdf-tests/tree/gh-pages/sparql11 Oxigraph already has |
@YEver asked
and @MattesWhite replied
To be more precise: the Now regarding SPARQL support, the first step would be to add new traits in
Then one or several implementations of these traits could be provided. For Oxigraph, this would amount to simply adapt the existing types to the traits above. But a generic implementation of I hope this clarifies things. |
Thanks @pchampin. This fits my expectations. I noticed that I thought that the I agree that creating the relevant traits for SPARQL would be a good first step that makes a lot of sense. In fact, I'll try to see how far I can go with implementing these traits and raise a pull request if I have something presentable. |
I have written a SPARQL parser with treesitter. Treesitter is very fast and has bindings for rust. Maybe this is of use. |
I have a very early implementation of a SPARQL engine for Sophia: https://github.com/pchampin/sophia_sparql It should be integrated in v0.9 (but it might not be fully compliant by that time). |
NB: since sophia uses a generalized RDF model (including variables), a Graph can also be used as a basic graph pattern. The query module contains a preliminary implementation of this idea.
The text was updated successfully, but these errors were encountered: