public class HGRelTypeConstructor extends Object implements HGSearchable<HGRelType,HGPersistentHandle>, HGCompositeType
The type of HGRelType. Even though we could have treated
HGRelType, that would have created different RecordType
which would have made it harder working purely with HGRelationships
outside of Java (since one would have to get to the RecordType by
querying on the class name). In any case, a HGRelType is conceptually
not really a record...
| Modifier and Type | Field and Description |
|---|---|
static String |
INDEX_NAME |
| Constructor and Description |
|---|
HGRelTypeConstructor() |
| Modifier and Type | Method and Description |
|---|---|
HGSearchResult<HGPersistentHandle> |
find(HGRelType key)
Returns a
HGSearchResult over all values matching a key in the
searched entity. |
Iterator<String> |
getDimensionNames()
Return an
Iterator listing the names of all
dimensions of this composite type. |
HGProjection |
getProjection(String dimensionName)
Get the projection function for a particular dimension.
|
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.
|
void |
setHyperGraph(HyperGraph graph)
During load time, set the
HyperGraph
instance to which this atom belongs. |
HGPersistentHandle |
store(Object instance)
Store a run-time instance of a hypergraph atom into the hypergraph
HGStore
as a new atom. |
boolean |
subsumes(Object general,
Object specific)
A
HGRelType X subsumes a HGRelType Y
iff both have the same name and arity and each target atom of X subsumes
the corresponding target atom of Y. |
public static final String INDEX_NAME
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet)
HGAtomTypeConstruct 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.
make in interface HGAtomTypehandle - 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 - A lazy reference to the set of links pointing to this atom. This is
null if we are constructing an internal/nested value of some complex type.null.
In case the handle points to an invalid instance (inexisting or with
a erronous layout), the method should throw a HGException.public HGPersistentHandle store(Object instance)
HGAtomTypeStore a run-time instance of a hypergraph atom into the hypergraph HGStore
as a new atom.
store in interface HGAtomTypeinstance - The atom instance.public void release(HGPersistentHandle handle)
HGAtomTypeRelease 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.
release in interface HGAtomTypehandle - The persistent handle of the value to release.public boolean subsumes(Object general, Object specific)
A HGRelType X subsumes a HGRelType Y
iff both have the same name and arity and each target atom of X subsumes
the corresponding target atom of Y.
In plain language this reflects the logical requirement that each instance relationship with type Y be also an instance (logically) of X.
subsumes in interface HGAtomTypegeneral - The object which might be more general. Cannot be null.specific - The object which might be more specific. Cannot be null.true if specific can be used whenever general
is required and false otherwise.public HGSearchResult<HGPersistentHandle> find(HGRelType key)
HGSearchable
Returns a HGSearchResult over all values matching a key in the
searched entity.
If there are no matches, the method should return HGSearchResult.EMPTY. The
method will never return a null. A HGException may
be thrown in exceptional situations.
find in interface HGSearchable<HGRelType,HGPersistentHandle>public Iterator<String> getDimensionNames()
HGCompositeTypeReturn an Iterator listing the names of all
dimensions of this composite type. A projection function can be obtained
through the getProjection method.
getDimensionNames in interface HGCompositeTypepublic HGProjection getProjection(String dimensionName)
HGCompositeTypeGet the projection function for a particular dimension.
getProjection in interface HGCompositeTypedimensionName - The name of the dimension.HGProjection instance.public void setHyperGraph(HyperGraph graph)
HGGraphHolderDuring load time, set the HyperGraph
instance to which this atom belongs.
setHyperGraph in interface HGGraphHolderCopyright © 2015. All rights reserved.