I have not followed this discussion very closely so please excuse any items
that have already been discussed.

You state you are serializing the result set to XML apply a style sheet and
output as json.

Does your XML processing use the XML Dom or SAX processor?  (DOM results in
a memory footprint of approx 3x document size)  You can run the Style sheet
processing directly agains the SAX processor and have a minimal footprint.

Does your stylesheet output the JSON or do you use an XML to JSON
converter?  If the latter, is does it use or can it use streaming like the
SAX parser does?

Claude


On Thu, Jun 6, 2013 at 1:28 PM, Brice Sommacal <[email protected]>wrote:

> Hi Olivier,
>
> Thanks for the tips for using your library.
> It may be useful one day.
> Can I have a look at it? I'm wondering how the n3 graph is read (from a
> file?)
> Is it possible to manage an other data source from? like a RDF Store?
>
> For my case, my code is inside a java servlet and I don't manage to set up
> the application with data from a IHM. So there is no way to use a
> javascript library (not yet ;-))
>
> Thanks anyway,
>
>
> Brice
>
>
> 2013/6/5 Olivier Rossel <[email protected]>
>
> > i have a small javascript that converts a n3 graph into a javascript
> graph
> > of objects.
> > if your problem is related to XML stuff and such a lib could help, let me
> > know.
> > (it might be interesting to contribute it directly to exhibit, btw)
> >
> >
> > On Wed, Jun 5, 2013 at 6:13 PM, Brice Sommacal <[email protected]
> > >wrote:
> >
> > > Hello everyone,
> > >
> > > I'm facing a "java.lang.OutOfMemoryError: GC overhead limit exceeded"
> > error
> > > and I would like an advice about how I could optimize my code.
> > >
> > > The aim of this method is to run a SPARQL query, convert it on a XML
> > format
> > > and then apply a XSL stylesheet[1] to write a JSON format (readable by
> > > Exhibit - Scripted [2]).
> > >
> > >  My piece of code was working well untill today. (I have been trying to
> > > query a big model and the query returns too much results).
> > > This makes my program break.
> > >
> > > <quote>
> > > Query queryToExec = QueryFactory.create(query, Syntax.syntaxARQ);
> > > QueryExecution qexec = QueryExecutionFactory.create(queryToExec,
> ontoIn);
> > >  ResultSet result = null;
> > > BufferedOutputStream buf;
> > > try{
> > >  result = qexec.execSelect();
> > > buf = new BufferedOutputStream(new FileOutputStream(new File(root +
> > > "XML/JSON_XML/"+qNameClass+".xml")));
> > >  //Serialization of the resultSet
> > > ResultSetFormatter.outputAsXML(buf, result);
> > > buf.close();
> > >  }
> > > catch (Exception e) {
> > > e.printStackTrace();
> > >  }
> > > finally{
> > > qexec.close();
> > > }
> > > </quote>
> > >
> > > I know that writing XML file use loads memory....
> > >
> > > I was thinking of:
> > >  - creating several XML files by tracing the ResullSetFormatter memory
> > > usage. (is there possible?)
> > >  - avoiding XML intermediate format and write directly in one or
> several
> > > JSON file...
> > >  - ...
> > >
> > >
> > > >  Is there someone whom find a way to avoid this kind of error
> (without
> > > increasing Xms Xmx) ??
> > >
> > > Thanks in advance,
> > >
> > >
> > > Brice
> > >
> > > [1] http://data-gov.tw.rpi.edu/wiki/Sparqlxml2exhibitjson.xsl
> > > [2] http://www.simile-widgets.org/exhibit3/
> > >
> >
>



-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
Identity: https://www.identify.nu/[email protected]
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to