@@ -73,6 +73,10 @@ export interface Literal {
73
73
* @link http://tools.ietf.org/html/bcp47
74
74
*/
75
75
language : string ;
76
+ /**
77
+ * the direction of the language-tagged string.
78
+ */
79
+ direction ?: 'ltr' | 'rtl' | '' | null ;
76
80
/**
77
81
* A NamedNode whose IRI represents the datatype of the literal.
78
82
*/
@@ -81,7 +85,7 @@ export interface Literal {
81
85
/**
82
86
* @param other The term to compare with.
83
87
* @return True if and only if other has termType "Literal"
84
- * and the same `value`, `language`, and `datatype`.
88
+ * and the same `value`, `language`, `direction`, and `datatype`.
85
89
*/
86
90
equals ( other : Term | null | undefined ) : boolean ;
87
91
}
@@ -254,16 +258,19 @@ export interface DataFactory<OutQuad extends BaseQuad = Quad, InQuad extends Bas
254
258
blankNode ( value ?: string ) : BlankNode ;
255
259
256
260
/**
257
- * @param value The literal value.
258
- * @param languageOrDatatype The optional language or datatype.
259
- * If `languageOrDatatype` is a NamedNode,
260
- * then it is used for the value of `NamedNode.datatype`.
261
- * Otherwise `languageOrDatatype` is used for the value
262
- * of `NamedNode.language`.
261
+ * @param value The literal value.
262
+ * @param languageOrDatatype The optional language, datatype, or directional language.
263
+ * If `languageOrDatatype` is a NamedNode,
264
+ * then it is used for the value of `NamedNode.datatype`.
265
+ * If `languageOrDatatype` is a NamedNode, it is used for the value
266
+ * of `NamedNode.language`.
267
+ * Otherwise, it is used as a directional language,
268
+ * from which the language is set to `languageOrDatatype.language`
269
+ * and the direction to `languageOrDatatype.direction`.
263
270
* @return A new instance of Literal.
264
271
* @see Literal
265
272
*/
266
- literal ( value : string , languageOrDatatype ?: string | NamedNode ) : Literal ;
273
+ literal ( value : string , languageOrDatatype ?: string | NamedNode | DirectionalLanguage ) : Literal ;
267
274
268
275
/**
269
276
* This method is optional.
@@ -308,3 +315,8 @@ export interface DataFactory<OutQuad extends BaseQuad = Quad, InQuad extends Bas
308
315
*/
309
316
fromQuad ( original : InQuad ) : OutQuad ;
310
317
}
318
+
319
+ export interface DirectionalLanguage {
320
+ language : string ;
321
+ direction ?: 'ltr' | 'rtl' | '' | null ;
322
+ }
0 commit comments