Project

to-rdf

0.0
No commit activity in last 3 years
No release in over 3 years
A small library for serializing Ruby objects as RDF/Turtle
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

to-rdf

A small gem to serialize Ruby objects as RDF.

Example use

require 'to_rdf'
require 'uri'

class Actor

  include ToRdf

  attr_accessor :name, :id

  def uri
    URI("http://example.com/actors/#{id}")
  end

  def type_uri
    URI("http://example.com/schema/Actor")
  end

  def rdf_mapping
    {
      "foaf:name" => name
    }
  end
end

actor = Actor.new
actor.id = 1
actor.name = "John Doe"
actor.to_rdf