com.hp.hpl.jena.enhanced
Class EnhGraph

java.lang.Object
  extended bycom.hp.hpl.jena.enhanced.Polymorphic
      extended bycom.hp.hpl.jena.enhanced.EnhGraph
Direct Known Subclasses:
com.hp.hpl.jena.rdf.model.impl.ModelCom

public class EnhGraph
extends Polymorphic

A specialisation of Polymorphic that models an extended graph - that is, one that containsEnhanced nodes or one that itself exposes additional capabilities beyond the graph API.

Author:
Jeremy Carroll (original code)
Chris Dollin (original code)
Ian Dickinson (refactoring and commentage)

Constructor Summary
EnhGraph(Graph g, Personality p)
          Construct an enhanced graph from the given underlying graph, and a factory for generating enhanced nodes.
 
Method Summary
 Graph asGraph()
          Answer the normal graph that this enhanced graph is wrapping.
 boolean equals(java.lang.Object o)
          An enhanced graph is equal to another graph g iff the underlying graphs are equal.
 EnhNode getNodeAs(Node n, java.lang.Class interf)
          Answer an enhanced node that wraps the given node and conforms to the given interface type.
 com.hp.hpl.jena.util.cache.CacheControl getNodeCacheControl()
          Answer the cache controlle for this graph
 int hashCode()
          Hashcode for an enhnaced graph is delegated to the underlyin graph.
 boolean isIsomorphicWith(EnhGraph eg)
          Answer true if the given enhanced graph contains the same nodes and edges as this graph.
 boolean isValid()
          answer true iff this enhanced node is still underpinned in the graph by triples appropriate to its type.
 void setNodeCache(com.hp.hpl.jena.util.cache.Cache cc)
          Set the cache controller object for this graph
 
Methods inherited from class com.hp.hpl.jena.enhanced.Polymorphic
addView, supports
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnhGraph

public EnhGraph(Graph g,
                Personality p)
Construct an enhanced graph from the given underlying graph, and a factory for generating enhanced nodes.

Parameters:
g - The underlying plain graph, may be null to defer binding to a given graph until later.
p - The personality factory, that maps types to realisations
Method Detail

isValid

public boolean isValid()
Description copied from class: Polymorphic
answer true iff this enhanced node is still underpinned in the graph by triples appropriate to its type.

Specified by:
isValid in class Polymorphic

asGraph

public Graph asGraph()
Answer the normal graph that this enhanced graph is wrapping.

Returns:
A graph

hashCode

public final int hashCode()
Hashcode for an enhnaced graph is delegated to the underlyin graph.

Returns:
The hashcode as an int

equals

public final boolean equals(java.lang.Object o)
An enhanced graph is equal to another graph g iff the underlying graphs are equal. This is deemed to be a complete and correct interpretation of enhanced graph equality, which is why this method has been marked final.

Note that this equality test does not look for correspondance between the structures in the two graphs. To test whether another graph has the same nodes and edges as this one, use isIsomorphicWith(com.hp.hpl.jena.enhanced.EnhGraph).

Specified by:
equals in class Polymorphic
Parameters:
o - An object to test for equality with this node
Returns:
True if o is equal to this node.
See Also:
isIsomorphicWith(com.hp.hpl.jena.enhanced.EnhGraph)

isIsomorphicWith

public final boolean isIsomorphicWith(EnhGraph eg)
Answer true if the given enhanced graph contains the same nodes and edges as this graph. The default implementation delegates this to the underlying graph objects.

Parameters:
eg - A graph to test
Returns:
True if eg is a graph with the same structure as this.

getNodeAs

public EnhNode getNodeAs(Node n,
                         java.lang.Class interf)
Answer an enhanced node that wraps the given node and conforms to the given interface type.

Parameters:
n - A node (assumed to be in this graph)
interf - A type denoting the enhanced facet desired
Returns:
An enhanced node

getNodeCacheControl

public com.hp.hpl.jena.util.cache.CacheControl getNodeCacheControl()
Answer the cache controlle for this graph

Returns:
A cache controller object

setNodeCache

public void setNodeCache(com.hp.hpl.jena.util.cache.Cache cc)
Set the cache controller object for this graph

Parameters:
cc - The cache controller


Copyright © 2001-2003 Hewlett-Packard. All Rights Reserved.