[Versa] Versa issue: Qname helper functions

Chimezie Ogbuji chimezie at gmail.com
Fri Aug 12 22:26:01 MDT 2005


On 8/12/05, Uche Ogbuji <uche.ogbuji at fourthought.com> wrote:
> http://lists.fourthought.com/pipermail/ril/2004-September/000358.html
> 
> Litao Wei expressed an interest in a means for getting QNames rather
> than full URIs in Versa results.  I think this is more of a
> serialization than a query semantics issue, but I post it anyway so that
> it gets tracked and handled.

In a related issue, his problem with decouping rdf Container items
would be addressed by a rdfList function:

   def getContainerItems(self, container, pred):
        query="@'%s'-%s->*" % (container, pred)
        try:
            tmpSbj=(self.rdfQuery(query))[0]
        except IndexError:
            return []
       
        query="filter(properties(@'%s'),'starts-with(rdf:_)')" % (tmpSbj)
        preList = self.rdfQuery(query)
        result=[]
        for pred in preList:
            subquery = "@'%s'-@'%s'->*" % (tmpSbj, pred)
            item = (self.rdfQuery(subquery))[0]
            result.append(item)  
        return result

becomes:   rdfList(<Seq_uri>)


Common use case:  decoupling rss:item from a feed - though you could
get to them directly with type(rss:item) - which is what I do with
Emeka...



More information about the Versa mailing list