Class Index | File Index

## Classes

- _global_
- jQuery
- jQuery.rdf
- jQuery.rdf.blank
- jQuery.rdf.databank
- jQuery.rdf.literal
- jQuery.rdf.pattern
- jQuery.rdf.resource
- jQuery.rdf.rule
- jQuery.rdf.ruleset
- jQuery.rdf.triple
- jQuery.typedValue
- jQuery.uri

# Class jQuery.rdf.literal

Represents an RDF literal.
Defined in: jquery.rdf.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| jQuery.rdf.literal(value, options) Creates a new jQuery.rdf.literal object.

Field Summary
Field Attributes | Field Name and Description
--- | ---
| datatype The datatype of the literal, if it has one; otherwise undefined.
| lang The language of the literal, if it has one; otherwise undefined.
| type Always fixed to 'literal' for literals.
| value The value of the literal as a string.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| dump() Returns a RDF/JSON representation of this blank node.
| toString() Returns a string representing this resource in Turtle format.

Class Detail
jQuery.rdf.literal(value, options)

Creates a new jQuery.rdf.literal object. This should be invoked as a method rather than constructed using new; indeed you will not usually want to generate these objects directly, since they are automatically created from strings where necessary, such as by jQuery.rdf#add.

    trueLiteral = $.rdf.literal(true);

    numericLiteral = $.rdf.literal(5);

    dateLiteral = $.rdf.literal('"2009-07-13"^^xsd:date', { namespaces: ns });

Parameters:
{String|boolean|Number} value
  Either the value of the literal or a string representation of it. If the datatype or lang options are specified, the value is taken as given. Otherwise, if it's a Javascript boolean or numeric value, it is interpreted as a value with a xsd:boolean or xsd:double datatype. In all other cases it's interpreted as a literal as defined in Turtle syntax.
{Object} options Optional
  Initialisation options for the literal.
{String} options.datatype Optional
  The datatype for the literal. This should be a safe CURIE; in other words, it can be in the format `uri` or `[curie]`. Must not be specified if options.lang is also specified.
{String} options.lang Optional
  The language for the literal. Must not be specified if options.datatype is also specified.
{Object} options.namespaces Optional
  An object representing a set of namespace bindings used when interpreting a CURIE in the datatype.
{String|jQuery.uri} options.base Optional
  The base URI used to interpret a relative URI in the datatype.

Throws:
{String}
  Errors if the string is not in a recognised format or if both options.datatype and options.lang are specified.

Returns:
  {jQuery.rdf.literal} The newly-created literal.

See:
  jQuery.rdf.pattern
  jQuery.rdf.triple
  jQuery.rdf.resource
  jQuery.rdf.blank

Field Detail
{jQuery.uri} datatype
The datatype of the literal, if it has one; otherwise undefined.

{String} lang
The language of the literal, if it has one; otherwise undefined.

{String} type
Always fixed to 'literal' for literals.

{String} value
The value of the literal as a string.
Method Detail
{Object} dump()
Returns a RDF/JSON representation of this blank node.

Returns:
  {Object}

{String} toString()
Returns a string representing this resource in Turtle format.

Returns:
  {String}

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Feb 04 2011 16:40:11 GMT+0100 (MEZ)