[Activerdf] read scrapbook.rdf files

Eyal Oren eyal.oren at deri.org
Thu Apr 5 15:45:24 IST 2007


On 04/05/07/04/07 22:04 +0800, J2F wrote:
>If you do not mind, I got two more questions:
>
>1) How do I get a list of all the "items" in the rdf? Using your
>alternative, I wish there would be something like 
>
>	scrap.each_item
if you mean a list of elements in a list, we don't have anything for you 
now. if you mean a list of instances of a class you can use
ClassName.find, e.g. RDFS::Resource.find or FOAF::Person.find. However, 
this will only work for resources that have an explicit rdf:type defined, 
or for adapters that perform RDFS reasoning.

>2) The rdf file is regularly updated as more items are added to the
>'scrapbook'. Does this mean I will have to process it using rapper and
>reload it everytime that it is updated?
Yes, sorry. ActiveRDF works on top of RDF stores, but files are not RDF 
stores (they do not allow queries). I/you could however easily write a 
"wrapper" that would expose a file as an RDF store (internally it would 
simply load and parse the file on every invocation).  Such an extension 
would be easy, similar to the "fetching" adapter which is a simple 
extension of the RDFLite adapter to fetch RDF from online locations.

I'm not sure how much it would help you though, you can also just include 
the one line to parse your file upon loading at the top of your script.

 -eyal


More information about the ActiveRDF mailing list