Exemplo SPARQL -------------- require 'activerdf' local cp = activerdf.ConnectionPool cp.add_data_source { type = 'sparql', engine = 'virtuoso', url = '...' } local ns = activerdf.Namespace local foaf = ns.register ( 'foaf', 'http://xmlns.com/foaf/0.1/' ) local people = foaf.Person:find_all() for _, person in ipairs(people) do print(person.nick) end Exemplo RDFLite --------------- require 'activerdf' local cp = activerdf.ConnectionPool local db = cp.add_data_source{ type = 'rdflite', location = 'test.db' } db:load('lua/activerdf_rdflite/test/test_data.nt') local M = activerdf.Modules local om = activerdf.ObjectManager om.construct_classes() local people = M.HTTP_ACTIVERDF_ORG_TEST.Person:find_all() for _, person in ipairs(people) do print(person.name) end local eyal = activerdf.RDFS.Resource ( 'http://activerdf.org/test/eyal' ) print (eyal.age) -- 27 eyal.age = 30 print(eyal.age) -- 30 ---------------------------------------------- Observe que a API é idêntica à do www.activerdf.org, sendo necessário apenas as mudanças na sintaxe. Ex.: Ruby ActiveRDF -------------- eyal = RDFS::Resource.new 'http://activerdf.org/test/eyal' puts eyal.nick puts eyal.test::age all_resources = RDFS::Resource.find_all Namespace.register :foaf, 'http://xmlns.com/foaf/0.1/' mauricio = FOAF::Person.find_by_nick 'mauricio' Lua ActiveRDF ------------- local eyal = activerdf.RDFS.Resource ( 'http://activerdf.org/test/eyal' ) print ( eyal.nick ) print ( eyal.test.age ) local all_resources = activerdf.RDFS.Resource:find_all() local FOAF = activerdf.Namespace.register ( 'foaf', 'http://xmlns.com/foaf/0.1/' ) local mauricio = FOAF.Person:find_by_nick('mauricio') Observe que o separador :: do ruby é sempre convertido para ponto. Toda as classes e módulos do activerdf são referenciadas usando "activerdf.".