class RDF::Literal::AnyURI

anyURI represents a Uniform Resource Identifier Reference (URI). An anyURI value can be absolute or relative, and may have an optional fragment identifier (i.e., it may be a URI Reference). This type should be used to specify the intention that the value fulfills the role of a URI as defined by [RFC 2396], as amended by [RFC 2732].

@see www.w3.org/TR/xmlschema11-2/#anyURI @see www.ietf.org/rfc/rfc2396.txt @see www.ietf.org/rfc/rfc2732.txt

Constants

DATATYPE

Public Class Methods

new(value, datatype: nil, lexical: nil, **options) click to toggle source

@param [String, Object] value

If given a string, it will decode it as an object value.
Otherwise, it will take the value as the object and encode to retrieve a value

@param [String] lexical (nil)

Calls superclass method
# File lib/rdf/xsd/any_uri.rb, line 28
def initialize(value, datatype: nil, lexical: nil, **options)
  super(value, datatype: datatype, lexical: lexical)
  @object = RDF::URI(value)
  canonicalize! unless value.is_a?(String)
end

Public Instance Methods

canonicalize!() click to toggle source

Converts this literal into its canonical lexical representation.

@return [RDF::Literal] ‘self`

# File lib/rdf/xsd/any_uri.rb, line 38
def canonicalize!
  @string = @object.canonicalize
  self
end
valid?() click to toggle source

Returns ‘true` if the value adheres to the defined grammar of the datatype.

@return [Boolean]

# File lib/rdf/xsd/any_uri.rb, line 48
def valid?
  @object.validate! rescue false
end