property-path/path-ng-01.rq needs a BASE
VladimirAlexiev opened this issue · 11 comments
https://github.com/BorderCloud/TFT-tests/blob/master/sparql11-test-suite/property-path/path-ng-01.rq:
prefix : <http://www.example.org/>
select ?t
where {
GRAPH <ng-01.ttl> {
?s :p1* ?t }
}
Sesame reports "Not a valid (absolute) URI: ng-01.ttl". The query needs a BASE.
Maybe many of the w3c tests involving graphs, suffer from a similar problem.
If you see other problems like that, it's necessary to mark each error before to ask an autorisation to fix the test-suite of W3C.
Thanks
Karima
Mark it where? Should I continue to post issues in this project, or somewhere else?
Mark it in this project.
In january, we will make a final report with the list of wrong tests for the W3C.
Same for
- pp35:
FILTER (?g = <ng-01.ttl>)
- Exists within graph pattern:
graph <exists02.ttl>
- constructwhere04:
FROM <data.ttl>
- syntax-construct-where-02.rq:
FROM <file>
- syntax-oneof-03.rq:
IN(1,<x>)
Same for:
- syntax-update-04.ru:
INTO GRAPH <localCopy>
- syntax-update-08.ru:
DROP GRAPH <graph>
- syntax-update-12.ru:
DROP SILENT GRAPH <graph>
- syntax-update-13.ru:
CREATE GRAPH <graph>
- syntax-update-14.ru:
CREATE SILENT GRAPH <graph>
- syntax-update-22.ru:
CLEAR SILENT GRAPH <graph>
- syntax-update-23.ru:
- syntax-update-24.ru:
- syntax-update-25.ru:
- syntax-update-26.ru:
GRAPH <G>
- syntax-update-28.ru:
GRAPH <G>
- syntax-update-29.ru:
- syntax-update-30.ru:
- syntax-update-31.ru:
GRAPH <G>
,GRAPH <G1>
- syntax-update-36.ru:
GRAPH <G> { <s> <p> 123 ; <q> 4567.0 . }
- syntax-update-37.ru:
INTO GRAPH <g>
- syntax-update-53.ru:
GRAPH<g1> { _:b1 :p :o }
Having no base URI inside the query is not a bug. When no base URI is defined inside a SPARQL query to resolve relative URIs against, a SPARQL processor is expected to try and use a base URI supplied by the environment (per RFC 3986, section 5.1.2 "Base URI from the encapsulating entity").
You just need to make sure you supply Sesame with a base URI when you tell it to read the file and parse the query.
Right, http://www.w3.org/TR/sparql11-query/#relIRIs gives the details. I'm also copying relevant text from RFC 3986:
- Section 5.1.2, "Base URI from the Encapsulating Entity" defines how the Base IRI may come from an encapsulating document, such as a SOAP envelope with an xml:base directive or a mime multipart document with a Content-Location header.
- The "Retrieval URI" identified in 5.1.3, Base "URI from the Retrieval URI", is the URL from which a particular SPARQL query was retrieved. if a URI was used to retrieve the representation, that URI shall be considered the base
- If none of the above specifies the Base URI, the default Base URI (section 5.1.4, "Default Base URI") is used. "then the base URI is defined by the context of the application"
But which of these cases applies for a query that's made with GET or POST against an endpoint? I assume that's the way TFT tests are run, and even that's the intended way W3C SPARQL tests are intended to be run (they test SPARQL protocol endpoints). As far as I can see, http://www.w3.org/TR/sparql11-protocol doesn' t talk about executing queries from files.
Sorry for my silence, I was very busy.
I understood your problem.
Now, TFT inserts in each query the base URI.
You can see the result in the new score: http://sparqlscore.com/
Bye
Thanks!!!
Though I still don't understand which is "THE base uri" :-)
Base uri is the same concept to resolve the relative URL in a page html.
You can write in your page HTML <a href="Thing.html">Thing</a>
only because your navigator knows the base URL of the current page.
For example, in the page http://example.org/index.html ,
you have the relative link <a href="Thing.html">Thing</a> so the navigator
can resolve this relative URL in absolute URL with the Base URL "http://example.org/"
of the current page in the navigator. So the absolute link is <http://example.org/Thing.htm>
TFT is like the navigator and write now the base URI with the relative URI in your query.
For example :
BASE <https://github.com/BorderCloud/TFT-tests/blob/master/sparql11-test-suite/property-path/>
prefix : <http://www.example.org/>
select ?t
where {
GRAPH <ng-01.ttl> {
?s :p1* ?t }
}
The precedent query is equivalent to :
prefix : <http://www.example.org/>
select ?t
where {
GRAPH <https://github.com/BorderCloud/TFT-tests/blob/master/sparql11-test-suite/property-path/ng-01.ttl> {
?s :p1* ?t }
}
(Sorry for my english)
Ok, I see!
Though maybe this is a better base https://raw.githubusercontent.com/BorderCloud/TFT-tests/master/sparql11-test-suite/property-path/ since it serves the actual file.
(The one you used serves a webpage where the file is displayed)
Of course, this is optional since these URLs aren't really used by anything. At least currently.