ActiveRDF
Overview
ActiveRDF is a library for accessing RDF data from Ruby programs. It can be used as data layer in Ruby-on-Rails, similar to ?ActiveRecord (which provides an O/R mapping to relational databases). ActiveRDF in RoR allows you to create semantic web applications very rapidly. ActiveRDF gives you a Domain Specific Language (DSL) for your RDF model: you can address RDF resources, classes, properties, etc. programmatically, without queries.
- ActiveRDF can be used with various RDF stores, more adapters are easy to add
- ActiveRDF uses convention over configuration, working nicely in 90% of the cases
- ActiveRDF is in active development
- ActiveRDF is open source, released under GPL license
Getting started
Check out our GettingStartedGuide which shows you:- how to install ActiveRDF and its Adapters
- how to read and write to RDF triple stores
- how to create a Ruby on Rails application that gets its data from a triple store
Example
Create and edit people
# we load activerdf require 'active_rdf' # we add an existing SPARQL database as datasource ConnectionPool.add_data_source :type => :sparql, :url => "http://m3pe.org:8080/repositories/test-people", :results => :sparql_xml # we register a short-hand notation for the namespace used in this test data Namespace.register :test, 'http://activerdf.org/test/' # now we can access all RDF properties of a person as Ruby attributes: eyal = RDFS::Resource.new 'http://activerdf.org/test/eyal' puts eyal.age puts eyal.eye puts eyal.class # now we construct Ruby classes for the currently existing RDFS classes ObjectManager.construct_classes # and we can use these classes armin = TEST::Person.new 'http://armin-haller.com/#me' # we cannot change anything, since SPARQL endpoints have just read-only access