-
Notifications
You must be signed in to change notification settings - Fork 28
Seattle Example
yokolet edited this page Apr 24, 2013
·
5 revisions
Datomic distribution has a sample maintained by Seattle user group. This document explains how to run the Seattle example on Diametric gem. This document assumes Peer-based API on JRuby. Some of methods are not supported on REST-API currently.
-
Schema definition
class Seattle include Diametric::Entity include Diametric::Persistence::Peer attribute :name, String, :cardinality => :one, :fulltext => true, :doc => "A community's name" attribute :url, String, :cardinality => :one, :doc => "A community's url" attribute :neighborhood, Ref, :cardinality => :one, :doc => "A community's neighborhood" attribute :category, String, :cardinality => :many, :fulltext => true, :doc => "All community categories" attribute :orgtype, Ref, :cardinality => :one, :doc => "A community orgtype enum value" attribute :type, Ref, :cardinality => :one, :doc => "A community type enum value" enum :orgtype, [:community, :commercial, :nonprofit, :personal] enum :type, [:email_list, :twitter, :facebook_page, :blog, :website, :wiki, :myspace, :ning] end class Neighborhood include Diametric::Entity include Diametric::Persistence::Peer attribute :name, String, :cardinality => :one, :unique => :identity, :doc => "A unique neighborhood name(upsertable)" attribute :district, Ref, :cardinality => :one, :doc => "A neighborhood's district" end class District include Diametric::Entity include Diametric::Persistence::Peer attribute :name, String, :cardinality => :one, :unique => :identity, :doc => "A unique district name (upsertable)" attribute :region, Ref, :cardinality => :one, :doc => "A district region enum value" enum :region, [:n, :ne, :e, :se, :s, :sw, :w, :nw] end