[redland] model get_targets question
Bob Stayton
bobs at sco.com
Mon Dec 4 13:29:57 GMT 2000
> From sco.sco.com!bristol.ac.uk!dave.beckett Sun Dec 3 13:47:08 2000
>
> > What exactly is an iterator, and what does it mean
> > that a node is shared with it? More importantly, how
> > can I get my target node back?
>
> Iterator is documented in the general C API used to represent a list
> of items as an object usually for returning as the result of a
> function. Since at the user level (rather than internal to Redland)
> the only thing that this appears as, I redefined Iterator for
> Perl/Python to be a list of librdf_node (Perl RDF::Node) references.
>
> Post Redland 0.9.6 release I changed the get_* methods for Perl so
> that they return a perl array when used in an array context rather
> than an iterator object. That makes a lot more sense and is easier
> to use in Perl. [ I would do the same with python if I knew more about
> its C interface. ] I probably will add get_target etc. methods that
> return an arbitrary target for the given subject, predicate etc.
Good, that would be very nice.
> So now you can do:
>
> my(@targets)=$model->get_targets($subject, $predicate);
>
> and get a list where each item is an RDF::Node object.
>
> Bob: You did seem to describe an example that did the wrong thing -
> returning a list of badly constructed objects, can you mail it to me
> so I can try it out?
I've sent you a short Perl program that demonstrates
my problem.
> >
> > BTW, do you need some help documenting the Perl API?
>
> That sounds like a hint, as well as an offer! Thanks.
Yes, it's an offer. I was hoping it would be POD.
I keep having to mentally translate between the C API
doc and the perl subs, so having perl doc would be most useful,
even if I have to help write it. That way I get to ask you
tons of questions, too. 8^)
bobs
More information about the redland-dev
mailing list