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

Writing Namespaces in RDF.rb

From: Mark Windholtz <windholtz@gmail.com>
Date: Sun, 6 Jun 2010 16:52:26 -0400
Message-Id: <283AF25B-4B5B-4D8A-BDDC-568BFA625D08@gmail.com>
To: public-rdf-ruby@w3.org
I'm an RDF.rb newbie trying to write out RDF for a training event.
But I cannot figure out how to write out the namespace specs.
The Rails action looks like this:
	
def show
  @course = Course.find(params[:id])
  respond_to do |format|
      format.rdf  do 
             output = RDF::Writer.for(:rdfxml).buffer do |writer|
                  s = RDF::URI(course_url(@course))
                  p = RDF::DC.event
                  o = RDF::Literal(@course.full_title)
                  writer << RDF::Statement(s, p, o)	
             end 
             render :xml => output
         end
   end     
end

And produces this:
<rdf:RDF>
    <rdf:Description rdf:about="http://mydomain/training/178">
    <ns0:event>  Training: Dallas, Aug 23-24, 2010 </ns0:event>
  </rdf:Description>
</rdf:RDF>

Why is the namespace "ns0" ?
I want something like:

<rdf:RDF
    xmlns:dc="http://purl.org/dc/elements/1.1" >           <==== NOTE HERE
    <rdf:Description rdf:about="http://mydomain/training/178">
    <dc:event>  Training: Dallas, Aug 23-24, 2010 </ns0:event>
  </rdf:Description>
</rdf:RDF>

How can I get RDF.rb to do this?

Regards,
- Mark Windholtz
(513) 226-8259
www.agiledna.com
@agiledna
Received on Tuesday, 8 June 2010 12:14:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 June 2010 12:14:17 GMT