The code you are looking for is probably in
com.hp.hpl.jena.xmloutput.impl.Basic.java


 protected void writeRDFStatements( Model model, PrintWriter writer )
        {
ResIterator rIter = model.listSubjects();
while (rIter.hasNext()) writeRDFStatements( model, rIter.nextResource(),
writer );
}

 protected void writeRDFStatements
        ( Model model, Resource subject, PrintWriter writer )
    {
StmtIterator sIter = model.listStatements( subject, null, (RDFNode) null );
writeDescriptionHeader( subject, writer );
while (sIter.hasNext()) writePredicate( sIter.nextStatement(), writer );
writeDescriptionTrailer( subject, writer );
    }

However, it just prints the statements out in the order the model returns
them by listSubjects() and listStatements() for each subject returned.  So
as Chris said the order is model implementation specific.

Claude


On Thu, Sep 12, 2013 at 7:01 AM, <c...@info-cast.com> wrote:

> On 2013-09-11 23:15, Chris_Dollin wrote:
>
>> On Wednesday, September 11, 2013 07:28:33 PM c...@info-cast.com wrote:
>>
>>  Is there a Jena stmt/triple iterator feeding items in order ?
>>> I looked around the Jena API list to find, but no luck. However,
>>> the 'Model.write(outputStream, lang)' method produces triple
>>> listing in hierarchy with indentation - wonder how the method
>>> produces such listing.
>>>
>>
>> Is Model.listStatements() what you're looking for?
>>
>> [Note: there is no "in order"; the statements come out in some
>>  unspecified implementation-specific order.]
>>
>> Chris
>>
>
> What I'm looking for is another iterator (or a Jena utility ?)
> which can order the triples in hierarchy - not in random sequence
> from 'listStatements()'. I just need to traverse a resource from
> the top to the bottom, and it'd be nice to have an iterator to feed
> the triples that way. The model.write() produces triples in sequence
> and I just want to utilize that ordering mechanism.
>
> Chan
>



-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to