use of org.apache.jena.query.Dataset in project jena by apache.
the class TestLocalIsolation method isolationDataset.
private void isolationDataset(Isolation isolation, boolean expected) {
Dataset base = DatasetFactory.createTxnMem();
RDFConnection conn1 = RDFConnectionFactory.connect(base, isolation);
Quad quad = SSE.parseQuad("(:g :s :p :o)");
try (RDFConnection conn2 = conn1) {
Dataset ds = conn2.fetchDataset();
ds.asDatasetGraph().add(quad);
}
assertEquals(expected, base.asDatasetGraph().contains(quad));
}
use of org.apache.jena.query.Dataset in project jena by apache.
the class TestLocalIsolation method isolationModel.
private void isolationModel(Isolation level, boolean expected) {
Dataset base = DatasetFactory.createTxnMem();
Statement stmt = base.getDefaultModel().createStatement(subject, property, object);
RDFConnection conn1 = RDFConnectionFactory.connect(base, level);
try (RDFConnection conn2 = conn1) {
Model m = conn2.fetch();
m.add(stmt);
}
assertEquals(expected, base.getDefaultModel().contains(stmt));
}
use of org.apache.jena.query.Dataset in project jena by apache.
the class AbstractTestRDFConnection method dataset_put_2.
@Test
public void dataset_put_2() {
try (RDFConnection conn = connection()) {
conn.putDataset(dataset);
conn.putDataset(dataset2);
Dataset ds1 = conn.fetchDataset();
assertTrue("Datasets not isomorphic", isomorphic(dataset2, ds1));
}
}
use of org.apache.jena.query.Dataset in project jena by apache.
the class AbstractTestRDFConnection method dataset_post_2.
@Test
public void dataset_post_2() {
try (RDFConnection conn = connection()) {
conn.loadDataset(dataset);
conn.loadDataset(dataset2);
Dataset ds1 = conn.fetchDataset();
long x = Iter.count(ds1.listNames());
assertEquals("NG count", 3, x);
assertFalse("Datasets are isomorphic", isomorphic(dataset, ds1));
assertFalse("Datasets are isomorphic", isomorphic(dataset2, ds1));
}
}
use of org.apache.jena.query.Dataset in project jena by apache.
the class QueryTest method createDataset.
private static Dataset createDataset(List<String> defaultGraphURIs, List<String> namedGraphURIs) {
// Allow "qt:data" to be quads in defaultGraphURIs.
Dataset ds = DatasetFactory.createGeneral();
if (defaultGraphURIs != null) {
for (String sourceURI : defaultGraphURIs) {
RDFDataMgr.read(ds, sourceURI);
}
}
if (namedGraphURIs != null) {
for (String sourceURI : namedGraphURIs) {
String absSourceURI = IRIResolver.resolveString(sourceURI);
Model m = ds.getNamedModel(absSourceURI);
RDFDataMgr.read(m, sourceURI);
}
}
return ds;
}
Aggregations