Skip to content

Lesson: define a custom vocabulary

Justin Coyne edited this page Jan 19, 2014 · 8 revisions

A custom vocabulary is simply a namespace and a set of terms. We encode these into a Ruby class so they are useable by the RDF.rb gem.

We'll start out by defining a vocabulary about images. We'll give it the namespace "http://projecthdyra.org/images#". We'll give it three terms: "height", "width", and "color_depth".

class ImageVocabulary < RDF::Vocabulary("http://projecthdyra.org/images#")
  property :height
  property :width
  property :color_depth
end
Clone this wiki locally