use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class TestDatasetWithLuceneMultilingualTextIndex method before.
@Before
public void before() {
Reader reader = new StringReader(SPEC);
Model specModel = ModelFactory.createDefaultModel();
specModel.read(reader, "", "TURTLE");
TextAssembler.init();
Resource root = specModel.getResource(SPEC_ROOT_URI);
dataset = (Dataset) Assembler.general.open(root);
}
use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class TestDatasetWithLuceneTextIndexWithLangField method before.
@Before
public void before() {
Reader reader = new StringReader(SPEC);
Model specModel = ModelFactory.createDefaultModel();
specModel.read(reader, "", "TURTLE");
TextAssembler.init();
Resource root = specModel.getResource(SPEC_ROOT_URI);
dataset = (Dataset) Assembler.general.open(root);
}
use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class StageAltMain method makeData.
private static Model makeData() {
Model model = ModelFactory.createDefaultModel();
Resource r = model.createResource(NS + "r");
Property p1 = model.createProperty(NS + "p1");
Property p2 = model.createProperty(NS + "p2");
model.add(r, p1, "xyz");
model.add(r, p2, "abc");
return model;
}
use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class TestLangTurtle method optionalDotInBase.
@Test
public void optionalDotInBase() {
Model model = ModelFactory.createDefaultModel();
StringReader reader = new StringReader("@base <http://example/> <x> <p> <o> .");
RDFDataMgr.read(model, reader, null, RDFLanguages.TURTLE);
assertEquals(1, model.size());
Resource r = model.createResource("http://example/x");
Property p = model.createProperty("http://example/p");
assertTrue(model.contains(r, p));
}
use of org.apache.jena.rdf.model.Resource in project jena by apache.
the class TestUpdateOperations method insert_where_01.
@Test
public void insert_where_01() {
Model m = ModelFactory.createDefaultModel();
Resource anon = m.createResource();
anon.addProperty(RDF.type, OWL.Thing);
assertEquals(1, m.size());
UpdateRequest req = UpdateFactory.create("INSERT { ?s ?p ?o } WHERE { ?o ?p ?s }");
UpdateAction.execute(req, m);
assertEquals(2, m.size());
assertEquals(1, m.listStatements(anon, null, (RDFNode) null).toList().size());
assertEquals(1, m.listStatements(null, null, anon).toList().size());
}
Aggregations