On 02/07/12 11:07, Holger Knublauch wrote:
On 7/2/2012 18:47, Stephen Allen wrote:
On Mon, Jul 2, 2012 at 12:36 AM, Holger Knublauch
<[email protected]> wrote:
Hi all,
I am aware of Graph.isIsomorphicWith, but I need a function that tests
whether Graph A is a sub-set of Graph B, including the ability to map
bnodes
into each other. Does that exist in Jena?
How about:
ask {
graph <A> { ?s ?p ?o }
minus { graph <B> { ?s ?p ?o } }
}
That may work for named nodes, but what about bnode structures such as
complex OWL class expressions? The bnode identity may be different in
both graphs, yet their patterns of co-existence need to be compared. A
triple-by-triple comparison will not be able to handle this correctly.
There's nothing built into Jena for this, as far as I know.
It's not trivial. Subgraph isomorphism is NP-Complete whereas graph
isomorphism (the job done by isIsomorphicWith) is (possibly)
fractionally easier - it is NP but (probably) not NP-Complete.
Dave