Recommended Use of rdf in Ruby on Rails

I would like to publish rdf in my rails applications. What is the right way to do this?

+4
source share
3 answers

(For people who are interested in working with actual RDF data, see RDF Status in Ruby .)

Short answer to your question: you are looking for reply_to . In general, you should write something like:

class PeopleController < ApplicationController::Base respond_to :html, :rdf def index @people = Person.all respond_to do |format| format.html format.rdf { convert_to_rdf(@people) } end end end 

Of course you will have to write 'convert_to_rdf'. You may find that RDF.rb is useful for this.

+6
source

Have you tried ActiveRDF ? Citation:

ActiveRDF is a library for accessing RDF data from Ruby programs. It can be used as a data layer in Ruby-on-Rails, similar to ActiveRecord (which provides O / R mapping to relational databases). ActiveRDF in RoR allows you to create semantic web applications very quickly. ActiveRDF provides you with a domain-specific language (DSL) for your RDF model: you can access RDF resources, classes, properties, etc. Programmatically, without requests.

  • ActiveRDF can be used with various RDF repositories, adapters in other stores can be written very easily.
  • ActiveRDF uses a configuration convention, which means that it works very well in 90% of cases.
  • ActiveRDF is open source, released under the LGPL license.
+2
source

For those looking at this issue in the future: gem rdf-serializers uses active_model_serializers to easily serialize in RDF.

0
source

All Articles