incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Adamou <>
Subject Setting a read limit when parsing a Graph
Date Tue, 14 Aug 2012 11:53:42 GMT

I need to write a function that performs lookahead of the OWL ontology 
ID for a Graph, therefore it has to scan the content up to a certain 
point to see if it has found an ontology IRI / version IRI pair.

I thought that setting mark() on a BufferedInputStream did the trick, 
something like:

MGraph graph = new SimpleMGraph();
BufferedInputStream bIn = new BufferedInputStream(content);
bIn.mark(1240); // Read up to 1k
parser.parse(graph, bIn, SupportedFormat.RDF_XML);

(parser has a Jena parser provider registered)

But apparently this is not working. Even for streams much longer than 1 
kiB, with the interesting triples right at the very end, these triples 
are always found.

Do the Clerezza parser override the marks on a buffered stream, or maybe 
Jena is doing so? Or even better, am I doing this wrong?

-- Alessandro

M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy

"I will give you everything, just don't demand anything."
(Ettore Petrolini, 1917)

Not sent from my iSnobTechDevice

View raw message