Which OWL reasoners understand named graphs?

Are there any OWL reasoners that can work across named graphs? If so, how do they fit with SPARQL queries that involve only some of the named graphs thereby restricting some of the possibe inferences? Do any reasoners reason with the named graphs themselves, eg what happens if you say two named graph URIs are owl:sameAs one another?

First, you have to say what OWL inference over named graphs means and for that you need a semantics for named graphs. There is no standardized semantics. As a starting point you could assume the semantics in the "Named Graphs, Provenance and Trust" paper [NGPT] but I'm not aware of any discussion or attempted standardization of NG semantics.

If you do mean NGPT then OWL inference and named graphs are orthogonal. OWL inference operates over some ontology which can be represented as a collection of triples. Named graphs are simply a way of naming a set of triples [*].

So in that sense, yes Jena supports OWL inference over named graphs in that you can create a single graph which is a (dynamic) union over those named graphs you want to include and then run inference over it. However, the inference machinery does not see the named graph origins of the triples. In particular none of the Jena rule engines support named graphs directly, premises are only expressible in terms of triples and builtins operating over those triples, not quads (for any of many different interpretations of what quads are).

As to reasoning over named graphs themselves then I'm not sure what inference you are expecting here but if you go by NGPT semantics then nothing much can happen. NGPT explicitly says that the name is a rigid identification of a specific set of triples. The set of triples is fixed, closed, not changeable, not amenable to reasoning over, that's it. So if you asserted ng1 owl:sameAs ng2 then either rdfgraph(ng1) = rdfgraph(ng2) in which you are consistent but haven't learned anything or rdfgraph(ng1) != rdfgraph(ng2) in which case it is inconsistent. Due to the intensional semantics of NGPT then there is a separation between the named graph and the rdfgraph it names so the owl:sameAs does mean that any statements about the named graph resources themselves are carried across, so it isn't a completely pointless exercise, but there's no subtle interplay between those properties and the rdfgraph extension.

This would be a lot easier as an email conversation.


[*] Actually that's oversimplifying. Most applications of named graphs seem to think that the name denotes a collection of triples. In NGPT that's not quite right, you have an abstract thing which is a named graph and each such thing can map to a (unique) name and a collection of triples. Named graphs can have other properties than just their name and rdfgraph.