org.hypergraphdb.type
Interface HGAtomType

All Superinterfaces:
HGGraphHolder
All Known Subinterfaces:
HGCompositeType, HGPrimitiveType<JavaType>
All Known Implementing Classes:
AbstractTypeConstructor, ArrayType, ArrayTypeConstructor, AtomQueueType, AtomRefType, AtomSetType, AtomStackType, BooleanPrimitiveArrayType, BooleanType, BytePrimitiveArrayType, ByteType, CharPrimitiveArrayType, CharType, CollectionType, CollectionTypeConstructor, DoublePrimitiveArrayType, DoubleType, EnumType, EnumTypeConstructor, FloatPrimitiveArrayType, FloatType, HGAbstractCompositeType, HGAbstractType, HGAtomTypeBase, HGHandleType, HGRelType, HGRelTypeConstructor, IntPrimitiveArrayType, IntType, JavaAbstractBinding, JavaBeanBinding, JavaInterfaceBinding, JavaObjectBinding, LinkType, LongPrimitiveArrayType, LongType, MapType, MapTypeConstructor, NullType, NumericTypeBase, PlainLinkType, PrimitiveArrayType, PrimitiveTypeBase, RecordType, RecordTypeConstructor, SerializableType, ShortPrimitiveArrayType, ShortType, SlotType, StringType, SubsumesType, TextType, Top

public interface HGAtomType
extends HGGraphHolder

A HGAtomType is an object capable of translating run-time atom instances to/from data in HGStore as well as providing minimal semantic information about the entities being constructed in the form of a predicate, called subsumes that determines whether one entity is a specialization of another.

HGAtomTypes deal with hypergraph atom values, their layout and management in the HGStore. An atom type can be seen as a constructor that "knows" how to build an appropriately typed, in-memory instance of an atom. It is capable of constructing both node and link instances. It is also capable of recording an atom value in the HGStore or removing it from there.

The motivation behind the subsumes predicate is the notion of sub-typing. However, it has been lifted into a general semantic partial order relation between entities. If A subsumes B and B subsumes A then they are equivalent. For a more thourough discussion of the subsumes predicate and how it fits into the overall framework of HyperGraphDB's type system and general data management, please consult the HyperGraphDB manual.

Author:
Borislav Iordanov

Method Summary
 java.lang.Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet)
          Construct a new run-time instance of a hypergraph atom.
 void release(HGPersistentHandle handle)
          Release a hypergraph value instance from the persistent store.
 HGPersistentHandle store(java.lang.Object instance)
          Store a run-time instance of a hypergraph atom into the hypergraph HGStore as a new atom.
 boolean subsumes(java.lang.Object general, java.lang.Object specific)
          A generic semantic predicate that returns true if the first argument is more general than the second.
 
Methods inherited from interface org.hypergraphdb.HGGraphHolder
setHyperGraph
 

Method Detail

make

java.lang.Object make(HGPersistentHandle handle,
                      LazyRef<HGHandle[]> targetSet,
                      IncidenceSetRef incidenceSet)

Construct a new run-time instance of a hypergraph atom. A plain node must be constructed whenever the targetSet parameter is null or of length 0. Otherwise, a HGLink instance must be constructed.

It is not required that all atom types be able to construct both plain (node) atoms and HGLinks. It is up to an HGAtomType implementation to support either or both. When a HGLink counterpart is not available for a particular run-time type, an implementation may choose to create an instance of the default link value holder implementation HGValuedLink, provided by HyperGraph.

Parameters:
handle - The HGPersistentHandle of the atom value.
targetSet - When the atom is a link, this parameter holds the target set of the link. When the atom is a node, the parameter is an array of 0 length.
incidenceSet - TODO
Returns:
The run-time atom instance. The return value should never be null. In case the handle points to an invalid instance (inexisting or with a erronous layout), the method should throw a HGException.

store

HGPersistentHandle store(java.lang.Object instance)

Store a run-time instance of a hypergraph atom into the hypergraph HGStore as a new atom.

Parameters:
instance - The atom instance.
Returns:
The persistent handle of the stored value.

release

void release(HGPersistentHandle handle)

Release a hypergraph value instance from the persistent store.

This method should be called when a HGPersistentHandle returned from the store is no longer in use.

Parameters:
handle - The persistent handle of the value to release.

subsumes

boolean subsumes(java.lang.Object general,
                 java.lang.Object specific)

A generic semantic predicate that returns true if the first argument is more general than the second. Atom types must implement this notion of specialization whenever meaningful in the context of the entities being constructed.

The notion of subsumption can be seen as partial equivalence, or equivalence in one direction only.

As a relation, subsumtion is transitive and reflexive. The latter implies that, at a minimum, the subsumes method must return true if general.equals(specific).

Parameters:
general - The object which might be more general. Cannot be null.
specific - The object which might be more specific. Cannot be null.
Returns:
true if specific can be used whenever general is required and false otherwise.