/** * the method to write the R2RML mappings * from an rdf Model to a file * @param file the ttl file to write to */ public void write(File file) throws Exception { try { FileOutputStream fos = new FileOutputStream(file); write(fos); } catch (Exception e) { e.printStackTrace(); throw e; } }
public static void main(String args[]) { String file = "/Users/mindaugas/r2rml/test2.ttl"; try { R2RMLReader reader = new R2RMLReader(file); OWLOntology ontology = null; R2RMLWriter writer = new R2RMLWriter(reader.readModel(URI.create("test")),URI.create("test"), ontology); File out = new File("/Users/mindaugas/r2rml/out.ttl"); // Graph g = writer.getGraph(); // Iterator<Statement> st = g.iterator(); // while (st.hasNext()) // System.out.println(st.next()); writer.write(out); } catch (Exception e) { e.printStackTrace(); } } }
writer.write(out); System.out.println("R2RML mapping file " + outfile + " written!");