[redland-dev] slow model creation with ruby bindings

Martin Guetlein guetlein at informatik.uni-freiburg.de
Wed Sep 8 15:57:26 CEST 2010


Hi Carmen,

thanks for your answer. I had a look at http://rdf.rubyforge.org,
looks very nice, I am going to give it a try.

I did not understood everything you posted, but your examples are
about reading existing rdf-files/models, right?
That's not what I meant, though.
I want to provide a dataset in rdf-xml-format. The problem is that
adding all the data to a Redland::Model takes ages, before I can print
the contents to an rdf-file.

That might be due to background actions on the rdf graph
(node-finding, isomorphism checks, ..) that you where talking about
(even though we dont have any blank nodes).

Can I use Raptor somehow to avoid building the graph, and just print
an rdf-file with my triples?

Regards,
Martin




On Tue, Sep 7, 2010 at 11:10 PM, carmen <_ at whats-your.name> wrote:
>>slower to add new nodes to a root node triples that have the new nodes as subject.
>
>
> is your entire graph contained in blank nodes hanging off a single subject? a pathological case that could be slow in any framework, (rebalancing, node-finding, isomorphism checks, yadda. see  http://blog.datagraph.org/2010/03/rdf-isomorphism )
>
>> I just want my triples printed out
>
> simplesy way is #yield parse_as_stream.(example http://gitorious.org/element/element/blobs/master/ruby/W/rdf.rb#line40 and theres gem using FFI rather than SWIG (possibly faster, possibly not) http://rdf.rubyforge.org/raptor/)
>
>
>
>
> to print pass triple-yield a function:
>
> eg resourcename.raptor{|s,p,o|
>  puts"s "+s.class.to_s+" "+s.to_s+"\n"+
>     "p "+p.class.to_s+" "+p.to_s+"\n"+
>     "o "+o.class.to_s+" "+o.to_s}
>
>
>
> almost surely faster using a JSON model w/o SWIG sitting between:
>
>
>  def fromStream m,*i
>    send(*i) do |s,p,o|
>      m[s] ||= {'uri'=>s}
>      m[s][p] ||= []
>      m[s][p].push o
>    end; m
>  end
>
>
> model={}
>
> (E 'somefile.rdf').fromStream m, :redland
>
> (  i rarely use blank nodes, but when i do theyre just JSON objects in the literal position of a statement without a 'uri' field..)
>
>
> for just parsing, Raptor is extremely fast, perhaps the fastest...
> _______________________________________________
> redland-dev mailing list
> redland-dev at lists.librdf.org
> http://lists.librdf.org/mailman/listinfo/redland-dev
>



-- 
Dipl-Inf. Martin Gütlein
Phone:
+49 (0)761 203 8442 (office)
+49 (0)177 623 9499 (mobile)
Email:
guetlein at informatik.uni-freiburg.de


More information about the redland-dev mailing list