When you say Dataset.remove, which doesn’t exist, are you talking about 
Dataset::removeNamedModel? If so, the comment for that method is "Remove a 
named graph.” That makes no particular guarantee about the behavior of 
Dataset::getNamedModel before-and-after the invocation of 
Dataset::removeNamedModel.

As I understand it, the idea of the (more-or-less intentional) ambiguity in the 
specification is that a graph may or may not have some existence apart from the 
existence of its contents, or to put it another way: the name of a named graph 
is an identifier, not a container. So it is legitimate to say that to remove a 
named graph is to remove all of the triples in it. It is also legitimate to say 
that to remove a named graph is to make its name resolve to nothing (null). 
Your problem, in that sense, is not an LSP violation. The problem is that you 
want to rely on a behavior which is intentionally left to the implementation to 
define.

---
A. Soroka
The University of Virginia Library

> On Nov 22, 2015, at 6:16 PM, Gregor Trefs <[email protected]> wrote:
> 
> 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