- From: Marios Avgeris <avgeris.marios@gmail.com>
- Date: Mon, 31 Oct 2016 23:33:14 +0200
- To: public-rdf-ruby@w3.org
Hello,
I’ve been trying my hand on Ruby RDF and I’d like some clarification on the following subjects. Assume the existence of the following classes:
class Car < Spira::Base
  configure :base_uri => 'http://example.org/car'
  type RDF::URI.new('http://example.org/types/car')
end
class Spaceship < Spira::Base
  configure :base_uri => 'http://example.org/spaceship'
  type RDF::URI.new('http://example.org/types/spaceship')
end
class Person < Spira::Base
  configure :base_uri => 'http://example.org/person'
  type RDF::URI.new('http://example.org/types/person')
  property :name, :predicate => RDF::Vocab::DC.title, :type => XSD.string
  property :age,  :predicate => RDF::Vocab::FOAF.age,  :type => Integer
  property :drives, :predicate => RDF::URI.new('http://example.org/vocab/drives’), :type =>  :Car
end
1) one can search the respective repository using properties with data (String, Integer, Boolean etc.) like this:
 adam = Person.for(“adam”)
 adam.age = 67
 p = Person.find(:all, :conditions => { :age => 67} )
that will return an array containing objects of class People, matching the given conditions (obviously only adam in this case). 
Is there a way to search the repo using object properties? I was imagining something like this:
 beetle = Car.for(“beetle”).save
 adam.drives = beetle
 adam.save
 p = Person.find(:all, :conditions => { :drives => beetle} ) 
However this doesn’t seem to work.
2) This one is separate from the above. Is there a way in which a property could support more than one spira class/object type? what I’m trying to achieve would seem like this:
 class Person < Spira::Base
   ...
    property :drives, :predicate => RDF::URI.new('http://example.org/vocab/drives’), :type =>  [:Car, :Spaceship]
  ...
 end
Obviously this doesn’t work either.
Any ideas?
Thanks in advance,
Marios
Received on Wednesday, 2 November 2016 12:45:54 UTC