[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fenfire-dev] RDF traversal utility methods
From: |
Tuomas Lukka |
Subject: |
Re: [Fenfire-dev] RDF traversal utility methods |
Date: |
Sun, 17 Aug 2003 16:47:08 +0300 |
User-agent: |
Mutt/1.5.4i |
On Sun, Aug 17, 2003 at 04:17:38PM +0300, Tuukka Hastrup wrote:
> 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.
No, that's not true - there are also predicates.
And we want each node only once.
Iterating all subjects *is* there.
But yes, we could have ConstGraph.findN_Nodes_Iter() if you like.
> > > 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.
Hmm.
> > 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.
That you can't e.g. check if something is in an iterator you're given.
It's too narrow an interface.
> > 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?
All.
> > 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.
Both are O(N).
> > > 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.
Problem: you may get the same node twice.
)
Tuomas
- [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, 2003/08/17
- Re: [Fenfire-dev] RDF traversal utility methods,
Tuomas Lukka <=
- 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