Dear Jena Devs,

I am further into my application and think I found a violation of the
Liskov Substitution principle. In short, the principle states that using a
subtype of a type should not alter the meaning of the application. While I
was driving my application, I discovered this fuzzy description of
method org.apache.jena.sparql.core.DatasetGraph.getGraph(Node).

/** Get the graph named by graphNode : returns null on no graph
     * NB Whether a dataset contains a graph if there are no triples is not
defined - see the specifc implementation.
     * Some datasets are "open" - they have all graphs even if no triples,
     * */

While I see the point, that some dataset graphs follow the Open World
Principle and, therefore, rather return an empty graph instead of a
nothing, it is a struggle for me as a developer because I cannot reason
about the actual behaviour when I first call Dataset.remove and then
Dataset.getNamedModel to assure that the model is gone. Using the dataset
which is returned by the TDBFactory would actually fails this test.

My questions are: Is there a guideline which Datasetgraphs are used when?
Is there a possibility to determine whether a graph is present or not? How
does the union of all dataset graphs look like under the "open" assumption?

Best regards,
Gregor

Reply via email to