Currently, the method OUtils.uriEncode promises to encode either a string representing either a full URI or URI fragment to something that is RFC 2396 compliant. However, at least when using this with Sesame and Turtle serialization, the encoded string is not always usable: if a fragment contains a slash, that slash is not encoded and then not usable in the name part of a turtle QName. In general, we should figure out if not all characters that are "reserved" in an UR should get encoded in the fragment part. This would mean that we have to find out of the string is just a fragment or a full URI reference so we can leave reserved characters alone before the fragment identifier and encode it inside the fragment identifier.
It may be better to add another utility function that is only meant to encode fragments and always encodes reserved characters or those that are not usable in a Turtle QName.
Log in to post a comment.