[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fenfire-dev] Repost: PEGs swamp_easier*--benja

From: Tuomas Lukka
Subject: Re: [Fenfire-dev] Repost: PEGs swamp_easier*--benja
Date: Mon, 29 Sep 2003 11:00:04 +0300
User-agent: Mutt/1.5.4i

On Sun, Sep 28, 2003 at 05:11:03PM +0300, Matti Katila wrote:
> On Sat, 27 Sep 2003, Benja Fallenstein wrote:
> > The (now) two related PEGs about the Swamp API, swamp_easier--benja and 
> > swamp_easier_iteration--benja: please say whether all of your comments 
> > have been addressed!
> Umh, two pegs in one post is not good at all :/
> I think we did have some misunderstanding about the peg split last time,
> since I was saing that I don't have any cons related to iterating trought
> triplets instead of nodes. But having in the same beg that
> find_ [IXA] things should be removed and replaced with findSubject etc. is 
> about method naming but not about iterating triplets.

I agree, could you repost these separately?

> > First of all, we need a good way for iterating
> > through a set of triples. I propose the following
> > interface::
> > 
> >      for(TripleIter i = graph.get(_, RDF.type, _); t.loop();) {
> >          System.out.println(i.subj+" is instance of "+i.obj);
> >      }
> After first read this raised for a question(more of this at the end of 
> reply):
> What's wrong with java.util.Iterator interface? I don't like having 
> different interface which does the same.  

I can answer this: *efficiency*. 

With iterator, you need to be casting &c the result. And if you get the
triple from an iter, you'd be more likely to think that you can save it
which you can't, in this model.

Here, everything that goes on is in the open.

> while iter.hasNext():
>     # if mutable
>     iter.next()
>     print "<%s> is instance of <%s>" % (iter.s, iter.o)    

Ahh, you mean *subclassing* Iterator...

Hmm, that has its points, but 
1) what would iter.next() return
2) benja's point about not having accessible values before t.loop()


reply via email to

[Prev in Thread] Current Thread [Next in Thread]