module Spira

Spira is a framework for building projections of RDF data into Ruby classes. It is built on top of RDF.rb.

@see rdf.rubyforge.org @see github.com/bhuga/spira @see Spira::Resource

Public Class Methods

clear_repository!() click to toggle source

Clear the repository from Spira's knowledge. Use it if you want, but it's really here for testing.

@return [Void] @private

# File lib/spira.rb, line 59
def clear_repository!
  Spira.repository = nil
end
repository() click to toggle source

The RDF::Repository used (reader)

@return [RDF::Repository] @see RDF::Repository

# File lib/spira.rb, line 38
def repository
  Thread.current[:repository]
end
repository=(repository) click to toggle source

The RDF::Repository used (reader)

@return [RDF::Repository] @see RDF::Repository

# File lib/spira.rb, line 48
def repository=(repository)
  Thread.current[:repository] = repository
end
type_alias(new, original) click to toggle source

Alias a property type to another. This allows a range of options to be specified for a property type which all reference one Spira::Type

@param [Any] new The new symbol or reference @param [Any] original The type the new symbol should refer to @return [Void]

# File lib/spira.rb, line 87
def type_alias(new, original)
  types[new] = original
end
types() click to toggle source

The list of all property types available for Spira resources

@see Spira::Types @return [Hash{Symbol => Spira::Type}]

# File lib/spira.rb, line 28
def types
  @types ||= {}
end
using_repository(repo) { || ... } click to toggle source

Execute a block on a specific repository

@param [RDF::Repository] repository the repository to work on @param [Symbol] name the repository name @yield the block with the instructions while using the repository

# File lib/spira.rb, line 69
def using_repository(repo)
  old_repository = Spira.repository
  Spira.repository = repo
  yield if block_given?
ensure
  Spira.repository = old_repository
end

Private Instance Methods

clear_repository!() click to toggle source

Clear the repository from Spira's knowledge. Use it if you want, but it's really here for testing.

@return [Void] @private

# File lib/spira.rb, line 59
def clear_repository!
  Spira.repository = nil
end
repository() click to toggle source

The RDF::Repository used (reader)

@return [RDF::Repository] @see RDF::Repository

# File lib/spira.rb, line 38
def repository
  Thread.current[:repository]
end
repository=(repository) click to toggle source

The RDF::Repository used (reader)

@return [RDF::Repository] @see RDF::Repository

# File lib/spira.rb, line 48
def repository=(repository)
  Thread.current[:repository] = repository
end
type_alias(new, original) click to toggle source

Alias a property type to another. This allows a range of options to be specified for a property type which all reference one Spira::Type

@param [Any] new The new symbol or reference @param [Any] original The type the new symbol should refer to @return [Void]

# File lib/spira.rb, line 87
def type_alias(new, original)
  types[new] = original
end
types() click to toggle source

The list of all property types available for Spira resources

@see Spira::Types @return [Hash{Symbol => Spira::Type}]

# File lib/spira.rb, line 28
def types
  @types ||= {}
end
using_repository(repo) { || ... } click to toggle source

Execute a block on a specific repository

@param [RDF::Repository] repository the repository to work on @param [Symbol] name the repository name @yield the block with the instructions while using the repository

# File lib/spira.rb, line 69
def using_repository(repo)
  old_repository = Spira.repository
  Spira.repository = repo
  yield if block_given?
ensure
  Spira.repository = old_repository
end