use of org.apache.jena.rdf.model.Model in project jena by apache.
the class ExRIOT_1 method main.
public static void main(String... argv) {
Model m = ModelFactory.createDefaultModel();
// read into the model.
m.read("data.ttl");
// Alternatively, use the RDFDataMgr, which reads from the web,
// with content negotiation. Plain names are assumed to be
// local files where file extension indicates the syntax.
Model m2 = RDFDataMgr.loadModel("data.ttl");
// read in more data, the remote server serves up the data
// with the right MIME type.
RDFDataMgr.read(m2, "http://host/some-published-data");
// Read some data but also give a hint for the synatx if it is not
// discovered by inspectying the file or by HTTP content negotiation.
RDFDataMgr.read(m2, "some-more-data.out", RDFLanguages.TURTLE);
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class ExRIOT_out1 method main.
public static void main(String[] args) {
Model model = RDFDataMgr.loadModel("D.ttl");
System.out.println();
System.out.println("#### ---- Write as Turtle");
System.out.println();
RDFDataMgr.write(System.out, model, Lang.TURTLE);
System.out.println();
System.out.println("#### ---- Write as Turtle (streaming)");
System.out.println();
RDFDataMgr.write(System.out, model, RDFFormat.TURTLE_BLOCKS);
System.out.println();
System.out.println("#### ---- Write as Turtle via model.write");
System.out.println();
model.write(System.out, "TTL");
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class ExRIOT_out2 method main.
public static void main(String[] args) {
Model model = RDFDataMgr.loadModel("D.ttl");
System.out.println();
System.out.println("#### ---- Write as TriG");
System.out.println();
// This wil be the default graph of the dataset written.
RDFDataMgr.write(System.out, model, Lang.TRIG);
// Loading Turtle as Trig reads into the default graph.
Dataset dataset = RDFDataMgr.loadDataset("D.ttl");
System.out.println();
System.out.println("#### ---- Write as NQuads");
System.out.println();
RDFDataMgr.write(System.out, dataset, Lang.NQUADS);
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class ExModelSDB method main.
public static void main(String... argv) {
Store store = StoreFactory.create("sdb.ttl");
Model model = SDBFactory.connectDefaultModel(store);
StmtIterator sIter = model.listStatements();
for (; sIter.hasNext(); ) {
Statement stmt = sIter.nextStatement();
System.out.println(stmt);
}
sIter.close();
store.close();
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestTextTDB method dataTurtle.
private static void dataTurtle(Dataset ds, String turtle) {
Model model = ds.getDefaultModel();
Reader reader = new StringReader(turtle);
ds.begin(ReadWrite.WRITE);
model.read(reader, "", "TURTLE");
ds.commit();
}
Aggregations