Re: Spira: adding gratitious separators to URIs

Yes, something can be done about that.  For now, you could do
something like this, since giving a URI to Resource.for will pass it
through unchanged (code untested):

class C
  include Spira::Resource
  base_uri "urn:x-domain:example.com:id:"
  property :foo, :predicate => DC["whatever"]

  def self.create(id)
      self.for(RDF::URI("urn:x-domain:example.com:id:" + id))
   end
end

In addition, we have long RDF.rb discussions about how to add a 'smart
separator' that would understand this sort of thing implicitly, which
Spira will use.  And I'll add a bit to Spira that is the 'correct' way
to re-implement Resource.for if you need more smarts when building
identifiers.

If you make an issue on github, you'll get updates when I fix this,
but I'll post to the list when I release a version that takes care of
this.

Ben

On Tue, Sep 28, 2010 at 3:50 PM, Christoph Badura <bad@bsd.de> wrote:
> I'm trying to model some RDF data that makes use of URIs of the following
> form:
>
>  urn:x-domain:example.com:id:12345
>  http://example.com/ns/urn:x-domain:example.com:id:12345
>
> Using either "urn:x-domain:example.com:id:" or
> "http://example.com/ns/urn:x-domain:example.com:id:" as base_uri causes
> the resulting URI to acquire a gratitous "/".
>
> E.g. the follwoing script
>
> require 'spira'
>
> class C
>        include Spira::Resource
>        base_uri "urn:x-domain:example.com:id:"
>        property :foo, :predicate => DC["whatever"]
> end
>
> c = C.for("12345")
> puts c.inspect
>
> produces:
>
> <C:-576321418 @subject: urn:x-domain:example.com:id:/12345>
>
> Would it be possible to get rid of that annoying behaviour?
>
> --chb
>
>
>

Received on Wednesday, 29 September 2010 03:19:27 UTC