Skip to content

Commit f5e18ab

Browse files
committed
Add directional language tagged literals
1 parent e03a9fc commit f5e18ab

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

index.html

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ <h3><dfn>Literal</dfn> interface</h3>
225225
attribute DOMString termType;
226226
attribute DOMString value;
227227
attribute DOMString language;
228+
attribute DOMString? direction;
228229
attribute NamedNode datatype;
229230
boolean equals(optional Term? other);
230231
};
@@ -241,11 +242,17 @@ <h3><dfn>Literal</dfn> interface</h3>
241242
<dfn>language</dfn> the language as lowercase [[BCP47]] string (examples:
242243
<code>"en"</code>, <code>"en-gb"</code>) or an empty string if the literal has no language.
243244
</p>
245+
<p>
246+
<dfn>direction</dfn> is defined if the string is a directional language-tagged string.
247+
In this case, the <code>direction</code> MUST be either be <code>"ltr"</code> or <code>"rtl"</code>.
248+
</p>
244249
<p>
245250
<dfn>datatype</dfn> a <code>NamedNode</code> whose IRI represents the datatype of the literal.
246251
</p>
247252
<p>
248-
If the literal has a language, its datatype has the IRI
253+
If the literal has a language and a direction, its datatype has the IRI
254+
<code>"http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"</code>.
255+
If the literal has a language without direction, its datatype has the IRI
249256
<code>"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"</code>. Otherwise, if no
250257
datatype is explicitly specified, the datatype has the IRI
251258
<code>"http://www.w3.org/2001/XMLSchema#string"</code>.
@@ -254,7 +261,8 @@ <h3><dfn>Literal</dfn> interface</h3>
254261
<dfn>equals()</dfn> returns <code>true</code> if
255262
all general <a>Term.equals</a> conditions hold,
256263
<code>term.value</code> is the same string as <code>other.value</code>,
257-
<code>term.language</code> is the same string as <code>other.language</code>, and
264+
<code>term.language</code> is the same string as <code>other.language</code>,
265+
<code>term.direction</code> is the same string as <code>other.direction</code> or are both undefined, and
258266
<code>term.datatype.equals(other.datatype)</code> evaluates to <code>true</code>;
259267
otherwise, it returns <code>false</code>.
260268
</p>
@@ -383,13 +391,19 @@ <h3><dfn>DataFactory</dfn> interface</h3>
383391
interface DataFactory {
384392
NamedNode namedNode(DOMString value);
385393
BlankNode blankNode(optional DOMString value);
386-
Literal literal(DOMString value, optional (DOMString or NamedNode) languageOrDatatype);
394+
Literal literal(DOMString value, optional (DOMString or NamedNode or DirectionalLanguage) languageOrDatatype);
387395
Variable variable(DOMString value);
388396
DefaultGraph defaultGraph();
389397
Quad quad(Term subject, Term predicate, Term _object, optional Term? graph);
390398
Term fromTerm(Term original);
391399
Quad fromQuad(Quad original);
392400
};
401+
402+
[Exposed=(Window,Worker)]
403+
interface DirectionalLanguage {
404+
attribute DOMString language;
405+
attribute DOMString? direction;
406+
};
393407
</pre>
394408

395409
<p>
@@ -404,10 +418,13 @@ <h3><dfn>DataFactory</dfn> interface</h3>
404418
parameter is undefined a new identifier for the blank node is generated for each call.
405419
</p>
406420
<p>
407-
<dfn>literal()</dfn> returns a new instance of <code>Literal</code>. If
408-
<code>languageOrDatatype</code> is a <code>NamedNode</code>, then it is used for the value of
409-
<code>datatype</code>. Otherwise <code>languageOrDatatype</code> is used for the value of
410-
<code>language</code>.
421+
<dfn>literal()</dfn> returns a new instance of <code>Literal</code>.
422+
If <code>languageOrDatatype</code> is a <code>NamedNode</code>,
423+
then it is used for the value of <code>datatype</code>.
424+
If <code>languageOrDatatype</code> is a <code>DirectionalLanguage</code>,
425+
then its <code>language</code> and <code>direction</code> attributes
426+
are respectively used for the literal's <code>language</code> and <code>direction</code>.
427+
Otherwise <code>languageOrDatatype</code> is used for the value of <code>language</code>.
411428
</p>
412429
<p>
413430
<dfn>variable()</dfn> returns a new instance of <code>Variable</code>. This method is

0 commit comments

Comments
 (0)