No commit activity in last 3 years
No release in over 3 years
This Adapter allows you to access any Freebase data with your DataMapper models
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 1.2.9
 Project Readme

dm-freebase-adapter¶ ↑

This adapter allows you to map any freebase resource to DataMapper models.

Installation¶ ↑

To install the freebase adapter execute:

gem install dm-freebase-adapter

Usage¶ ↑

First you need to setup DataMapper to use the freebase adapter for your models

DataMapper.setup(:default, :adapter => 'freebase')

Then you can define your models as needed. You can map the properties from freebase to your models as you wish. You can use the Freebase Schema Explorer to get an idea, what attributes you can map. Below is an example mapping for the /music/artist and the /music/album freebase types

class Artist
  include DataMapper::Resource
  storage_names[:default] = '/music/artist'

  property :id, String, :key => true
  property :guid, String
  property :name, String
  property :genre, String

  has n, :albums, :child_key => [:artist]
end

class Album
  include DataMapper::Resource

  storage_names[:default] = '/music/album'

  property :id, String, :key => true
  property :name, String
  property :track, String

  belongs_to :artist, :child_key => [:artist]
end

Copyright © 2009 Yves Senn. See LICENSE for details.