Github user afs commented on a diff in the pull request:
https://github.com/apache/jena/pull/314#discussion_r152246555
--- Diff:
jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssembler.java
---
@@ -58,27 +64,33 @@ public Dataset createDataset(Assembler a, Resource
root, Mode mode) {
// Assembler description did not define one.
dftModel = GraphFactory.makeDefaultModel() ;
Dataset ds = DatasetFactory.create(dftModel) ;
- // -------- Named graphs
- List<RDFNode> nodes = GraphUtils.multiValue(root,
DatasetAssemblerVocab.pNamedGraph) ;
- for ( RDFNode n : nodes ) {
- if ( !(n instanceof Resource) )
- throw new DatasetAssemblerException(root, "Not a resource:
" + FmtUtils.stringForRDFNode(n));
- Resource r = (Resource)n;
-
- String gName = GraphUtils.getAsStringValue(r,
DatasetAssemblerVocab.pGraphName);
- Resource g = GraphUtils.getResourceValue(r,
DatasetAssemblerVocab.pGraph);
- if ( g == null ) {
- g = GraphUtils.getResourceValue(r,
DatasetAssemblerVocab.pGraphAlt);
- if ( g != null ) {
- Log.warn(this, "Use of old vocabulary: use :graph not
:graphData");
- } else {
- throw new DatasetAssemblerException(root, "no graph
for: " + gName);
+ Txn.executeWrite(ds, () -> {
+ // Load data into the default graph or quads into the dataset.
+ multiValueAsString(root, data)
+ .forEach(dataURI -> read(ds, dataURI));
+
--- End diff --
This interacts with the setting up of the dft graph/named graphs. It's
going to add dft graph just made (which might have content via `ja:content) but
also the named graphs. It's a dataset by links to the models where adding a
model replaces the model.
I'm not sure what he best balance is here -- options include (1) warning
and no action on seeing `ja:data` (with a note to use TIM) (2) do after all the
named models are added because parsing is adding quads, not replacing models
(3) allow this or specified models, which would be better done with TIM (4)
it's `ja:data` or specify graphs, not a combination; if `ja:data` return a TIM.
(4) looks like a good way to encourage TIM usage. If (4) then a plain,
empty `ja:RDFDataset` could be TIM as well.
---