[ https://issues.apache.org/jira/browse/JENA-624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14991886#comment-14991886 ]
ASF GitHub Bot commented on JENA-624: ------------------------------------- Github user afs commented on a diff in the pull request: https://github.com/apache/jena/pull/94#discussion_r44029914 --- Diff: jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/InMemDatasetAssembler.java --- @@ -0,0 +1,67 @@ +package org.apache.jena.sparql.core.assembler; + +import static org.apache.jena.assembler.JA.MemoryDataset; +import static org.apache.jena.assembler.JA.data; +import static org.apache.jena.query.DatasetFactory.createTxnMem; +import static org.apache.jena.riot.RDFDataMgr.loadModel; +import static org.apache.jena.riot.RDFDataMgr.read; +import static org.apache.jena.sparql.core.assembler.AssemblerUtils.setContext; +import static org.apache.jena.sparql.core.assembler.DatasetAssemblerVocab.*; +import static org.apache.jena.sparql.util.FmtUtils.stringForRDFNode; +import static org.apache.jena.sparql.util.graph.GraphUtils.*; + +import java.util.function.Predicate; + +import org.apache.jena.assembler.Assembler; +import org.apache.jena.assembler.Mode; +import org.apache.jena.assembler.assemblers.AssemblerBase; +import org.apache.jena.query.Dataset; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.rdf.model.RDFNode; +import org.apache.jena.rdf.model.Resource; + +/** + * An {@link Assembler} that creates in-memory {@link Dataset}s. + * + */ +public class InMemDatasetAssembler extends AssemblerBase { + + @Override + public Dataset open(final Assembler assembler, final Resource root, final Mode mode) { + checkType(root, MemoryDataset); + final Dataset dataset = createTxnMem(); + setContext(root, dataset.getContext()); + // Default graph can be defined with ja:graph or ja:defaultGraph + final Resource defaultGraphDef = root.hasProperty(pDefaultGraph) ? getResourceValue(root, + pDefaultGraph) : root.hasProperty(pGraph) ? getResourceValue(root, pGraph) : null; --- End diff -- My suggested design was to enable files to be read directly into an in-memory assembler. That to me is the major use case for getting data into dataset. Building a model and copying it in (ja:defaultGraph, ja:namedGraph) allows precomputation (e.g. rules) - I think that's a specialist use case (if it's confusing, lets leave that for the general dataset). > Develop a new in-memory RDF Dataset implementation > -------------------------------------------------- > > Key: JENA-624 > URL: https://issues.apache.org/jira/browse/JENA-624 > Project: Apache Jena > Issue Type: Improvement > Reporter: Andy Seaborne > Assignee: A. Soroka > Labels: gsoc, gsoc2015, java, linked_data, rdf > > The current (Jan 2014) Jena in-memory dataset uses a general purpose > container that works for any storage technology for graphs together with > in-memory graphs. > This project would develop a new implementation design specifically for RDF > datasets (triples and quads) and efficient SPARQL execution, for example, > using multi-core parallel operations and/or multi-version concurrent > datastructures to maximise true parallel operation. > This is a system project suitable for someone interested in datatbase > implementation, datastructure design and implementation, operating systems or > distributed systems. > Note that TDB can operate in-memory using a simulated disk with > copy-in/copy-out semantics for disk-level operations. It is for faithful > testing TDB infrastructure and is not designed performance, general in-memory > use or use at scale. While lesson may be learnt from that system, TDB > in-memory is not the answer here. -- This message was sent by Atlassian JIRA (v6.3.4#6332)