Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data.

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 doc
Octocat-spinner-32 etc
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gemspec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .yardopts
Octocat-spinner-32 AUTHORS
Octocat-spinner-32 README Changed README format from RDoc to Markdown. December 20, 2009
Octocat-spinner-32 Rakefile
Octocat-spinner-32 UNLICENSE Unlicensed the project into the public domain. December 20, 2009
Octocat-spinner-32 VERSION

RDF.rb: RDF API for Ruby

This is a pure-Ruby library for working with Resource Description Framework (RDF) data.

About the Resource Description Framework (RDF)


require 'rdf'

Creating an RDF statement

s = RDF::URI.parse("")
p = RDF::DC.creator
o = RDF::URI.parse("")

stmt =, p, o)

Using pre-defined RDF vocabularies

include RDF

DC.title      #=> RDF::URI("")
FOAF.knows    #=> RDF::URI("")
RDFS.seeAlso  #=> RDF::URI("")
RSS.title     #=> RDF::URI("")
OWL.sameAs    #=> RDF::URI("")
XSD.dateTime  #=> RDF::URI("")

Using ad-hoc RDF vocabularies

foaf ="")
foaf.knows    #=> RDF::URI("")
foaf[:name]   #=> RDF::URI("")
foaf['mbox']  #=> RDF::URI("")

Reading N-Triples data"spec/data/test.nt") do |reader|
  reader.each_statement do |statement|
    puts statement.inspect


RDF Objects

  • {RDF::Graph}
  • {RDF::Literal}
  • {RDF::Node}
  • {RDF::Resource}
  • {RDF::Statement}
  • {RDF::URI}
  • {RDF::Value}

RDF Serialization

  • {RDF::Format}
  • {RDF::Reader}
  • {RDF::Writer}

RDF Serialization Formats

  • {RDF::NTriples}

RDF Storage

  • {RDF::Repository}

RDF Querying

  • {RDF::Query}
  • {RDF::Query::Pattern}
  • {RDF::Query::Solution}
  • {RDF::Query::Variable}

RDF Vocabularies

  • {RDF::CC} - Creative Commons (CC)
  • {RDF::DC} - Dublin Core (DC)
  • {RDF::DOAP} - Description of a Project (DOAP)
  • {RDF::EXIF} - Exchangeable Image File Format (EXIF)
  • {RDF::FOAF} - Friend of a Friend (FOAF)
  • {RDF::HTTP} - Hypertext Transfer Protocol (HTTP)
  • {RDF::OWL} - Web Ontology Language (OWL)
  • {RDF::RDFS} - RDF Schema (RDFS)
  • {RDF::RSS} - RDF Site Summary (RSS)
  • {RDF::SIOC} - Semantically-Interlinked Online Communities (SIOC)
  • {RDF::SKOS} - Simple Knowledge Organization System (SKOS)
  • {RDF::WOT} - Web of Trust (WOT)
  • {RDF::XHTML} - Extensible HyperText Markup Language (XHTML)
  • {RDF::XSD} - XML Schema (XSD)



The recommended installation method is via RubyGems. To install the latest official release from Gemcutter, do:

% [sudo] gem install rdf


To get a local working copy of the development repository, do:

% git clone git://

Alternatively, you can download the latest development version as a tarball as follows:

% wget


See Also



RDF.rb is free and unencumbered public domain software. For more information, see or the accompanying UNLICENSE file.

Something went wrong with that request. Please try again.