Re: RDF-raptor FFI benchmarks

On Mon, Apr 5, 2010 at 11:15 AM, carmen <_@whats-your.name> wrote:
>> PS. RDF::Raptor 0.2.0, released yesterday, included an initial set of
>> FFI bindings to Raptor, as well as RDF::Reader implementations based
>
> cool!
>
> my tools use tripleStreams :: URIString,URIString,(Resource URIString,Graph)|URIString so ive got unwrappers [1] and [2]
>
> parsing all the ttl files in git clone git://git.librdf.org/repositories/{bindings,librdf,raptor,rasqal}.git
>
> [...]
>
> looking good.. worked out of the box too :)

Those are pretty nice initial results, thanks for benchmarking that.

> [1]
>  def raptor
>    ::RDF::Raptor::Turtle::Reader.open(d){|r|r.each_triple{|t|
>        yield t[0].to_s,
>        t[1].to_s,
>        ((t[2].class==::RDF::Node||t[2].class==::RDF::URI) ?
>         (E t[2].to_s) :
>         t[2].value)
>      }}; self
>  end

Note that instead of "t[2].class == RDF::Node || t[2].class ==
RDF::URI" you can use the briefer test "t[2].is_a?(RDF::Resource)",
or, as of RDF.rb 0.1.5 (to be released tonight), just simply
"t[2].resource?".

-- 
Arto Bendiken | @bendiken

Received on Monday, 5 April 2010 19:18:45 UTC