class ActiveTriples::Schema

Super class which provides a simple property DSL for defining property -> predicate mappings.

@example defining and applying a custom schema

class MySchema < ActiveTriples::Schema
  property :title,   predicate: RDF::Vocab::DC.title
  property :creator, predicate: RDF::Vocab::DC.creator, other: :options
end

resource = Class.new { include ActiveTriples::RDFSource }
resource.apply_schema(MySchema)

Public Class Methods

properties() click to toggle source

@return [Array<ActiveTriples::Property>]

# File lib/active_triples/schema.rb, line 35
def properties
  @properties ||= []
end
property(property, options) click to toggle source

Define a property.

@param [Symbol] property The property name on the object. @param [Hash] options Options for the property. @option options [Boolean] :cast @option options [String, Class] :class_name @option options [RDF::URI] :predicate The predicate to map the property

to.

@see ActiveTriples::Property for more about options

# File lib/active_triples/schema.rb, line 29
def property(property, options)
  properties << Property.new(options.merge(:name => property))
end