Some of the tests in the W3 Conformance suite appear to have relative URIs with no base URI supplied. I'm assuming I need to provide a default. As best I can tell, the specification states that a default base URI is "application-dependent", as per RFC3986, section 5.1.4.

I interpreted this as meaning it could be dependent on the triple-store, and since the store in question here is one I'm not only creating specifically to run tests on, but am also implementing, I figured it was appropriate to set its default base URI to whatever I wanted; namely, something it could interpret specifically as a test-related URI, and therefore look in a special location for the data files it's supposed to load.

For example, the query:

PREFIX : <http://example/> 
SELECT * 
FROM <data-g1.ttl>
{ ?s ?p ?o }

Would go to the server practically as-is, and the server would see <data-g1.ttl> as a relative URI. Seeing no base URI, would assign its default base URI - e.g. "http://testing.mycompany.com/" - combine that with the relative, resulting in "http://testing.mycompany.com/data-g1.ttl", and then interpret that as "go to this special folder of Turtle files on the server's hard drive, find 'data-g1.ttl', and load it".

Am I doing this even close to correctly?

(One of the problems I'm running into involves a translation step between receiving the SPARQL query and processing it. To process it, it needs to be expressed in a different language, and we're using OpenRDF's Sesame library plus our own custom visitor code to handle that. While the query above validates fine according to sparql.org's validator, Sesame considers it a malformed query, precisely because of that relative URI. We can't tell Sesame what the default base URI should be, at the point we need to translate it, at least not without some nontrivial and inappropriate-looking redesign.)

asked 26 Nov '12, 18:21

Paul%20Brinkley's gravatar image

Paul Brinkley
733
accept rate: 0%

1

Not an answer to your question but perhaps a good workaround: since you are using Sesame's parser, have you considered using a BaseDeclProcessor? This is a syntax tree visitor implementation that can resolve any relative URIs in the syntax tree with a supplied base URI. It depends on whether you know the base URI at the point where you activate this processor of course... See http://www.openrdf.org/doc/sesame2/api/index.html?org/openrdf/query/parser/sparql/BaseDeclProcessor.html

(26 Nov '12, 18:54) Jeen Broekstra ♦ Jeen%20Broekstra's gravatar image

From what I understand of BaseDeclProcessor, all it does is conveniently resolve relative IRIs given the relative IRI and a base IRI - which means I still have to provide that base IRI, and at a time where I don't necessarily know that (although this micro-problem might be OBE now in my case). That said, it seems a fine way to do that resolution; beats picking the IRI string apart manually.

(27 Nov '12, 12:53) Paul Brinkley Paul%20Brinkley's gravatar image

The Base URI for each test should be the URI of the manifest file

The simplest way to add this would be to prepend a BASE declaration to each query e.g.

BASE <http://some-manifest/>
permanent link

answered 26 Nov '12, 18:56

Rob%20Vesse's gravatar image

Rob Vesse ♦
13.9k1715
accept rate: 29%

Thanks for the answer... it feels mildly skeezy to me, though, and I'm not sure why, which makes me think I'm missing something:

  1. There are dozens of manifest files, one for each group of tests in the entire conformance suite, each in a different location. It means the test code I'm writing would effectively be telling my server where the manifest is, which feels like knowledge of the server's internal structure that it shouldn't know.
  2. It still leaves my server with the job of turning that resolved IRI into a path on the server's filesystem (where data-g1.ttl, et al. are stored).
(27 Nov '12, 12:59) Paul Brinkley Paul%20Brinkley's gravatar image

To be honest it sounds like you are trying to test too much in one go. The point of the suite is to test your implementation of the SPARQL language which ideally should not require you to test your full server infrastructure as well (there are separate portions of the test suite for checking conformance with the SPARQPL protocol). Do you not have a way of producing a test harness which runs directly against your store?

(27 Nov '12, 13:13) Rob Vesse ♦ Rob%20Vesse's gravatar image

Well, not really testing the whole thing... but the "OBE" I hinted at in a comment earlier refers to something similar. I think I needed to just reexamine where I was drawing the line between client and server, such that the default base IRI can be known earlier.

(27 Nov '12, 14:30) Paul Brinkley Paul%20Brinkley's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1,284

question asked: 26 Nov '12, 18:21

question was seen: 451 times

last updated: 27 Nov '12, 14:30