summaryrefslogtreecommitdiff
path: root/_posts
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2015-06-02 12:48:12 +0200
committerrautenberg <rautenberg@in-silico.ch>2015-06-02 12:48:12 +0200
commitaa0d344514975311e592312b5bb7dd2cde659173 (patch)
tree63f6909c15e46cb4617f19929ff347dea2cf990a /_posts
parent2b3d041a3436ab6add8d3d0380f300a0c1f45379 (diff)
introduce code highlightingh
Diffstat (limited to '_posts')
-rw-r--r--_posts/2013-06-05-simplify-rdfwriter-method.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/_posts/2013-06-05-simplify-rdfwriter-method.md b/_posts/2013-06-05-simplify-rdfwriter-method.md
index db06731..c1c3f01 100644
--- a/_posts/2013-06-05-simplify-rdfwriter-method.md
+++ b/_posts/2013-06-05-simplify-rdfwriter-method.md
@@ -9,19 +9,25 @@ tags: ["RDF"]
Simplify the RDF::Writer method if you have already an rdf graph like:
+```ruby
@rdf = RDF::Graph.new
RDF::Reader.for(format).new(rdf) do |reader|
reader.each_statement{ |statement| @rdf << statement }
end
+```
To parse it to another format simply use:
+```ruby
RDF::Writer.for(format).buffer(:encoding => Encoding::ASCII) do |writer|
writer << @rdf
end
+```
instead of:
+```ruby
RDF::Writer.for(format).buffer(:encoding => Encoding::ASCII) do |writer|
@rdf.each{|statement| writer << statement}
end
+``` \ No newline at end of file