Class: RDF::Literal::XML

Inherits:
RDF::Literal show all
Defined in:
lib/rdf/model/literal/xml.rb

Overview

An XML literal.

See Also:

Since:

Constant Summary

DATATYPE =

Since:

  • 0.2.1

RDF.XMLLiteral
GRAMMAR =

Since:

  • 0.2.1

nil

Constants inherited from RDF::Literal

FALSE, TRUE, ZERO

Instance Attribute Summary

Attributes inherited from RDF::Literal

#datatype, #language

Instance Method Summary (collapse)

Methods inherited from RDF::Literal

#==, #anonymous?, #canonicalize, #comperable_datatype?, #eql?, #has_datatype?, #has_language?, #hash, #inspect, #invalid?, #literal?, #object, #plain?, #valid?, #validate!, #value

Methods included from Term

#<=>, #==, #constant?, #eql?, #variable?

Methods included from Value

#graph?, #inspect, #inspect!, #iri?, #literal?, #node?, #resource?, #statement?, #to_ntriples, #to_quad, #to_rdf, #type_error, #uri?, #variable?

Constructor Details

- (XML) initialize(value, options = {})

A new instance of XML

Parameters:

  • value (Object)
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :lexical (String) — default: nil

Since:

  • 0.2.1



15
16
17
18
19
# File 'lib/rdf/model/literal/xml.rb', line 15

def initialize(value, options = {})
  @datatype = options[:datatype] || self.class.const_get(:DATATYPE)
  @string   = options[:lexical] if options.has_key?(:lexical)
  @object   = value # TODO: parse XML string using REXML
end

Instance Method Details

- (RDF::Literal) canonicalize!

Converts this literal into its canonical lexical representation.

Returns:

See Also:

Since:

  • 0.2.1



26
27
28
29
# File 'lib/rdf/model/literal/xml.rb', line 26

def canonicalize!
  # TODO: implement XML canonicalization
  self
end

- (String) to_s

Returns the value as a string.

Returns:

  • (String)

Since:

  • 0.2.1



35
36
37
# File 'lib/rdf/model/literal/xml.rb', line 35

def to_s
  @string || @object.to_s # TODO
end