Skip to content
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

URL guessing is conceptually wrong #15

Open
VladimirAlexiev opened this issue Jan 8, 2017 · 1 comment
Open

URL guessing is conceptually wrong #15

VladimirAlexiev opened this issue Jan 8, 2017 · 1 comment

Comments

@VladimirAlexiev
Copy link
Contributor

VladimirAlexiev commented Jan 8, 2017

As #4 explains, XSPARQL tries to guess whether a term is a URL or literal. Such guessing is error-prone and completely unnecessary: it should know if something is a URL or not from the script, no guessing is necessary.

Eg consider this script

prefix ex: <http://example.org>
declare option saxon:output "method=text";

let $http := "http://this is a literal"
let $ftp := "ftp://this.is.url.com/"
let $url := "relative-URL"
construct {
  ex:subj ex:prop
    "http://this is a literal",
    $http,
    <{$http}>,
    <ftp://this.is.url.com/>,
    $ftp,
    <{$ftp}>,
    $url,
    <{$url}>.
}

The output is as follows

ex:subj  ex:prop  "http://this is a literal" . # OK
ex:subj  ex:prop  <http://this is a literal> . # NOK
ex:subj  ex:prop  <http://this is a literal> . # OK
ex:subj  ex:prop  <ftp://this.is.url.com/> . # OK
ex:subj  ex:prop  "ftp://this.is.url.com/" . # OK
ex:subj  ex:prop  ftp://this.is.url.com/ . # NOK and a syntax error
ex:subj  ex:prop  "relative-URL" . # OK
ex:subj  ex:prop  <relative-URL> . # OK

You see that the guessing makes two mistakes:

  • for $http it wrongly assumes a URL because it starts with http://
  • for <{$ftp}> it fails to emit a URL (because the guessing is incomplete, see list of URL schemes is incomplete #4) but fails to emit a literal either (because <...> indicates a URL)
@VladimirAlexiev
Copy link
Contributor Author

#16 shows a specific example and code location

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants