* @param format
* @return
*/
public static String extractRDF(LocalRepository repository, RDFFormat format) {
StringWriter stringWriter = new StringWriter();
RdfDocumentWriter rdfDocumentWriter;
if (format == RDFFormat.NTRIPLES) {
rdfDocumentWriter = new NTriplesWriter(stringWriter);
} else if (format == RDFFormat.RDFXML) {
rdfDocumentWriter = new RdfXmlWriter(stringWriter);
} else {
rdfDocumentWriter = new TurtleWriter(stringWriter);
}
try {
for (Namespace namespace : Namespace.values()) {
rdfDocumentWriter.setNamespace(namespace.getName(), namespace.getURI());
}
repository.extractRDF(rdfDocumentWriter, true, true, true, true);
} catch (IOException e) {
e.printStackTrace();