Updated support for quads in RDF::Trine

Kjetil Kjernsmo kjetil at kjernsmo.net
Mon Jan 18 23:52:32 CET 2010


On Monday 18. January 2010 00:20:08 Gregory Williams wrote:
> I've recently been working on bringing some sanity to supporting quads
>  in RDF::Trine. 

Great stuff!

>  I'm not sure how much anyone is using quads in the
>  current RDF::Trine, but it's done pretty half-heartedly and I've tried
>  to make changes to make the support more consistent and predictable.

We do a bit of that in the RDFa parser, and it is needed for my templating 
attempts.

> So far, this is what I've done:
> 
> I've added a new nil-valued (singleton) Node class that is meant to be
>  used in the graph/context slot of a quad that doesn't otherwise have
>  such a value (when up-casting a triple to a quad, the graph/context is
>  this new nil value). When viewing a store from the perspective of
>  SPARQL, statements with a nil-valued graph/context slot can be
>  considered as part of the "default graph".

That's great! I think we could use that to simplify some of the code in 
RDF::RDFa::Parser, the stuff where we create a name for the default graph, 
right, Toby?

> I'm not sure about the variant
>  with no arguments: maybe it should instead follow the quad semantics?
>  Thoughts?

No. :-)
 

>  Again, I'm not sure if the no arguments variant should follow the quad
>  semantics. Thoughts?

Again, I haven't really seen any practical uses of this myself, so I don't 
know.

> I've made these changes to RDF::Trine::Store::DBI and added a new
>  RDF::Trine::Store::Memory (that's based on pure-perl data structures
>  without the need for SQLite) that follows this API.

Great! Does temporary_storage use this now?
 
> 
> 
> Moving forward with this, there's an open issue I'd like to discuss. I'm
>  considering adding quad support directly into RDF::Trine::Statement and
>  doing away with RDF::Trine::Statement::Quad. The Statement constructor
>  would fill in the graph/context slot with the nil-node if none is
>  supplied. Obviously if this happened the APIs discussed above would be
>  much simplified (adding and removing statements would have only a
>  single method call variant each instead of the current four).

Again, as above, I think this would simplify the code in RDF::RDFa::Parser, 
so I'm +1.

Cheers,

Kjetil
-- 
Kjetil Kjernsmo
kjetil at kjernsmo.net
http://www.kjetil.kjernsmo.net/


More information about the Dev mailing list