Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A DataMapper adapter to connect to Freebase. The goal of this project is to link any Freebase data into your existing database structure as needed.
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
features
lib
spec
.document
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION

README.rdoc

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.

Something went wrong with that request. Please try again.