Re: Adding a list-valued property

I think what you want is:

r << [s, p, l.subject]

That's just off the top of my head though.


On Mon, Nov 25, 2013 at 1:19 PM, Ian Dickinson <i.j.dickinson@gmail.com>wrote:

> Hi Gregg,
> I'm doing something wrong trying to add a triple whose object is a
> list. Basically what I'm trying to create is:
>
>     :s :p (1 2 3).
>
> Here's what I tried:
>
> 2.0.0-p247 :003 > r = RDF::Repository.new
>  => #<RDF::Repository:0x15b1ac0()>
> 2.0.0-p247 :004 > l = RDF::List[1,2,3]
>  => #<RDF::List:0x16b6cf4(RDF::List[1, 2, 3])>
> 2.0.0-p247 :005 > s = RDF::Resource.new("http://example.org/s")
>  => #<RDF::URI:0x18d91f8(http://example.org/s)>
> 2.0.0-p247 :006 > p = RDF::Resource.new("http://example.org/p")
>  => #<RDF::URI:0x1abcd1c(http://example.org/p)>
> 2.0.0-p247 :007 > r << [s,p,l]
>  => #<RDF::Repository:0x15b1ac0()>
> 2.0.0-p247 :008 > r.dump(:turtle)
>  => "\n<http://example.org/s> <http://example.org/p> _:g24109960 .\n"
> 2.0.0-p247 :009 > r << l
>  => #<RDF::Repository:0x15b1ac0()>
> 2.0.0-p247 :010 > r.dump(:turtle)
>  => "\n<http://example.org/s> <http://example.org/p> _:g24109960
> .\n\n(1 2 3) a <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .\n"
>
> I'm sure I'm doing something dumb, but I'm not sure what to change.
> Suggestions?
>
> Thanks,
> Ian
>
>

Received on Monday, 25 November 2013 21:25:03 UTC