use of org.apache.jena.rdf.model.Model 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.Model 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.Model in project jena by apache.
the class LocationMapper method toModel.
public Model toModel() {
Model m = ModelFactory.createDefaultModel();
m.setNsPrefix("lmap", "http://jena.hpl.hp.com/2004/08/location-mapping#");
toModel(m);
return m;
}
use of org.apache.jena.rdf.model.Model in project jena by apache.
the class TestLangRdfJson method rdfjson_read_objectlist_uris.
@Test
public void rdfjson_read_objectlist_uris() {
String s = "{ \"http://example.org/subject\" : { \"http://example.org/predicate\" : [ { \"type\" : \"uri\" , \"value\" : \"http://example.org/object\" } , { \"type\" : \"uri\" , \"value\" : \"http://example.org/object2\" } ] } }";
String s2 = "<http://example.org/subject> <http://example.org/predicate> <http://example.org/object> .\n" + "<http://example.org/subject> <http://example.org/predicate> <http://example.org/object2> .";
assertEquals(2, parseCount(s));
Model m = parseToModelRdfJson(s);
Model m2 = parseToModelNTriples(s2);
assertTrue(m.isIsomorphicWith(m2));
}
use of org.apache.jena.rdf.model.Model 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));
}
Aggregations