-
Notifications
You must be signed in to change notification settings - Fork 8
Text Direction Proposal
This is a proposal for an addition to the RDF data model. It provides for literals that have an indicator for the initial direction when text is displayed.
This addition only affects the initial direction of text.
For more detailed control of displayable content, there is rdf:HTML
.
W3C
Unicode Characters
Language tags can also include a script component which also indicates the text direction. Explicit initial text direction, as proposed here, SHOULD override the script subtag. This enables RDF processors to operate without needing to have access to the language tag registry to interpret the script subtag if present.
See the section "Choosing a Language Tag".
Add the following:
- If a literal has a language tag, it MAY also have an initial text direction.
Such literals have datatype rdf:dirLangString
(alternative: rdf:i18nString
).
The value space of rdf:dirLangString
is the set of 3-tuples (lexical form, language tag, direction).
It would also be possible to extend rdf:langString
to have an optional direction component and not introduce a datatype. The value space of rdf:langString
is extended to have both 2-tuples (lexical form, language tag) and 3-tuples (lexical form, language tag, direction).
LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' [a-zA-Z0-9]+)?`
No whitespace is allowed before or after the --
.
Alt: to highlight direction in the grammar,
LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* DIRECTION?`
DIRECTION ::= ('--' [a-zA-Z]+)
(update: the original proposal was ('--' [a-zA-Z0-9]+)
which has a conflict in SPARQL.)
but this then has tokenizers recognizing out-of-place --
which may impact parser error messages.
The only valid strings for the direction in RDF 1.2 are "ltr
" and "rtl
" (lowercase).
This is not in the grammar; it is related to the value of a literal.
Often, the proposed syntax involved ^
.
"^
" is already used in SPARQL and might appear after a language tag.
"--
" avoids such problems, and does not involve any of the unused characters which might be helpful in the future.
Literal term equality: Two RDF terms are equal if they have the same language tag and same initial text direction.
(Outline)
The attribute dir=
applies to all contained elements (c.f. the behaviour of xml:base
).
It affects any xml:lang=
in the use of the contained content.
Section "17.4.3 Functions on Strings" - Argument Compatibility Rules. Add:
- The arguments have datatype
rdf:dirTextString
with identical language and text direction. - The first argument has datatype
rdf:dirTextString
, and the second argument has datatypexsd:string
.
Function | "abc"@ar |
"abc"@ar--rtl |
notes |
---|---|---|---|
LANG |
"ar" |
"ar" |
behaves like old text |
LANGDIR |
"" |
"rtl" |
New function |
DATATYPE |
rdf:langString |
rdf:dirLangString |
STRLANG
takes an optional third argument. STRLANG("text", "ar", "rtl")
.
LANG
does not return the direction component. This helps existing code.
LANGDIR("abc"@ar--rtl) -> "rtl"
LANGDIR("abc"@ar) -> ""
LANGDIR("abc") -> ""
LANGDIR(1) -> ""
LANGDIR(`<uri>`) -> error
isLANG(?x) -> isLiteral() && ( DATATYPE(?x) = rdf:i18nString || DATATYPE(?x) = rdf:langString )
LANGMATCH
- does apply to rdf:dirLangString
; only works on the language tag, not direction; it ignores the direction.
(comparison of language tagged strings)
This proposal is minimal — there are possible additions, and these should be considered when the basic form for RDF and SPARQL is settled.
-
Does not cover "
xsd:string
with direction"
"abc"@--ltr
-
Does not define whether
rdf:langString
andrdf:dirLangString
are related, e.g.,subclass
(simple entailment does not have "subclass") or derived datatype (by restriction or by extension -- the decimal hierarchy is by restriction).
Summary of the RDF-star WG wiki.
- Editor's guide
- Meeting minutes
- RDF terminology
- Scribes
- Use Cases collection
- RDF-star syntax and semantics:
- RDF-star "alternative baseline" (VOTED 2024.11.14 - frozen)
- RDF-star "liberal baseline" (current working version)
- RDF-star "minimal baseline" (VOTED 2024.07.18 - frozen - superseded by vote 2024.11.14 - deprecated)
- RDF-star "working baseline" (working version - deprecated)
- RDF‐star baseline examples
- RDF-star and LPGs
- Extending the baseline with "asserted" stuff
- systems and acronyms
- Task forces
- Text Direction considerations
- Text Direction Proposal
- Triple‐Edge-subgroup-proposals