public interface HGTypeSchema<TypeDescriptor>
Modifier and Type | Method and Description |
---|---|
void |
defineType(URI typeId,
HGHandle typeHandle)
Construct a new HyperGraphDB type from the specified type identifier
URI . |
HGHandle |
findType(URI typeId)
Return the
HGHandle of an existing HyperGraph type that corresponds
to the specified type identifier according to this schema. |
HGAtomType |
fromRuntimeType(HGHandle typeHandle,
HGAtomType typeInstance)
If a given type is wrapped under a different runtime representation by
the
toRuntimeType(HGHandle, HGAtomType) method, this method
retrieves the underlying default representation as constructed by the
type system. |
String |
getName()
Return the name of this
HGTypeSchema . |
TypeDescriptor |
getTypeDescriptor(URI typeId)
Return the
TypeDescriptor corresponding to the passed in type
identifier. |
void |
initialize(HyperGraph graph)
Initialize the schema with the
HyperGraph instance to which it is bound. |
void |
removeType(URI typeId) |
HGAtomType |
toRuntimeType(HGHandle typeHandle,
HGAtomType typeInstance)
The type schema may wrap a given HyperGraphDB type into a different
runtime instance.
|
URI |
toTypeURI(Class<?> javaClass) |
URI |
toTypeURI(Object object) |
String getName()
Return the name of this HGTypeSchema
. The name of a type
schema uniquely identifies it.
void initialize(HyperGraph graph)
Initialize the schema with the HyperGraph
instance to which it is bound.
A given schema runtime instance is only bound to one database instance.
graph
- HGHandle findType(URI typeId)
Return the HGHandle
of an existing HyperGraph type that corresponds
to the specified type identifier according to this schema.
typeId
- The identifier of the type. The identifier must be valid
within this schema. In particular the schema part of the URI must match
this schema's name.HGHandle
of the HyperGraph type if it exists or null
if it doesn't.void defineType(URI typeId, HGHandle typeHandle)
Construct a new HyperGraphDB type from the specified type identifierURI
.
It is the responsibility of the schema implementation to find the correct
TypeDescriptor
for that identifier. The schema may return an existing
HyperGraph type that corresponds to the identifier is it finds one already
in the database. However, types, like other atoms, are not guaranteed to be
immutable. Therefore, a schema does not "own" a HyperGraph type and the latter
may be modified outside of its control.
typeId
- The identifier of the type. The identifier must be valid
within this schema. In particular the schema part of the URI must match
this schema's name.void removeType(URI typeId)
TypeDescriptor getTypeDescriptor(URI typeId)
Return the TypeDescriptor
corresponding to the passed in type
identifier.
typeId
- HGAtomType toRuntimeType(HGHandle typeHandle, HGAtomType typeInstance)
The type schema may wrap a given HyperGraphDB type into a different
runtime instance. This is useful when atoms, and therefore in all likelihood
their types as well, have different runtime representations depending on
the current type schema in effect. Every time a type is loaded by the type
system, the toRuntimeType
of the current type schema is called
to give it a change to provide a different representation.
typeHandle
- The HGHandle
of the type.typeInstance
- The type instance constructed by default from the
type system.HGAtomType fromRuntimeType(HGHandle typeHandle, HGAtomType typeInstance)
If a given type is wrapped under a different runtime representation by
the toRuntimeType(HGHandle, HGAtomType)
method, this method
retrieves the underlying default representation as constructed by the
type system.
typeHandle
- The HGHandle
of the type.typeInstance
- A modified runtime representation of the type.Copyright © 2015. All rights reserved.