use of org.ontoware.rdf2go.exception.ModelRuntimeException in project stanbol by apache.
the class XsltExtractor method extract.
public synchronized void extract(String id, Document doc, Map<String, Object> params, RDFContainer result) throws ExtractorException {
if (params == null) {
params = new HashMap<String, Object>();
}
params.put(this.uriParameter, id);
initTransformerParameters(params);
Source source = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult output = new StreamResult(writer);
try {
this.transformer.transform(source, output);
String rdf = writer.toString();
LOG.debug(rdf);
StringReader reader = new StringReader(rdf);
result.getModel().readFrom(reader, this.syntax);
reader.close();
} catch (TransformerException e) {
throw new ExtractorException(e.getMessage(), e);
} catch (ModelRuntimeException e) {
throw new ExtractorException(e.getMessage(), e);
} catch (IOException e) {
throw new ExtractorException(e.getMessage(), e);
}
}
Aggregations