-
Notifications
You must be signed in to change notification settings - Fork 9
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
Problem with % in URI #14
Comments
The problem only seems to happen when using prefixes. If I use full URIs, the problem goes away.
|
That's because in N3, QNames have a prescribed form that disallows the %-encoded URI. A QName has a prefix and a local part, both of which must be NCNames. From Namespaces [1], an NCName is composed of the following characters:
None of these include '%'. The bug is in the serializer, which does not ensure that an attempt to shorten a URI to a QName ensures that the result is a valid QName. Note that RDFa uses CURIes, instead of QName, and this would be a valid CURIE. I'll update the serializer for N3 (and for RDF/XML) to do this. This should result in the following:
[1] http://www.w3.org/TR/1999/REC-xml-names-19990114/#dt-NSDecl |
Thanks for the quick response! I am not too familiar with the details of the standards, as you can see. :) I've been experimenting a bit, and found another workaround for this. If you specify the base_uri instead of a prefix, reading and writing work without errors. BASE_URI = URI.new("http://dbpedia.org/resource/")
repository.dump(:n3, {:prefixes => PREFIXES, :base_uri => BASE_URI}) results in:
|
Ran into a similar issue when trying to parse data from dbpedia.org. http://dbpedia.org/data/S'ym.n3 In the last statement on the page, the local portion of the qname contains a single-quote. No doubt, caused by the serializer on dbpedia's end. Nevertheless, it is quite frustrating. |
I have some TTL data as follows:
etc
I receive the following error when trying to parse this data with RDF::Reader.for(:n3).new(data)
I originally wrote this data using the same parser.
Any help you can provide would be greatly appreciated!
The text was updated successfully, but these errors were encountered: