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

Re: Spira: adding gratitious separators to URIs

From: Ben Lavender <blavender@gmail.com>
Date: Wed, 20 Oct 2010 16:21:47 +0200
Message-ID: <AANLkTikK29RBccqS0svG5X9Bx6uD7ET6dGcsjyB7XEP6@mail.gmail.com>
To: Christoph Badura <bad@bsd.de>
Cc: public-rdf-ruby@w3.org
I just pushed spira 0.0.9, gem install and enjoy.  This one has the
supported way to do this, Spira::Resource.project.  This method is
exactly like Spira::Resource.for, except that no processing will be
done on the given identifier--you could now replace .for if you wanted
to, or use another method entirely.  .for uses it internally.  So your
simple concatenation for base_uri would be something like this

class X
  def self.my_for(identifier, attributes = {}, &block)
    subject = RDF::URI(self.base_uri.to_s + identifier.to_s)
    self.project(subject, attributes, &block)

No input validation is done on this identifier, so it gives you enough
power to hurt yourself.

Let me know if you have any trouble.


On Thu, Sep 30, 2010 at 12:01 AM, Christoph Badura <bad@bsd.de> wrote:
> On Tue, Sep 28, 2010 at 10:10:38PM -0500, Ben Lavender wrote:
>> 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):
> Thanks a bunch!  That helped in several ways.
>> 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.
> I was wondering why you did the automagic separator stuff in the first place.
> --chris
Received on Wednesday, 20 October 2010 14:22:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:53:40 UTC