tripod icon indicating copy to clipboard operation
tripod copied to clipboard

Requirement for `rdf_type` should be explicit/ validated/ documented

Open Robsteranium opened this issue 11 years ago • 0 comments

Tripod resources require an rdf_type. When this is missing you can't find them. I'm not sure if they are not persisted or persisted but not retrievable.

Ideally this should be part of the validation, if it is to be required at all.

This is what happens without:

class Thing
  include Tripod::Resource
  graph_uri RDF::URI("http://example.org/graph/things") 
end

thing = Thing.new(RDF::URI("http://example.org/id/things/one"))
thing.save!

Thing.find(RDF::URI("http://example.org/id/things/one")) #=> raises Tripod::Errors::ResourceNotFound

It works ok when rdf_type is specified.

class Thing
  include Tripod::Resource
  graph_uri RDF::URI("http://example.org/graph/things") 
  rdf_type RDF::URI("http://example.org/def/thing")
end

thing = Thing.new(RDF::URI("http://example.org/id/things/one"))
thing.save!

thing == Thing.find(RDF::URI("http://example.org/id/things/one")) #=> true

Robsteranium avatar Feb 14 '14 16:02 Robsteranium