\OntologyWrapperWrapper

Wrapper

This class extends its ancestor to wrap an interface around the various components of the system; the metadata, entities and the units.

The object is considered {@link isInited()} when the metadata, entities and units databases are set.

Summary

Methods
Properties
Constants
Metadata()
Entities()
Units()
Graph()
isConnected()
openConnections()
closeConnections()
resetOntology()
resetUnits()
resetEntities()
loadTagCache()
copyRelationships()
loadISOStandards()
loadWBIStandards()
loadIUCNStandards()
loadNatServeStandards()
loadFAOStandards()
loadEECStandards()
loadGENSStandards()
loadGLOBCOVStandards()
loadHWSDStandards()
loadMCPDStandards()
loadFCUStandards()
loadCWRStandards()
loadABDHStandards()
loadLRStandards()
loadQTLStandards()
loadStandards()
loadCollections()
loadFAOInstitutes()
loadXMLFile()
collectStructureOffsets()
resolveCollection()
ResolveCollectionClass()
__construct()
cache()
setTag()
setTagsByIterator()
getSerial()
getObject()
getTypes()
getTagOffsets()
delTag()
dictionaryFilled()
dictionaryFlush()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
arrayKeys()
arrayValues()
Object2Array()
No public properties found
No constants found
loadXMLMetadata()
loadXMLUsers()
loadXMLUnits()
loadXMLRootBlock()
loadXMLTag()
loadXMLTerm()
loadXMLNode()
loadXMLEdge()
loadXMLUnit()
parseXMLElement()
parseXMLItem()
traverseStructureOffsets()
isReady()
setEntry()
getEntry()
delEntry()
preOffsetExists()
preOffsetGet()
preOffsetSet()
postOffsetSet()
preOffsetUnset()
postOffsetUnset()
$mMetadata
$mEntities
$mUnits
$mGraph
$mPid
$mCache
N/A
No private methods found
No private properties found
N/A

Properties

$mMetadata

$mMetadata : \OntologyWrapper\DatabaseObject

Metadata.

This data member holds the metadata {@link DatabaseObject} derived instance.

Type

\OntologyWrapper\DatabaseObject

$mEntities

$mEntities : \OntologyWrapper\DatabaseObject

Entities.

This data member holds the entities {@link DatabaseObject} derived instance.

Type

\OntologyWrapper\DatabaseObject

$mUnits

$mUnits : \OntologyWrapper\DatabaseObject

Units.

This data member holds the units {@link DatabaseObject} derived instance.

Type

\OntologyWrapper\DatabaseObject

$mGraph

$mGraph : \OntologyWrapper\DatabaseGraph

Graph.

This data member holds the graph {@link DatabaseGraph} derived instance.

Type

\OntologyWrapper\DatabaseGraph

$mPid

$mPid : string

Dictionary identifier.

This data member holds the dictionary identifier.

Type

string

$mCache

$mCache : \OntologyWrapper\Memcached

Cache connection.

This data member holds the dictionary cache connection.

Type

\OntologyWrapper\Memcached

Methods

Metadata()

Metadata(mixed $theValue, boolean $getOld, boolean $doOpen) : mixed

Manage metadata database

This method can be used to manage the metadata database, it accepts a parameter which represents either the metadata database instance or the requested operation, depending on its value:

  • NULL: Return the current value.
  • FALSE: Delete the current value.
  • {@link DatabaseObject}: Set the value with the provided parameter.

The second parameter is a boolean which if TRUE will return the old value when replacing or resetting; if FALSE, it will return the current value.

Parameters

mixed $theValue

Metadata database or operation.

boolean $getOld

TRUE get old value.

boolean $doOpen

TRUE open connection.

Throws

\OntologyWrapper\Exception

Returns

mixed —

New or old metadata database.

Entities()

Entities(mixed $theValue, boolean $getOld, boolean $doOpen) : mixed

Manage entities database

This method can be used to manage the entities database, it accepts a parameter which represents either the entities database instance or the requested operation, depending on its value:

  • NULL: Return the current value.
  • FALSE: Delete the current value.
  • {@link DatabaseObject}: Set the value with the provided parameter.

The second parameter is a boolean which if TRUE will return the old value when replacing or resetting; if FALSE, it will return the current value.

Parameters

mixed $theValue

Entities database or operation.

boolean $getOld

TRUE get old value.

boolean $doOpen

TRUE open connection.

Throws

\OntologyWrapper\Exception

Returns

mixed —

New or old entities database.

Units()

Units(mixed $theValue, boolean $getOld, boolean $doOpen) : mixed

Manage units database

This method can be used to manage the units database, it accepts a parameter which represents either the units database instance or the requested operation, depending on its value:

  • NULL: Return the current value.
  • FALSE: Delete the current value.
  • {@link DatabaseObject}: Set the value with the provided parameter.

The second parameter is a boolean which if TRUE will return the old value when replacing or resetting; if FALSE, it will return the current value.

Parameters

mixed $theValue

Units database or operation.

boolean $getOld

TRUE get old value.

boolean $doOpen

TRUE open connection.

Throws

\OntologyWrapper\Exception

Returns

mixed —

New or old units database.

Graph()

Graph(mixed $theValue, boolean $getOld, boolean $doOpen) : mixed

Manage graph database

This method can be used to manage the graph database, it accepts a parameter which represents either the graph database instance or the requested operation, depending on its value:

  • NULL: Return the current value.
  • FALSE: Delete the current value.
  • {@link DatabaseGraph}: Set the value with the provided parameter.

The second parameter is a boolean which if TRUE will return the old value when replacing or resetting; if FALSE, it will return the current value.

Parameters

mixed $theValue

Hraph database or operation.

boolean $getOld

TRUE get old value.

boolean $doOpen

TRUE open connection.

Throws

\OntologyWrapper\Exception

Returns

mixed —

New or old graph database.

isConnected()

isConnected() : boolean

Check if object is connected

This method returns a boolean flag indicating whether the object is connected or not. In practice this is true if the metadata, entities and units connections are open.

Returns

boolean —

TRUE is open.

openConnections()

openConnections()

Open connection

This method can be used to connect the object's databases.

Throws

\OntologyWrapper\Exception

closeConnections()

closeConnections()

Close connection

This method can be used to close the object's database connections.

resetOntology()

resetOntology(boolean $doLog, boolean $doDrop)

Reset databases

This method can be used to reset the ontology, it will erase the current ontology, and re-load it from the files in the standards directory.

When you erase the ontology, you might lose tags and terms which are necessary for the entities and the data databases: be aware that by doing so you might render these databases useless.

Parameters

boolean $doLog

Log operations.

boolean $doDrop

Drop collections.

Throws

\OntologyWrapper\Exception

resetUnits()

resetUnits(boolean $doLog, boolean $doDrop) : array

Reset units

This method can be used to reset the units database, it will erase the current units collection and load the FAO insatitutes.

The method will take care of setting the necessary indexes.

Parameters

boolean $doLog

Log operations.

boolean $doDrop

Drop collections.

Throws

\OntologyWrapper\Exception

Returns

array —

Statistics.

resetEntities()

resetEntities(boolean $doLog, boolean $doDrop) : array

Reset entities

This method can be used to reset the entities database, it will erase the current entities collection and load the FAO insatitutes.

The method will take care of setting the necessary indexes.

Parameters

boolean $doLog

Log operations.

boolean $doDrop

Drop collections.

Throws

\OntologyWrapper\Exception

Returns

array —

Statistics.

loadTagCache()

loadTagCache()

Reload tag cache

This method can be used to reset the tag cache.

The method will return TRUE if the object is connected and the operation was executed and FALSE if the object is not connected, or if the metadata is missing.

Note that although the operation might have been executed, this doesn't mean that the dictionary was loaded: this depends on the contents of the metadata database.

Throws

\OntologyWrapper\Exception

copyRelationships()

copyRelationships(mixed $theSrcNode, mixed $theSrcPredicate, string $theSrcDirection, int $theDstNode, string $theDstPredicate, string $theDstDirection)

<h4>Copy relationships from one node to another</h4>

This method can be used to copy all the relationships of a given predicate affecting one node to another node. The method will select the source node relationships of the provided predicate and direction, it will duplicate these relationships, it will substitute the source node with the destination node and replace the source predicate with the destination predicate.

The method expects these parameters:

  • $theSrcNode: Source node or list of node native identifiers. This represents the original relationships vertex.
  • $theSrcPredicate: Source relationship predicate term native identifier or list.
  • $theSrcDirection: Source relationship direction:
    • {@link kTYPE_RELATIONSHIP_IN}: All relationships pointing to the source node.
    • {@link kTYPE_RELATIONSHIP_OUT}: All relationships originating from the source node.
    • {@link kTYPE_RELATIONSHIP_ALL}: Both of the above.
  • $theDstNode: Destination node native identifier.
  • $theDstPredicate: Destination relationship predicate term native identifier.
  • $theDstDirection: Destination relationship direction:
    • {@link kTYPE_RELATIONSHIP_IN}: All relationships will point to the destination node.
    • {@link kTYPE_RELATIONSHIP_OUT}: All relationships will originate from the destination node.
    • {@link kTYPE_RELATIONSHIP_ALL}: The vertex holding the source node will be replaced with the destination node.
    The created {@link Edge} objects will be set exclusively with the predicate and vertices. If there will be resulting duplicate edges, the method will raise an exception.

    Parameters

    mixed $theSrcNode

    Source relationship vertex(s).

    mixed $theSrcPredicate

    Source predicate(s).

    string $theSrcDirection

    Source relationship direction.

    int $theDstNode

    Destination relationship vertex.

    string $theDstPredicate

    Destination predicate.

    string $theDstDirection

    Destination relationship direction.

    Throws

    \OntologyWrapper\Exception
  • loadISOStandards()

    loadISOStandards(boolean $doLog)

    Load ISO standards

    This method can be used to load the ISO standards.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    loadWBIStandards()

    loadWBIStandards(boolean $doLog)

    Load WBI standards

    This method can be used to load the WBI standards.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    loadIUCNStandards()

    loadIUCNStandards(boolean $doLog) : array

    Load IUCN standards

    This method can be used to load the IUCN standards in the metadata database, it will load the standards XML files.

    Note that this method expects other standards to have been loaded.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    Statistics.

    loadNatServeStandards()

    loadNatServeStandards(boolean $doLog) : array

    Load NatureServe standards

    This method can be used to load the NatureServe standards in the metadata database, it will load the standards XML files.

    Note that this method expects other standards to have been loaded.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    Statistics.

    loadFAOStandards()

    loadFAOStandards(boolean $doLog) : array

    Load FAO standards

    This method can be used to load the FAO standards in the metadata database, it will load the standards XML files.

    Note that this method expects other standards to have been loaded.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    Statistics.

    loadEECStandards()

    loadEECStandards(boolean $doLog) : array

    Load EEC standards

    This method can be used to load the EEC standards in the metadata database, it will load the standards XML files.

    Note that this method expects other standards to have been loaded.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    Statistics.

    loadGENSStandards()

    loadGENSStandards(boolean $doLog) : array

    Load GENS standards

    This method can be used to load the GENS standards in the metadata database, it will load the standards XML files.

    Note that this method expects other standards to have been loaded.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    Statistics.

    loadGLOBCOVStandards()

    loadGLOBCOVStandards(boolean $doLog) : array

    Load GLOBCOV standards

    This method can be used to load the GLOBCOV standards in the metadata database, it will load the standards XML files.

    Note that this method expects other standards to have been loaded.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    Statistics.

    loadHWSDStandards()

    loadHWSDStandards(boolean $doLog) : array

    Load HWSD standards

    This method can be used to load the HWSD standards in the metadata database, it will load the standards XML files.

    Note that this method expects other standards to have been loaded.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    Statistics.

    loadMCPDStandards()

    loadMCPDStandards(boolean $doLog)

    Load Multicrop Passport Descriptors standards

    This method can be used to load the MCPD standards.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    loadFCUStandards()

    loadFCUStandards(boolean $doLog)

    Load Forest Fene Conservation Unit standards

    This method can be used to load the FCU standards.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    loadCWRStandards()

    loadCWRStandards(boolean $doLog)

    Load crop wild relative standards

    This method can be used to load the CWR standards.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    loadABDHStandards()

    loadABDHStandards(boolean $doLog)

    Load agro bio-diversity household assessment standards

    This method can be used to load the ABDH standards.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    loadLRStandards()

    loadLRStandards(boolean $doLog)

    Load landrace standards

    This method can be used to load the LR standards.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    loadQTLStandards()

    loadQTLStandards(boolean $doLog)

    Load QTL standards

    This method can be used to load the QTL standards.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    loadStandards()

    loadStandards(boolean $doLog) : array

    Load standards

    This method can be used to load the standards in the metadata database, it will load the standards XML files.

    Note that this method expects other standards to have been loaded.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    Statistics.

    loadCollections()

    loadCollections(boolean $doLog) : array

    Load collections

    This method can be used to load the standards collection elements in the metadata database, it will load the collection XML files.

    Note that this method expects other standards to have been loaded, so it must be called as the last element.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    Statistics.

    loadFAOInstitutes()

    loadFAOInstitutes(boolean $doLog)

    Load default entities

    This method can be used to reset and load the default entities.

    Parameters

    boolean $doLog

    Log operations.

    Throws

    \OntologyWrapper\Exception

    loadXMLFile()

    loadXMLFile(string $theFile)

    Load an XML file

    This method can be used to load an XML file containing metadata, entities or units. The method expects an XML file as the paraneter, any error during the load process will raise an exception.

    Parameters

    string $theFile

    XML file path.

    Throws

    \OntologyWrapper\Exception

    collectStructureOffsets()

    collectStructureOffsets(mixed $theNode, int $theType) : array

    Get structure offsets.

    This method will return the list of offsets belonging to the provided structure or schema node.

    The method expects the following parameters:

    • $theNode: The structure or schema node native or persistent identifier.
    • $theType: This parameter indicates the requested output format:
      • 0: The returned array will hold the flattened list of all leaf offsets.
      • 1: The returned array will hold the list of tag sequence numbers structured as the schema, holding the tag references in the key.
      • 2: The returned array will hold the list of tag native identifiers structured as the schema, holding the tag references in the key.
      If omitted, the method will use the 0 value by default.

    If the node cannot be resolved, the method will raise an exception.

    All schema and structure elements present as sub-elements will be resolved.

    Parameters

    mixed $theNode

    Node reference.

    int $theType

    Result type.

    Throws

    \OntologyWrapper\Exception

    Returns

    array —

    List of offsets belonging to the structure.

    resolveCollection()

    resolveCollection(string $theCollection) : \OntologyWrapper\CollectionObject

    Resolve collection

    Given a collection name, this method will return a collection reference.

    Parameters

    string $theCollection

    Collection name.

    Throws

    \OntologyWrapper\Exception

    Returns

    \OntologyWrapper\CollectionObject

    The collection reference.

    ResolveCollectionClass()

    ResolveCollectionClass(string $theCollection) : string

    Resolve collection class

    Given a collection name, this method will return the base class name.

    Parameters

    string $theCollection

    Collection name.

    Throws

    \OntologyWrapper\Exception

    Returns

    string —

    The base class name.

    __construct()

    __construct(mixed $theIdentifier, array $theServers)

    Instantiate class.

    The constructor accepts two parameters:

    • $theIdentifier: This string parameter represents the {@limk Memcached} persistent identifier provided to its constructor, the parameter is required, since the cache should be active across sessions.
    • $theServers: This array parameter represents the list of servers that serve the cache, it is equivalent to the parameter of the {@link Memcached::addServers()} method, it is a list of elements comprised by three parameters:
      • Host: The server host.
      • Port: The server port.
      • Weight: The weight of the server relative to the total weight of all the servers in the pool.
      This parameter may be omitted if the cache has been instantiate elsewhere with the same persistent identifier.

    The constructor will first instantiate the {@link Memcached} object, then it will check if the connection resource has already a list of servers associated, if that is the case we assume the cache is already initialised; if that is not the case, we will add the servers provided in the second parameter.

    Parameters

    mixed $theIdentifier

    Persistent identifier.

    array $theServers

    List of servers.

    Throws

    \OntologyWrapper\Exception

    cache()

    cache()

    Return cache

    This method will return the current cache.

    setTag()

    setTag(mixed $theTag, integer $theLife)

    Set tag

    This method should commit the provided tag, both as an identifier and as an object.

    The method expects the following parameters:

    • $theTag: Tag object, if derived from an array object, it will be converted into an array, before it is set into the dictionary.
    • $theLife: Lifetime of the dictionary entry in seconds, 0 means permanent.

    Parameters

    mixed $theTag

    Tag object.

    integer $theLife

    Element lifetime.

    setTagsByIterator()

    setTagsByIterator(\OntologyWrapper\ObjectIterator $theTags, integer $theLife)

    Set tags by iterator

    This method should commit the provided tags, both as identifiers and as an objects.

    The method expects the following parameters:

    • $theTags: Tags iterator, typically from a database query, the iterator must have as key the tag native identifier
    • $theLife: Lifetime of the dictionary entry in seconds, 0 means permanent.

    Parameters

    \OntologyWrapper\ObjectIterator $theTags

    Tag iterator.

    integer $theLife

    Elements lifetime.

    getSerial()

    getSerial(string $theIdentifier, boolean $doAssert) : integer

    Get serial number

    This method should return the serial identifier corresponding to the provided persistent identifier.

    The second parameter represents a boolean flag: if TRUE and the provided identifier is not matched, the method will raise an exception; if FALSE, the method will return NULL on a mismatch. By default this option is TRUE.

    Parameters

    string $theIdentifier

    Persistent identifier.

    boolean $doAssert

    If TRUE assert match.

    Returns

    integer —

    Sequence number or NULL. +

    • @throws Exception

    getObject()

    getObject(string $theIdentifier, boolean $doAssert) : mixed

    Get object

    This method should return the tag object corresponding to the provided serial identifier.

    The second parameter represents a boolean flag: if TRUE and the provided identifier is not matched, the method will raise an exception; if FALSE, the method will return NULL on a mismatch. By default this option is TRUE.

    Parameters

    string $theIdentifier

    Serial identifier.

    boolean $doAssert

    If TRUE assert match.

    Throws

    \OntologyWrapper\Exception

    Returns

    mixed —

    Tag object array or NULL.

    getTypes()

    getTypes(string $theIdentifier, string $theType, array $theKind, mixed $theMin, mixed $theMax, string $thePattern, boolean $doAssert) : boolean

    Get tag types

    This method should return the tag data type, kind, range and pattern in the provided reference parameters, the method expects the identifier to be a tag sequence number, it will be cast to an integer.

    The last parameter represents a boolean flag: if TRUE and the provided identifier is not matched, the method will raise an exception; if FALSE, the method will set the data type to NULL, the data kind to an empty array, the range to an empty array and the pattern to NULL.

    Parameters

    string $theIdentifier

    Serial identifier.

    string $theType

    Receives data type.

    array $theKind

    Receives data kind.

    mixed $theMin

    Receives minimum data range.

    mixed $theMax

    Receives maximum data range.

    string $thePattern

    Receives data pattern.

    boolean $doAssert

    If TRUE assert match.

    Throws

    \OntologyWrapper\Exception

    Returns

    boolean —

    TRUE means the tag was found.

    getTagOffsets()

    getTagOffsets() : array

    Get dictionary tag offsets

    This method should return the list of tag sequence numbers corresponding to the tag properties that will be stored in the dictionary.

    By default we store:

    • {@link kTAG_NID}: Native identifier.
    • {@link kTAG_ID_HASH}: Sequence number.
    • {@link kTAG_LABEL}: Label.
    • {@link kTAG_DESCRIPTION}: Description.
    • {@link kTAG_DATA_TYPE}: Data type.
    • {@link kTAG_DATA_KIND}: Data kind.
    • {@link kTAG_TAG_STRUCT}: Container structure.
    • {@link kTAG_TAG_STRUCT_IDX}: Container structure list index.
    • {@link kTAG_MIN_RANGE}: Range minimum bound.
    • {@link kTAG_MAX_RANGE}: Range maximum bound.
    • {@link kTAG_PATTERN}: Value pattern.

    Other properties are either not needed for this purpose, or they are modified frequently, making reading from the database slower, but safer.

    The method will return an array suited to be used for querying with a field selection, the tag offsets are the key and a boolean is the value.

    Returns

    array —

    List of tag offsets.

    delTag()

    delTag(mixed $theIdentifier, boolean $doAssert) : boolean

    Delete tag

    This method should delete a tag entry corresponding to the provided persistent or serial identifier. This means that the method will delete both the identifier and the object entries.

    Note that an integer identifier is assumed to be the serial identifier and anything else will be cast to string and assumed to be the persistent identifier.

    The second parameter rperesents a boolean flag: if TRUE and the provided identifier is not matched, the method will raise an exception. By default this option is FALSE.

    Parameters

    mixed $theIdentifier

    Persistent or serial identifier.

    boolean $doAssert

    If TRUE assert match.

    Returns

    boolean —

    TRUE deleted, FALSE not found.

    dictionaryFilled()

    dictionaryFilled() : boolean

    Check if dictionary is filled

    This method will return TRUE if the current dictionary can resolve the kTAG_ROLES identifier.

    We assume that if the dictionary can resolve this identifier, it means it must be filled.

    We check whether the {@link kTAG_ROLES} serial resolved to the correct tag object.

    Returns

    boolean —

    TRUE means filled.

    dictionaryFlush()

    dictionaryFlush(integer $theDelay)

    Flush dictionary elements

    This method should invalidate all the elements of the dictionary.

    The method expects one parameter that corresponds to the delay in seconds before the elements will be invalidated.

    Parameters

    integer $theDelay

    Delay before flush.

    offsetExists()

    offsetExists(mixed $theOffset) : boolean

    Check if an offset exists

    We overload this method to call the preflight method: if it returns NULL we call the parent method; if not, we return the received value.

    Parameters

    mixed $theOffset

    Offset.

    Returns

    boolean —

    TRUE the offset exists.

    offsetGet()

    offsetGet(mixed $theOffset) : mixed

    Return a value at a given offset

    We overload this method to call the preflight method: if it returns NULL we call the parent method; if not, we return the received value.

    We also overload this method to handle unmatched offsets: we prevent warnings from being issued and return NULL.

    Parameters

    mixed $theOffset

    Offset.

    Returns

    mixed —

    Offset value or NULL.

    offsetSet()

    offsetSet(string $theOffset, mixed $theValue)

    Set a value at a given offset

    We overload this method to call the preflight and postflight methods: if the preflight method returns NULL we call the parent method; if not, we stop.

    We also overload this method to handle NULL values: in that case we delete the offset.

    Parameters

    string $theOffset

    Offset.

    mixed $theValue

    Value to set at offset.

    offsetUnset()

    offsetUnset(string $theOffset)

    Reset a value at a given offset

    We overload this method to call the preflight and postflight methods: if the preflight method returns NULL we call the parent method; if not, we stop.

    We also overload this method to prevent warnings on unmatched offsets.

    Parameters

    string $theOffset

    Offset.

    arrayKeys()

    arrayKeys() : array

    Return object's offsets

    This method has the same function as the PHP function {@link array_keys()}, it will return all the object's offset keys as an array.

    Returns

    array —

    List of object offsets.

    arrayValues()

    arrayValues() : array

    Return object's offset values

    This method has the same function as the PHP function {@link array_values()}, it will return all the object's offset values as an array.

    Returns

    array —

    List of object offset values.

    Object2Array()

    Object2Array(\OntologyWrapper\reference $theSource, \OntologyWrapper\reference $theDestination)

    <h4>Convert object to array</h4>

    This method can be used to obtain an array of arrays from a nested structure.

    The method expects as the first parameter a reference to an {@link ArrayObject} or to an array, it will convert the provided parameter to an array and traverse it, converting recursively any {@link ArrayObject} instance into an array.

    The method accepts the following parameters:

    • $theSource: Source structure reference (read-only).
    • $theDestination: Destination array reference.

    Parameters

    \OntologyWrapper\reference $theSource

    Reference to the source structure.

    \OntologyWrapper\reference $theDestination

    Reference to the destination array.

    Throws

    \OntologyWrapper\Exception

    loadXMLMetadata()

    loadXMLMetadata(\OntologyWrapper\SimpleXMLElement $theXML)

    Parse and load metadata

    This method will parse and load the provided metadata XML structure.

    It is assumed that the object has its comnnections open and that the provided XML structure has the correct root element.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theXML

    Metadata XML.

    loadXMLUsers()

    loadXMLUsers(\OntologyWrapper\SimpleXMLElement $theXML)

    Parse and load entities

    This method will parse and load the provided entities XML structure.

    It is assumed that the object has its comnnections open and that the provided XML structure has the correct root element.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theXML

    Entities XML.

    loadXMLUnits()

    loadXMLUnits(\OntologyWrapper\SimpleXMLElement $theXML)

    Parse and load entities

    This method will parse and load the provided units XML structure.

    It is assumed that the object has its comnnections open and that the provided XML structure has the correct root element.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theXML

    Units XML.

    loadXMLRootBlock()

    loadXMLRootBlock(\OntologyWrapper\SimpleXMLElement $theXML)

    Parse and load root block

    This method will parse and load the provided rot transaction block.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theXML

    Root transaction block.

    loadXMLTag()

    loadXMLTag(\OntologyWrapper\SimpleXMLElement $theXML, \OntologyWrapper\reference $theCache)

    Parse and load XML tag

    This method will parse and load the provided tag XML structure.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theXML

    Tag XML structure.

    \OntologyWrapper\reference $theCache

    Objects cache.

    Throws

    \OntologyWrapper\Exception

    loadXMLTerm()

    loadXMLTerm(\OntologyWrapper\SimpleXMLElement $theXML, \OntologyWrapper\reference $theCache)

    Parse and load XML term

    This method will parse and load the provided term XML structure.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theXML

    Term XML structure.

    \OntologyWrapper\reference $theCache

    Objects cache.

    Throws

    \OntologyWrapper\Exception

    loadXMLNode()

    loadXMLNode(\OntologyWrapper\SimpleXMLElement $theXML, \OntologyWrapper\reference $theCache)

    Parse and load XML node

    This method will parse and load the provided node XML structure.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theXML

    Node XML structure.

    \OntologyWrapper\reference $theCache

    Objects cache.

    Throws

    \OntologyWrapper\Exception

    loadXMLEdge()

    loadXMLEdge(\OntologyWrapper\SimpleXMLElement $theXML, \OntologyWrapper\reference $theCache)

    Parse and load XML edge

    This method will parse and load the provided edge XML structure.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theXML

    Edge XML structure.

    \OntologyWrapper\reference $theCache

    Objects cache.

    Throws

    \OntologyWrapper\Exception

    loadXMLUnit()

    loadXMLUnit(\OntologyWrapper\SimpleXMLElement $theXML)

    Parse and load XML unit

    This method will parse and load the provided unit XML structure.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theXML

    Unit XML structure.

    Throws

    \OntologyWrapper\Exception

    parseXMLElement()

    parseXMLElement(\OntologyWrapper\SimpleXMLElement $theElement, \OntologyWrapper\PersistentObject $theObject)

    Parse and load XML element

    This method will parse and load the provided XML element, the provided element is supposed to be a root level offset of the object.

    The method expects two parameters:

    • $theElement: The XML element.
    • $theObject: The object to load.

    Parameters

    \OntologyWrapper\SimpleXMLElement $theElement

    XML element.

    \OntologyWrapper\PersistentObject $theObject

    The object to load.

    Throws

    \OntologyWrapper\Exception

    parseXMLItem()

    parseXMLItem(\OntologyWrapper\reference $theValue, \OntologyWrapper\SimpleXMLElement $theElement, \OntologyWrapper\PersistentObject $theObject, string $theNode)

    Parse and load XML element

    This method will parse and load the provided XML element and return the tag, the eventual array element key and the value in the provided references.

    This method is called recursively, it will first parse the attributes of the element determining the current tag, then it will traverse eventual embedded structures until a scalar value is found which will be fed to the {@link castXMLScalarValue()} method that will cast the value according to the most recent tag's data type.

    Parameters

    \OntologyWrapper\reference $theValue

    Receives value.

    \OntologyWrapper\SimpleXMLElement $theElement

    XML element.

    \OntologyWrapper\PersistentObject $theObject

    The object to load.

    string $theNode

    Node reference type.

    Throws

    \OntologyWrapper\Exception

    traverseStructureOffsets()

    traverseStructureOffsets(array $theOffsets, int $theNode, int $theType,  $theLevel)

    Traverse structure offsets.

    This method will traverse the relationships of the provided node, filling the provided array container with the list of matched offsets.

    The main duty of this method is to iterate all nodes pointing to the provided node via the {@link kPREDICATE_PROPERTY_OF} or {@link kPREDICATE_SUBCLASS_OF} predicates, loading the provided array container with the encountered tag offsets according to the provided type parameter, eventually recursing nested structures and schemas.

    The method expects the following parameters:

    • $theOffsets: This parameter will receive the matched offsets.
    • $theNode: The structure or schema node native identifier.
    • $theType: This parameter indicates the requested output format:
      • 0: Collects flattened list of leaf offsets.
      • 1: Collects structured list of tag sequence numbers.
      • 2: Collects structured list of tag native identifiers.
    • $theLevel: This parameter is initialised and handled by this method, it holds an array of elements holding the nested level tag sequence numbers, this array will only hold tags of type {@link kTYPE_STRUCT}.

    If the node cannot be resolved, the method will raise an exception.

    All schema and structure elements present as sub-elements will be resolved.

    Parameters

    array $theOffsets

    Receives offsets.

    int $theNode

    Node native identifier.

    int $theType

    Result type.

    $theLevel

    Throws

    \OntologyWrapper\Exception

    isReady()

    isReady() : boolean

    Check if object is ready

    This method returns a boolean flag indicating whether the object is ready to be connected, in practice, this is true if the object has the metadata, entities and units connections.

    Returns

    boolean —

    TRUE is ready.

    setEntry()

    setEntry(mixed $theKey, mixed $theValue, integer $theLife)

    Set a dictionary entry

    This method should commit a new entry in the dictionary, if it doesn't exist yet, or replace the matching entry if it already exists.

    The method expects the following parameters:

    • $theKey: Entry key.
    • $theValue: Entry value.
    • $theLife: Entry lifetime in seconds, 0 means permanent.

    If the operation fails the method should raise an exception.

    Parameters

    mixed $theKey

    Entry key.

    mixed $theValue

    Entry value.

    integer $theLife

    Entry lifetime.

    getEntry()

    getEntry(mixed $theKey) : mixed

    Get a dictionary entry

    This method should return the dictionary entry corresponding to the provided key; if the entry is not matched, the method should return NULL.

    If the operation fails the method should raise an exception.

    Parameters

    mixed $theKey

    Entry key.

    Returns

    mixed —

    Entry value or NULL.

    delEntry()

    delEntry(mixed $theKey) : boolean

    Get a dictionary entry

    This method should delete the dictionary entry corresponding to the provided key; if the entry was deleted, the method should return TRUE, if the entry was not found, the method should return FALSE.

    If the operation fails the method should raise an exception.

    Parameters

    mixed $theKey

    Entry key.

    Returns

    boolean —

    TRUE deleted, FALSE not matched.

    preOffsetExists()

    preOffsetExists(\OntologyWrapper\reference $theOffset) : mixed

    Handle offset before checking it

    This method can be used to manage the offset before passing it to the inherited {@link ArrayObject::OffsetExists()} method.

    The method provides the offset as a reference, if the method returns NULL it means that the offset must be passed to the inherited {@link ArrayObject::OffsetExists()}; if the method returns any other value, this will be returned and the inherited {@link ArrayObject::OffsetExists()} will be skipped.

    In this class we do nothing.

    Parameters

    \OntologyWrapper\reference $theOffset

    Offset reference.

    Returns

    mixed —

    NULL check offset, other, return.

    preOffsetGet()

    preOffsetGet(\OntologyWrapper\reference $theOffset) : mixed

    Handle offset before getting it

    This method can be used to manage the offset before passing it to the inherited {@link ArrayObject::OffsetGet()} method.

    The method provides the offset as a reference, if the method returns NULL it means that the offset must be passed to the inherited {@link ArrayObject::OffsetGet()}; if the method returns any other value, this must be returned and the inherited {@link ArrayObject::OffsetGet()} skipped.

    In this class we do nothing.

    Parameters

    \OntologyWrapper\reference $theOffset

    Offset reference.

    Returns

    mixed —

    NULL get offset value, other, return.

    preOffsetSet()

    preOffsetSet(\OntologyWrapper\reference $theOffset, \OntologyWrapper\reference $theValue) : mixed

    Handle offset and value before setting it

    This method can be used to manage the offset before passing it to the inherited {@link ArrayObject::OffsetSet()} method.

    The method provides the offset and value as references, if the method returns NULL it means that the offset and value must be passed to the inherited {@link ArrayObject::OffsetSet()}; if the method returns any other value, this means that the inherited {@link ArrayObject::OffsetSet()} should be skipped.

    In this class we do nothing.

    Parameters

    \OntologyWrapper\reference $theOffset

    Offset reference.

    \OntologyWrapper\reference $theValue

    Offset value reference.

    Returns

    mixed —

    NULL set offset value, other, return.

    postOffsetSet()

    postOffsetSet(\OntologyWrapper\reference $theOffset, \OntologyWrapper\reference $theValue)

    Handle offset and value after setting it

    This method can be used to manage the object after calling the {@link ArrayObject::OffsetSet()} method.

    In this class we do nothing.

    Parameters

    \OntologyWrapper\reference $theOffset

    Offset reference.

    \OntologyWrapper\reference $theValue

    Offset value reference.

    preOffsetUnset()

    preOffsetUnset(\OntologyWrapper\reference $theOffset) : mixed

    Handle offset and value before deleting it

    This method can be used to manage the offset before passing it to the inherited {@link ArrayObject::OffsetUnset()} method.

    The method provides the offset as reference, if the method returns NULL it means that the offset and value must be passed to the inherited {@link ArrayObject::OffsetUnset()}; if the method returns any other value, this means that the inherited {@link ArrayObject::OffsetUnset()} should be skipped.

    In this class we do nothing.

    Parameters

    \OntologyWrapper\reference $theOffset

    Offset reference.

    Returns

    mixed —

    NULL delete offset value, other, return.

    postOffsetUnset()

    postOffsetUnset(\OntologyWrapper\reference $theOffset)

    Handle offset after deleting it

    This method can be used to manage the object after calling the {@link ArrayObject::OffsetUnset()} method.

    In this class we do nothing.

    Parameters

    \OntologyWrapper\reference $theOffset

    Offset reference.