Skip to content

Requirement for rdf_type should be explicit/ validated/ documented #27

@Robsteranium

Description

@Robsteranium

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions