-
Notifications
You must be signed in to change notification settings - Fork 14
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
An implementation of the SPARQL 1.1 Graph Store Protocol #5
Conversation
Relative imports make it impossible to do python -n rdfextras_web.endpoint because this runs rdfextras_web/endpoint.py as __main__.
I did some work today: The endpoint now makes use of the API changes to Dataset implemented in the branch I also added my testcase. Maybe it shouldn't be based on I also updated the description of this pull request to reflect ongoing development, especially in rdflib. |
Just to let you know I've not forgotten this! I'll return to finalise the dataset changes in rdflib core shortly - and then we can get on to this. |
I've probably just made merging this a bit trickier, by both renaming the package and by making the applications into blueprints. I am happy to do it once the time comes! |
I seperated the the endpoint into two parts. One is It comes closer to an end now, there remain only two failing tests. About the tests: They are written as HTTP requests and responses in HTML and parsed by python for execution. I wonder whether it would be better to avoid HTML and instead write the tests in some trivial line based text format. I have some inner urge to go with a line based approach. |
FWIW, I tend to test server functions using direct calls to the HTTP handling code, or make using python code in my unit tests that makes calls to httplib. I think your GenericEndpoint could easily be tested using direct calls. I recently discovered httpretty which intercepts HTTP calls at the Python sockets level for doing mock responses - there's an example of use at https://github.com/wf4ever/ro-manager/blob/master/src/MiscUtils/MockHttpResources.py (static responses only). It's worked very well for me. |
This is a copy of http://www.w3.org/2009/sparql/docs/tests/data-sparql11/http-rdf-update/ The idea is to parse this HTML page and run the tests it contains.
Fixed missing Accept headers Uncommented a wrong test: This request should fail according to the testcase. To me and to my implementation, this request looks perfectly valid. Fixed relative URLs as path argument Fixed response codes: Changed several response codes. Mostly from 200 to 204 because there is no response body. Fixed bad turtle syntax Added comments indicating the changes (look for 'rdflib').
This parses all HTML files in test/endpoint_protocol and runs the tests they contain.
I rebased to celan up the commit history. I guess you will have to use Basically, I am now happy with the code. Any feedback? |
Upcoming: Support for Since my PC just broke down, this will have to wait a little. Maybe I can continue work in one week. |
This should make it much easier to write tests and it comes with github flavour!
The endpoint now works with Graph, ConjunctiveGraph and Dataset or any class implementing a compatible API.
Completed:
@gromgull If nobody complains, I would be happy if you could merge. |
I've merged your changes and my blueprint changes and pushed as a new branch https://github.com/RDFLib/rdflib-web/tree/uholzer-sparql11-graphstore Am I crazy, or does normal querying no longer work? Here https://github.com/RDFLib/rdflib-web/blob/uholzer-sparql11-graphstore/rdflib_web/endpoint.py#L89 we do g.graph.query, but g.graph is no longer set! Did I mess up the merge somehow? It looks the same in your branch :) |
Damn! Sorry, I messed up normal querying, forgot about it and did not run its tests. I indeed moved the the Quick untested fix: Modify the following function of
|
FWIW, I was looking at the N3 parser yesterday, and I noticed they seem to have a way of (nearly) wrapping a Graph in a ConjunctiveGraph:
-- https://github.com/gklyne/rdflib/blob/master/rdflib/plugins/parsers/notation3.py#L1749 #g |
I guess I can also change |
@gklyne : that snippet of code I have previously considered too ugly to live and I have a branch working towards streaming parsers where it is removed :) |
@gromgull: Yes, your solution works. Unfortunately, a test in
Do you have an idea what the problem could be? |
I got the tests of the old funcitonality working again. My new tests for the graphstore protocol still don't succeed, but this can be solved at a later point. Since the former tests work now and because this pull-request is now lingering around for too long, I take the freedom to merge this into master. |
This pull request is intended to get feedback. There are some issues to be addressed before merging:
Once this has been merged, I will work on the SPARQL 1.1 Protocol implementation, i.e. query and update.
This pull request is a part of #1.
The specification can be found here: http://www.w3.org/TR/sparql11-http-rdf-update/