LiteralTerm.string constructor
- String value
Create a plain string literal
This is a convenience factory for creating literals with xsd:string datatype. In RDF, plain string literals use the xsd:string datatype, which is also the default when no datatype is specified.
Note: This factory is equivalent to using the primary constructor without any datatype or language parameters, but makes the intent clearer in the code.
Parameters:
value
The string value
Example:
// Create a string literal
final stringLiteral = LiteralTerm.string("Hello, World!");
// The following two literals are equivalent
final a = LiteralTerm.string("Hello");
final b = LiteralTerm("Hello");
Implementation
factory LiteralTerm.string(String value) {
return LiteralTerm(value, datatype: Xsd.string);
}