I posted this same problem on the ActiveRDF mailing list. However, after
hours of restless waiting, no response has been posted. Thus, I decided
to post the same problem here in the hope of finding a solution to my
problem.

I am trying to read/parse the following rdf file (this is produced by
"scrapbook", a wonderful firefox plugin):

[code]
<?xml version="1.0"?>
<RDF:RDF xmlns:NS1="http://amb.vis.ne.jp/mozilla/scrapbook-rdf#"
         xmlns:NC="http://home.netscape.com/NC-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <RDF:Seq RDF:about="urn:scrapbook:item20070405010733">
    <RDF:li RDF:resource="urn:scrapbook:item20070405010824"/>
  </RDF:Seq>
  <RDF:Description RDF:about="urn:scrapbook:item20070405010733"
                   NS1:id="20070405010733"
                   NS1:type="folder"
                   NS1:title="active_rdf"
                   NS1:chars=""
                   NS1:icon=""
                   NS1:source=""
                   NS1:comment="" />
  <RDF:Description RDF:about="urn:scrapbook:item20070405010857"
                   NS1:id="20070405010857"
                   NS1:type=""
                   NS1:title="IntroRDF"
                   NS1:chars="UTF-8"
                   NS1:comment=""
                   NS1:icon=""
                   NS1:source="http://wiki.activerdf.org/IntroRDF" />
  <RDF:Seq RDF:about="urn:scrapbook:item20070405010752">
    <RDF:li RDF:resource="urn:scrapbook:item20070405010857"/>
  </RDF:Seq>
  <RDF:Description RDF:about="urn:scrapbook:item20070405010752"
                   NS1:id="20070405010752"
                   NS1:type="folder"
                   NS1:title="about_rdf"
                   NS1:chars=""
                   NS1:icon=""
                   NS1:source=""
                   NS1:comment="" />
  <RDF:Description RDF:about="urn:scrapbook:item20070405010824"
                   NS1:id="20070405010824"
                   NS1:type=""
                   NS1:title="GettingStartedCode"
                   NS1:chars="UTF-8"
                   NS1:comment=""
                   NS1:icon=""
                   NS1:source="http://wiki.activerdf.org/GettingStartedCode"
/>
  <RDF:Seq RDF:about="urn:scrapbook:root">
    <RDF:li RDF:resource="urn:scrapbook:item20070405010752"/>
    <RDF:li RDF:resource="urn:scrapbook:item20070405010733"/>
  </RDF:Seq>
</RDF:RDF>
[/code]

Using 'rapper,' I have converted the rdf file into an ntriples file.
Following the "Getting started" guide of ActiveRDF, I try the following:

[code]
require 'rubygems'
require 'active_rdf'

adapter = ConnectionPool.add_data_source :type => :rdflite
adapter.load "/tmp/scrapbook.nt"
Namespace.register(:test, 'http://amb.vis.ne.jp/mozilla/scrapbook-rdf#')
ObjectManager.construct_classes
[/code]

At this point, everything is fine. However, I couldn't determine how to
retrieve or read a record from the RDF file. I try:

[code]
item = TEST::item20070405010733
[/code]
and get
[code]
=> #<RDFS::Resource:0xb77548f8 @predicates={},
@uri="http://amb.vis.ne.jp/mozilla/scrapbook-rdf#item20070405010733">
[/code]

However, I can't do anything with the resulting RDFS object. I would
have wanted to:
[code]
puts item.source
[/code]
but only get a 'nil'.

Can anyone help?

-- 
Posted via http://www.ruby-forum.com/.