/** * @param namedSourceList * @return a named graph container of graphs based on a list of URIs. */ public static Dataset createNamed(List<String> namedSourceList) { return create((List<String>) null, namedSourceList, null); }
@Override protected JenaConnection getConnection() throws SQLException { Dataset ds = supportsSerializable ? DatasetFactory.createTxnMem() : DatasetFactory.create() ; int transactionLevelSupported = supportsSerializable ? JenaConnection.TRANSACTION_SERIALIZABLE : JenaConnection.TRANSACTION_NONE ; return new MemConnection(ds, JenaConnection.DEFAULT_HOLDABILITY, JenaConnection.DEFAULT_AUTO_COMMIT, transactionLevelSupported, JdbcCompatibility.DEFAULT); }
/** * @param uriList URIs merged to form the default dataset * @return a dataset based on a list of URIs : these are merged into the default graph of the dataset. */ public static Dataset create(List<String> uriList) { return create(uriList, null, null); }
/** * @param uri URIs merged to form the default dataset * @return a dataset with a default graph and no named graphs */ public static Dataset create(String uri) { return create(uri, null, null); }
/** * Create a dataset container based on two list of URIs. The first is used to create the background (unnamed graph), * the second is used to create the collection of named graphs. * * (Jena calls graphs "Models" and triples "Statements") * * @param uri graph to be loaded into the unnamed, default graph * @param namedSourceList graphs to be attached as named graphs * @return Dataset */ public static Dataset create(String uri, List<String> namedSourceList) { return create(uri, namedSourceList, null); }
/** * Create a dataset based on two list of URIs. The first lists is used to create the background (unnamed graph) by * merging, the second is used to create the collection of named graphs. * * (Jena calls graphs "Models" and triples "Statements") * * @param uriList graphs to be loaded into the unnamed, default graph * @param namedSourceList graphs to be attached as named graphs * @return Dataset */ public static Dataset create(List<String> uriList, List<String> namedSourceList) { return create(uriList, namedSourceList, null); }
private static Dataset createDatasetByCode(File indexDir) throws IOException { // Base data Dataset ds1 = DatasetFactory.create(); return joinDataset(ds1, indexDir); }
private static Dataset readDatasetFromByteArray(byte[] datasetbytes) { Dataset dataset = DatasetFactory.create(); RDFDataMgr.read(dataset, new ByteArrayInputStream(datasetbytes), Lang.NQUADS); return dataset; }
private static Dataset createDatasetByCode(File indexDir) throws IOException { // Base data Dataset ds1 = DatasetFactory.create(); return joinDataset(ds1, indexDir); }
public static void doResponseModel(HttpAction action, Model model) { Dataset ds = DatasetFactory.create(model) ; ResponseDataset.doResponseDataset(action, ds); }
@Override public Dataset execConstructDataset(){ return execConstructDataset(DatasetFactory.create()) ; }
/** * Use from instead * * @param model * @return */ @Deprecated public static FluentQueryExecutionFactory<?> model(Model model, Context context) { Dataset dataset = DatasetFactory.create(model); return from(dataset, context); }
@Override protected RDFConnection connection() { // General purpose, mixed storage, MRSW dataset. Dataset ds = DatasetFactory.create(); return RDFConnectionFactory.connect(ds); } }
@Override public Stream<Quad> stream() { final Dataset dataset = create(); try (final InputStream input = client.getObject(req).getObjectContent()) { RDFParser.source(input).lang(NQUADS).parse(dataset); } catch (final IOException ex) { dataset.close(); throw new RuntimeTrellisException("Error parsing input from S3", ex); } return rdf.asDataset(dataset).stream().map(Quad.class::cast).onClose(dataset::close); } }
@Test public void collectionOfStreamOfEmptyDatasetsShouldBeEmpty() { Stream<Dataset> stream = Stream.<Dataset>builder() .add(DatasetFactory.create()) .add(DatasetFactory.create()) .add(DatasetFactory.create()).build(); final Dataset collected = stream.collect(testInstance()); assertTrue(collected.isEmpty()); }
public Dataset retrieveDataset(String graphName) { DatasetGraph dsg = TDBFactory.createDatasetGraph(); dsg.getContext().set(TDB.symUnionDefaultGraph, new NodeValueBoolean(true)); Dataset ds = DatasetFactory.create(dsg); Model model = retrieveModel(graphName); ds.addNamedModel(graphName, model); return ds; }
/** * Cleans up after the tests by closing the fake connection * * @throws SQLException */ @AfterClass public static void teardown() throws SQLException { // The derived test harnesses actually change the dataset behind the // scenes and so we need a temporary fake final dataset for closing the // connection or we get an error that the underlying dataset is already // closed connection.setJenaDataset(DatasetFactory.create()); connection.close(); }
@Test public void collectingOneDatasetGivesThatDataset() { Graph graph = parseGraph("(graph (triple <s1> <p1> <o1> ))"); Model model = createModelForGraph(graph); Dataset dataset = DatasetFactory.create(model); Node graphName = NodeFactory.createBlankNode(); dataset.addNamedModel(graphName.toString(), model); Dataset collection = Stream.<Dataset>builder().add(dataset).build().collect(testInstance()); assertDatasetsAreIsomorphicPerGraph(dataset, collection); }
public void setup() { DatasetGraph dsg = TDBFactory.createDatasetGraph(); dsg.getContext().set(TDB.symUnionDefaultGraph, true); Dataset myDataset = DatasetFactory.wrap(dsg); baseModel = myDataset.getNamedModel("http://example.com/baseModel"); baseModel = QueryEngineTest.populateModel(baseModel); dftModel = Factory.getInstance(eval, "http://example.com/securedModel", baseModel); dataset = DatasetFactory.create(); dataset.setDefaultModel(dftModel); }
@Test public void testInitialBindings7() { // JENA-1354 Query query = QueryFactory.create("SELECT DISTINCT ?x WHERE {}"); Dataset ds = DatasetFactory.create(); QuerySolutionMap initialBinding = new QuerySolutionMap(); initialBinding.add("a", ResourceFactory.createTypedLiteral(Boolean.TRUE)); try ( QueryExecution qexec = QueryExecutionFactory.create(query, ds, initialBinding) ) { assertFalse(qexec.execSelect().next().contains("a")); } }