[Activerdf] read scrapbook.rdf files

J2F j2fuentes at gmail.com
Fri Apr 6 00:49:54 IST 2007


On Thu, 2007-04-05 at 16:45 +0200, Eyal Oren wrote:
> 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. 

I think I meant a list of elements. Something like "find_all" in rails,
or "select * from" in sql. The ActiveRDF manual mentions this. I will
try to learn more.


> 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.

Thanks for the offer. But I'm more of an end-user than a backend-writer.
My programming skills are at best, amateurish. I'll try to be around
though in the list and try to keep up with developments.

> 
> 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.
> 

The rdf file sometimes grows to as much as 1MB + and parsing it with
rapper takes a few seconds or so. I don't think it would be efficient to
parse it everytime a single item is added. 


>  -eyal

Thanks!

j2f
> _______________________________________________
> ActiveRDF mailing list
> ActiveRDF at lists.deri.org
> http://lists.deri.org/mailman/listinfo/activerdf



More information about the ActiveRDF mailing list