Module: Spira::Type


Spira::Type can be included by classes to create new property types for Spira. These types are responsible for serialization a Ruby value into an RDF::Value, and deserialization of an RDF::Value into a Ruby value.

A simple example:

class Integer

  include Spira::Type

  def self.unserialize(value)

  def self.serialize(value)

  register_alias XSD.integer

This example will serialize and deserialize integers. It's included with Spira by default. It allows either of the following forms to declare an integer property on a Spira resource:

property :age, :predicate => FOAF.age, :type => Integer
property :age, :predicate => FOAF.age, :type => XSD.integer

Spira::Types include the RDF namespace and thus have all of the base RDF vocabularies available to them without the RDF:: prefix.

Defined Under Namespace

Modules: ClassMethods