[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fenfire-dev] RDF traversal utility methods
From: |
Tuukka Hastrup |
Subject: |
Re: [Fenfire-dev] RDF traversal utility methods |
Date: |
Sun, 17 Aug 2003 16:17:38 +0300 (EEST) |
On Sun, 17 Aug 2003, Tuomas Lukka wrote:
> On Sat, Aug 16, 2003 at 02:19:07PM +0300, Tuukka Hastrup wrote:
> > Now I see - adding findN_AAX_Iter would require ind_210?
>
> or 120. Either one can be used. Hmm, we have that so it wouldn't hurt
> to put it there.
Great.
> Actually, for this purpose, how about
>
> swamp.util.Iteration.iterateAllNodes(ConstGraph g)
>
> for getting all nodes?
Wouldn't it make sense to have it in ConstGraph interface? And it could
have iterateAllSubjects and iterateAllObjects as well, and iterateAllNodes
would just combine them.
> > In Traversals, I should rather modify findComponents to get
> > the initial node set as an iterator, so the caller can limit it to its
> > needs.
>
> Why get a *set* as an *iterator*?
Because it's probably generated with findN_X11_Iter, and the method uses
it to iterate the nodes.
> This is a place where swamp is not doing the accepted
> java Collection framework thing: one of the design rules there was
>
> **Iterators should not be used as pseudo-sets**
Do they have a rationale? Yes, if you use an iterator, you could build a
set first and then iterate that.
> So I'm thinking: to do better in that way, we should maybe have
> findN_AAX_Set which returns a set of nodes.
Do you mean for all findN methods, or these as a special case?
> However, efficiency may be a problem there :(
In addition to general overhead, at least concatenating two iterators is
simple, but set union I'd imagine is not.
> > (Graphs.toModel uses XAA, but couldn't the same functionality be
> > implemented inside HashGraph without it?)
>
> Sorry, I don't understand
We could implement XAA in time O(V + E) without ind_012. But forget
this, as the other methods use that index anyway.
> > By the way, a concatenating iterator similar to the one in Traversals
> > would be useful in other places as well. At least it allowed me to
> > simplify using non-directed properties, combining iterations of 11X and
> > X11 into one.
>
> See above...
So if you have a non-directed RDF property, your code needs to check both
directions (11X and X11). That is seldom clean in Java (no "for each"
statements). So I made an iterator that simply combines results from 11X
and X11, and use that in my code. Further, we have other code dealing with
non-directed properties, and they could be cleaner with the same
technique.
> > > > As HashGraph uses HashMap-provided iterators, I suppose they permit
> > > > calling their remove() method. But as there are three HashMaps whose
> > > > entries must be updated during removal, I don't think calling remove()
> > > > would be wise.
> > >
> > > Exactly.
> >
> > Where to mention this in the docs?
>
> Probably in swamp.ConstGraph? Will you?
Done.
--
-- Trying to catch me? Just follow up my Electric Fingerprints
-- To help you: address@hidden
http://www.iki.fi/Tuukka.Hastrup/
IRCNet: Stugge/tuukkah @#pii,#fenfire,#ynna
Jabber ID: address@hidden, ICQ #11321669
- [Fenfire-dev] RDF traversal utility methods, Tuukka Hastrup, 2003/08/16
- Re: [Fenfire-dev] RDF traversal utility methods, Tuomas Lukka, 2003/08/16
- Re: [Fenfire-dev] RDF traversal utility methods, Tuukka Hastrup, 2003/08/16
- Re: [Fenfire-dev] RDF traversal utility methods, Tuomas Lukka, 2003/08/16
- Re: [Fenfire-dev] RDF traversal utility methods, Tuukka Hastrup, 2003/08/16
- Re: [Fenfire-dev] RDF traversal utility methods, Tuomas Lukka, 2003/08/17
- Re: [Fenfire-dev] RDF traversal utility methods,
Tuukka Hastrup <=
- Re: [Fenfire-dev] RDF traversal utility methods, Tuomas Lukka, 2003/08/17
- Re: [Fenfire-dev] RDF traversal utility methods, Tuukka Hastrup, 2003/08/17
- Re: [Fenfire-dev] RDF traversal utility methods, Asko Soukka, 2003/08/18
- Re: [Fenfire-dev] RDF traversal utility methods, Tuukka Hastrup, 2003/08/18
- Re: [Fenfire-dev] RDF traversal utility methods, Tuomas Lukka, 2003/08/18
- Re: [Fenfire-dev] RDF traversal utility methods, Tuomas Lukka, 2003/08/18