[redland-dev] [Raptor RDF Syntax Library 0000528]: NTriplesParser does not return triples in document order

Mantis Bug Tracker mantis-bug-sender at librdf.org
Tue Jan 29 04:20:03 EST 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.librdf.org/mantis/view.php?id=528 
====================================================================== 
Reported By:                larsga
Assigned To:                
====================================================================== 
Project:                    Raptor RDF Syntax Library
Issue ID:                   528
Category:                   api
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
Syntax Name:                NTriples 
====================================================================== 
Date Submitted:             2013-01-29 09:20
Last Modified:              2013-01-29 09:20
====================================================================== 
Summary:                    NTriplesParser does not return triples in document
order
Description: 
NTriplesParser returns statements in a different order from the order in the
original file. The consequence is that trying to process large files by sorting
them, and then doing one resource at a time doesn't work, because you never know
when you've seen all statements about one resource.

The output I get from the script is, giving line numbers in the original file:
8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, ...

So it looks like it's using a small buffer and parsing each buffer backwards.

Steps to Reproduce: 
Pick a largish NTriples file, run this Python script:

parser = RDF.NTriplesParser()
for stmt in parser.parse_as_stream(sys.argv[1]):
    print str(stmt.subject), str(stmt.predicate), str(stmt.object)

The order of statements printed does not match that of the file.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-01-29 09:20 larsga         New Issue                                    
======================================================================



More information about the redland-dev mailing list