1

Are non Latin characters allowed in the local part of QNames/CURIs? I have the following prefix definition: @prefix namespace <http://example.org/namespace/> .

And the following URIs:

<http://example.org/namespace/Sense_en_aircraft>
<http://example.org/namespace/Sense_ru_аэроплан>

are both QNames correct?: namespace:Sense_en_aircraft and namespace:Sense_ru_аэроплан

This is not very clear to me. Possible source: https://www.w3.org/2001/tag/doc/qnameids, https://www.w3.org/TR/xml/, https://www.w3.org/TR/curie/ and RFC3987

2 Answers 2

2

The rules for QNames and CURIEs are quite unrelated to each other, so this is really two separate questions.

The term QName has several different meanings depending on which spec you are referring to, but it is essentially a triple comprising prefix, local part, and namespace. The prefix and local part are both defined as NCNames, and can most definitely contain non-Latin characters; the exact set of characters depends on which version/edition of the XML specification you reference.

The question of what is allowed in the namespace part is a little ambiguous. In the Namespaces 1.0 specification, a namespace name was defined to be a URI reference (as defined in RFC 3986); in Namespaces 1.1 is was defined to be an IRI (as defined in RFC 3987). IRIs of course can include non-Latin letters, but URIs cannot. However, the Conformance statement of both documents states the conditions for a document to be conformant, and these conditions do NOT include a requirement that the namespace name be a valid URI or IRI. I understand that this omission was deliberate. Most software handling QNames therefore accepts any string of characters as a legitimate namespace name.

0

And yet, many RDF validators or parsers in my experience will not accept non-Latin characters, complaining about them not being valid QNames. [Edit: While I believe this is true, the example given below is invalid, my thanks to @Peeja for pointing that out. I will search for a valid one.]

Example I saw today was via https://www.w3.org/2015/03/ShExValidata/, which liked the first two examples but not the third.

dct:source <http://test.org/simple>;
dct:source <http://example.org/namespace/Sense_en_aircraft>;
dct:source <<http://example.org/namespace/Sense_ru_аэроплан>;
2
  • These lines each contain the same QName, dct:source. It's the second term that differs, and those are all expanded IRIs. The third one has a typo: there's an extra < at the start. Without that, the validator you linked to accepts the input for me (if I also make the rest of the document valid by defining the dct: prefix first and putting these predicate-object pairs after a subject node, like []).
    – Peeja
    Commented Jun 11, 2021 at 14:20
  • Ooh thank you @Peeja! I will have to go back and find another example if I can now!
    – John G
    Commented Oct 6, 2021 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.