The problem is here: 
https://github.com/apache/jena/blob/cc038809fb622779933831011909714e22ef494c/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssembler.java#L79

This is a for() loop reading all the RDFNode in the configuration file.
The "gName" variable corresponds to the "namedGraph" setting, and the "g" 
variable to the "graph" setting. When the execution reaches line #79 Model m = 
a.openModel(g); this (I guess) calls the "open" method overridden by hdt-java 
open(). So, if I return null, "Model m" will be null which is probably causing 
problems with the next line, ds.addNamedModel(gName, m);
I think this should be the correct behavior instead:


Model m = a.openModel(g);
if (m != null)
    ds.addNamedModel(gName, m);


it's just 1 additional line :)
This way, if the custom assembler returned 
ModelFactory.createModelForGraph(null) or return 
ModelFactory.createDefaultModel(), Fuseki will create a new but empty graph in 
the dataset. If instead the custom assembler open() function returns null, the 
model is not added at all.

What do you think? I haven't tried this because I don't know how to compile 
Jena/Fuseki, but I'm confident that it should work. Could somebody who knows 
how to compile Jena try this?

Thanks!




Subject: Re: Fuseki+HDT graceful "File not found"
> I've put a check here, in the "open" function:
>
>     if(!new File(file).isFile())
>         return null;

In the file HDTGraphAssembler.java, adding these lines before the
try..catch block seems to work, more or less...

        if (!new File (file).isFile ())
                return ModelFactory.createModelForGraph
(null);

I've tried this, and it looks like it creates an empty graph. That is,
I find the new graph in the dataset, but it's empty, no triples. I
don't know if or how it's possible to skip the entire graph entirely,
such that not even an empty graph is added to the dataset.
 

Reply via email to