-
Notifications
You must be signed in to change notification settings - Fork 28
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
TripleSerializer treatment of prefixes #12
Comments
Duly noted, thanks. I will take a look at this in a few weeks. |
@robstewart57 I have some time to spare, I can take a look at it in the meantime. |
@cordawyn That'd be great! |
So here's a summary on the issue: RDF graphs that are created by parsers have their "namespaced" nodes expanded into full URIs. However, if an RDF graph is created manually (i.e. by building sets of I tried to hook an automatic namespace expansion to
So here's what I suggest to do about it:
I also ponder refactoring the whole RDF graph building routine, so as to make it possible to add triples to it iteratively (and perform namespace expansion as they're added). Perhaps, wrap it in some "RDFGraph" (writer) monad and make it work in a similar fashion to building SPARQL queries in So, what are your thoughts on this? |
Hi,
I agree that this is confusing and will probably lead to confusion differences in RDF graphs.
That's less than ideal...
So you're suggesting that a triple passed to
And extracting this triple from an RDF after
That's fair enough. However, I feel that in the following three type class methods, the returned
Or what about splitting
I'm less certain that such a dramatic change would yield the big benefits required to justify the effort. Feel free to try an implementation of an RDFWriter monad :-) So, I'm suggesting:
Thoughts? |
I should add, to have a far greater confidence in this library I really think we should add the W3C RDF test suite. That is, add them in |
Okay, I'll start with adding the tests first, then switch to the namespace expansion issue. As a programmer though, I'd prefer to have two nodes equal, namespaced or expanded, whenever we have to compare those instances:
Having 2 node constructors ( As a side note: after reexamining the code in So, to summarize, I'm fine with all of your suggestions, but will try an improved solution based on them ;-) |
Great, thanks. I've added you as a collaborator so you should have direct push access.
OK, does that give us enough confidence then to go ahead and do this? |
I haven't completely given up on the alternative yet, but I think your approach would work just fine for now. We can start implementing your suggestion, yes. If you want to start right now, feel free to go ahead. Otherwise, I can get down to coding in about a day. |
I'm travelling over the next few days, so please feel free to get started adding the W3C tests and deferring namespace expansion. |
dear rob thank you for your reply. andrew On 09/07/2014 12:33 AM, Rob Stewart wrote:
Prof. Dr. sc.techn. Dr. h.c. Andrew U. Frank |
@cordawyn Hi, how are the W3C unit tests coming along? Do we fail most of them, or pass most of them? |
@robstewart57 I got distracted from RDF4H a few weeks ago, so I haven't finished writing that stuff yet. I made a few fixes to our parser to actually read the manifest files that list the tests, define the expected results and so on. You can take a look at my w3tests branch here: https://github.com/cordawyn/rdf4h/tree/w3tests -- there are several commits there. I'll definitely get back to coding the tests, but cannot tell when exactly. If you feel like continuing, you can get that branch for yourself. P.S.: As a side note, those fixes are not in line with the "written" W3C specs, but W3C actually has unit tests specifically for those exceptions. So now we should be passing 2 more W3C unit tests and read/parse their manifest files at the same time ;-) |
Actually, I think I'll get back to it tomorrow or so. I've just recalled that I was getting to "the good parts" there :-) |
thank you for the progress report. i have looked at the code and made Prof. Dr. sc.techn. Dr. h.c. Andrew U. Frank On 11/12/2014 09:44 PM, Slava Kravchenko wrote:
|
@cordawyn Your w3tests branch looks like a great start 👍 @andrewufrank I'd be interested in your use case for rdf4h? I notice that @jutaro has forked to create this commit df671af . @jutaro is there anything else you'd like to commit before I should merge? It'd be nice to avoid duplicating code contributions. |
@robstewart57 As a side task for this branch (while I'm busy coding the actual tests), I'm thinking about "automatic" fetching of W3C test files. They take about 6 Mb and I don't think we should place them in the repo (they are probably updated occasionally at W3C server, too). My tests expect them to be placed in I don't know if there's a blessed way to do it in Haskell tests, but I would probably do as follows:
I hope I don't sound too confusing ;-) Does this all make sense? |
I've completed the test suite for turtle parser. Here's the results:
The updated test suite code is available at "w3tests" branch. |
@cordawyn Wow, it looks like the effort to include W3C tests has been vindicated :-) 114 out of 291 failing tests leaves room for improvement. RE: the 6Mb test data, It looks like we have two choices:
https://github.com/haskell-distributed/distributed-process-tests
Which do you think we should opt for? |
dear robert i prefer the first route -
i think a clear message in the cabal description pointing to the test thank you for effort to improve rdf4h! andrew Prof. Dr. sc.techn. Dr. h.c. Andrew U. Frank On 11/23/2014 10:21 PM, Rob Stewart wrote:
|
@robstewart57 I don't like the idea of having W3C data files in the repository. I believe we need a dedicated task (or a shell script) to download it, regardless of how we arrange the test suite - together with the main project or separately. As for the 1st choice that you suggest, it sounds to be in line with the policy of having Do we have some "good practices" in Haskell to address these issues (test data files and separation of core and test packages)? I'll have to ask around. @andrewufrank I think it is possible to avoid downloading and building test dependencies if you can run cabal as |
@robstewart57 Breaking news! Our There are also (minor, so far) errors in "manifest.ttl" files, I'm sending the reports to W3C to fix them (if anyone has a quicker r/w access to those test suite files, please help ;-) ). |
So now we're now propagating bug reports up to W3C now? Success! |
All thanks to the "strictly typed power" of Haskell ;-) Anyway, I'm somewhat done with the tests for now. We're running 2 out of 6 test suites from W3C: Turtle tests and RDF/XML tests. The remaining issues are:
RDF/XML test results are:
I added the parsing issues to our bug tracker. I cannot continue with Haskell part of the test suites until they're fixed, but I'll add a task to download W3C data files to our Btw, we should probably switch to a dedicated issue with this W3C test suite, before we go off-topic any further ;-) Here it is: #17 |
I'm back on this original issue. So I'm going to add namespace expansion to |
@andrewufrank Several tests and trials later, we've come to the agreement that URI expansion (expanding prefixes and absolutizing relative URIs) and removing duplicates (if necessary) should be performed by the library users and will not be a part of graph implementations in RDF4H. We're going to export the functions necessary for that and update README with a note and examples. Stay tuned for the next update! |
the documentation gives the impression that the conversion from triples to an rdf (eg. TripleGraph) will handle the prefixes which are defined in the namespace. in my tests (and my perusal of the code) this seems not to be the case.
i suggest to update the documentaiton accoringly (or to implement the mapping of prefixes).
thank you for very useful code!
andrew frank
The text was updated successfully, but these errors were encountered: