W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > September 2010

Re: Spira: adding gratitious separators to URIs

From: Ben Lavender <blavender@gmail.com>
Date: Tue, 28 Sep 2010 22:10:38 -0500
Message-ID: <AANLkTim+Wy=tfH5GY46GXz_HrJ0vAK_B5Jw54QqSSF9O@mail.gmail.com>
To: Christoph Badura <bad@bsd.de>
Cc: public-rdf-ruby@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 29 September 2010 03:19:28 GMT