Module: Spira::Resource

Includes:
RDF, InstanceMethods, Types
Included in:
Base
Defined in:
lib/spira/resource.rb,
lib/spira/resource/dsl.rb,
lib/spira/resource/validations.rb,
lib/spira/resource/class_methods.rb,
lib/spira/resource/instance_methods.rb

Overview

Spira::Resource is the main interface to Spira. Classes and modules include Spira::Resource to create projections of RDF data as a class. For an overview, see the README.

Projections are a mapping of RDF predicates to fields.

class Person
  include Spira::Resource

  property :name, :predicate => FOAF.name
  property :age, :predicate => FOAF.age, :type => Integer
end

RDF::URI('http://example.org/people/bob').as(Person) #=> <#Person @uri=http://example.org/people/bob>

Spira resources include the RDF namespace, and can thus reference all of the default RDF.rb vocabularies without the RDF:: prefix:

property :name, :predicate => FOAF.name

The Spira::Resource documentation is broken into several parts, vaguely related by functionality: * DSL contains methods used during the declaration of a class or module * ClassMethods contains class methods for use by declared classes * InstanceMethods contains methods for use by instances of Spira resource classes * Validations contains some default validation functions

See Also:

Defined Under Namespace

Modules: ClassMethods, DSL, InstanceMethods, Validations

Constant Summary

Instance Attribute Summary

Attributes included from InstanceMethods

#subject

Method Summary

Methods included from InstanceMethods

#==, #attributes, #copy, #copy!, #copy_resource!, #count, #data, #destroy!, #dirty?, #each, #errors, #exists?, #initialize, #node?, #reload, #rename!, #save!, #to_node, #to_rdf, #to_uri, #type, #type=, #update, #update!, #uri, #validate, #validate!

Methods included from Validations

#assert, #assert_numeric, #assert_set