Skip to content

senny/dm-freebase-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages