\OntologyWrapperService

Service object

A service is an object that can be used to implement a set of web services, the current class implements the base functionality, concrete derived classes will extend this class to implement specific behaviours.

Summary

Methods
Properties
Constants
__construct()
handleRequest()
GetStatisticsList()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
arrayKeys()
arrayValues()
Object2Array()
No public properties found
No constants found
parseRequest()
parseOperation()
parseLanguage()
parseParameters()
parseParameter()
parseStringMatchOperator()
validateRequest()
validateListStats()
validateMatchLabelStrings()
validateMatchTagByIdentifier()
validateGetTagEnumerations()
validateGetNodeEnumerations()
validateGetNodeStruct()
validateMatchUnits()
validateGetUnit()
validateGetUser()
validateAddUser()
validateSearchCriteria()
validateStringMatchOperator()
validateRangeMatchOperator()
validateCollection()
validateRecurseFlag()
validateGroup()
validateShape()
executeRequest()
executePing()
executeListParameterConstants()
executeListParameterOperators()
executeListReferenceCountParameters()
executeListStats()
executeMatchTagLabels()
executeMatchTermLabels()
executeMatchTagByLabel()
executeMatchTagByIdentifier()
executeMatchTermByLabel()
executeGetTagEnumerations()
executeGetNodeEnumerations()
executeGetNodeStructure()
executeMatchUnits()
executeGetUnit()
executeGetUser()
executeAddUser()
executeMatchLabelStrings()
executeMatchLabelObjects()
executeMatchLabelStringsQuery()
executeMatchLabelStringsResults()
executeMatchLabelObjectsResults()
executeLoadEnumerations()
executeLoadEnumeration()
executeGroupUnits()
executeTableUnits()
executeFormattedUnits()
executeMarkerUnits()
executeClusterUnits()
executeUnitStats()
executeUnitStat1()
executeUnitStat2()
executeUnitStat3()
executeUnitStat4()
executeUnitStat5()
executeUnitStat6()
executeUnitStat7()
executeSerialiseResults()
executeSerialiseSummaryTags()
handleException()
stringMatchPattern()
rangeMatchPattern()
shapeMatchPattern()
resolveFilter()
getRefCountTag()
buildCriteria()
traverseStructure()
traverseEdges()
loadNodeElementInfo()
getStatistics()
setStatisticsCriteria()
preOffsetExists()
preOffsetGet()
preOffsetSet()
postOffsetSet()
preOffsetUnset()
postOffsetUnset()
$mWrapper
$mResponse
$mFilter
$mRootProcessed
N/A
No private methods found
No private properties found
N/A

Properties

$mWrapper

$mWrapper : \OntologyWrapper\Wrapper

Wrapper.

This data member holds the data wrapper.

Type

\OntologyWrapper\Wrapper

$mResponse

$mResponse : array

Response.

This data member holds the service response.

Type

array

$mFilter

$mFilter : array

Filter.

This data member holds the service filter.

Type

array

$mRootProcessed

$mRootProcessed : boolean

Root.

This data member holds a flag indicating whether the root element of a structure was processed.

Type

boolean

Methods

__construct()

__construct(\OntologyWrapper\Wrapper $theWrapper)

Instantiate class.

The constructor accepts a single parameter which is a {@link Wrapper} instance.

The method will perform the following steps:

  • Init response status: The response status state will be set to {@link kAPI_STATE_IDLE}.
  • Store wrapper: The provided wrapper will be stored in the object.
  • Parse request: The {@link parseRequest()} method will parse and load the provided parameters.
  • Validate request: The {@link validateRequest()} method will validate the provided parameters.
  • Set response status: The response status state will be set to {@link kAPI_STATE_OK}.

Parameters

\OntologyWrapper\Wrapper $theWrapper

Data wrapper.

Throws

\OntologyWrapper\Exception

handleRequest()

handleRequest()

Handle request.

This method will handle the request and return the result.

The method will call the protected {@link executeRequest()} method which should perform what the current service was requested to do, it will then send a header signalling JSON content and send the json-encoded result.

Note that this method will exit the script, which means that you cannot do anything after this method; this also means that the caller does not need to set an {@link exit()} command.

The method will initialise the

GetStatisticsList()

GetStatisticsList(string $theDomain) : array

Get statistics

This method will return the statistics list related to the provided domain, the result is an array whose elements are structured as follows:

  • {@link kAPI_PARAM_STAT}: The statistics identifier.
  • {@link kAPI_PARAM_RESPONSE_FRMT_NAME}: The statistics title.
  • {@link kAPI_PARAM_RESPONSE_FRMT_INFO}: The statistics description.

If the domain has no associated statistics, the method will return an empty array.

Parameters

string $theDomain

Statistics domain.

Returns

array —

List of statistics.

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

parseRequest()

parseRequest()

Parse request.

This method will parse the request provided in the $_REQUEST global parameter, it will place all recognised parameters in the object's array, ignoring any unknown option.

The method takes advantage of the following protected methods:

  • {@link parseOperation()}: This method is responsible of parsing the operation.
  • {@link parseLanguage()}: This method is responsible of parsing the language.
  • {@link parseParameters()}: This method is responsible of parsing the additional parameters.

The method will raise an exception if the operation is missing.

Throws

\OntologyWrapper\Exception

parseOperation()

parseOperation()

Parse operation.

The duty of this method is to parse the provided operation and set it into the current object.

In derived classes you should parse your custom operations or call the parent method, in this class we only parse the following operations:

  • {@link kAPI_OP_PING}: Ping.
  • {@link kAPI_OP_LIST_CONSTANTS}: List parameter constants.
  • {@link kAPI_OP_LIST_OPERATORS}: List operator parameters.
  • {@link kAPI_OP_LIST_REF_COUNTS}: List reference count parameters.
  • {@link kAPI_OP_LIST_STATS}: List statistics by domain.
  • {@link kAPI_OP_MATCH_TAG_LABELS}: Match tag labels.
  • {@link kAPI_OP_MATCH_TAG_BY_IDENTIFIER}: Match tag by identifier.
  • {@link kAPI_OP_MATCH_TAG_SUMMARY_LABELS}: Match summary tag labels.
  • {@link kAPI_OP_MATCH_TERM_LABELS}: Match term labels.
  • {@link kAPI_OP_MATCH_TAG_BY_LABEL}: Match tag by labels.
  • {@link kAPI_OP_MATCH_SUMMARY_TAG_BY_LABEL}: Match summary tag by label.
  • {@link kAPI_OP_MATCH_TERM_BY_LABEL}: Match term by labels.
  • {@link kAPI_OP_GET_TAG_ENUMERATIONS}: Get tag enumerations.
  • {@link kAPI_OP_GET_NODE_ENUMERATIONS}: Get node enumerations.
  • {@link kAPI_OP_GET_NODE_FORM}: Get node form.
  • {@link kAPI_OP_GET_NODE_STRUCT}: Get node structure.
  • {@link kAPI_OP_MATCH_UNITS}: Match domains.
  • {@link kAPI_OP_ADD_USER}: Add user.
  • {@link kAPI_OP_GET_USER}: Get user.

If the operation is not recognised, the method will raise an exception.

Throws

\OntologyWrapper\Exception

parseLanguage()

parseLanguage()

Parse language.

The duty of this method is to parse the provided language parameter, if the parameter was not sent, the method will set the default language, {@link kSTANDARDS_LANGUAGE}.

parseParameters()

parseParameters()

Parse parameters.

The duty of this method is to parse the additional parameters provided in the {@link kAPI_REQUEST_PARAMETERS} argument of the service.

Each parameter will be fed to the protected {@link parseParameter()} method which derived classes can overload to handle custom values.

Throws

\OntologyWrapper\Exception

parseParameter()

parseParameter(string $theKey, mixed $theValue)

Parse parameter.

The duty of this method is to parse the provided single parameter, the method expects the parameter key and value.

Both the key and the value are provided as references, this may allow derived classes to transform parameters.

Derived classes should handle their custom parameters or call the parent method, any parameter which is not handled will be ignored.

Parameters

string $theKey

Parameter key.

mixed $theValue

Parameter value.

parseStringMatchOperator()

parseStringMatchOperator(mixed $theValue)

Parse string match operator.

This method will parse the provided string match operator converting the provided value to an array using the comma as a separator.

If the resiulting array is empty, the method will set by default the operator to "contains case and accent insensitive".

Parameters

mixed $theValue

Parameter value.

validateRequest()

validateRequest()

Validate request.

This method will be called once all parameters have been parsed and set in the object, its duty is to validate the request; this activity involves ensuring all required parameters are there and perform eventual other modifications.

In this class we check the following operations:

  • {@link kAPI_OP_PING}: Ping.
  • {@link kAPI_OP_LIST_CONSTANTS}: List parameter constants.
  • {@link kAPI_OP_LIST_OPERATORS}: List operator parameters.
  • {@link kAPI_OP_LIST_REF_COUNTS}: List reference count parameters.
  • {@link kAPI_OP_LIST_STATS}: List statistics by domain.
  • {@link kAPI_OP_MATCH_TAG_LABELS}: Match tag labels.
  • {@link kAPI_OP_MATCH_TAG_BY_IDENTIFIER}: Match tag by identifier.
  • {@link kAPI_OP_MATCH_TAG_SUMMARY_LABELS}: Match summary tag labels.
  • {@link kAPI_OP_MATCH_TERM_LABELS}: Match term labels.
  • {@link kAPI_OP_MATCH_TAG_BY_LABEL}: Match tag by labels.
  • {@link kAPI_OP_MATCH_SUMMARY_TAG_BY_LABEL}: Match summary tag by label.
  • {@link kAPI_OP_MATCH_TERM_BY_LABEL}: Match term by labels.
  • {@link kAPI_OP_GET_TAG_ENUMERATIONS}: Get tag enumerations.
  • {@link kAPI_OP_GET_NODE_ENUMERATIONS}: Get node enumerations.
  • {@link kAPI_OP_GET_NODE_FORM}: Get node form.
  • {@link kAPI_OP_GET_NODE_STRUCT}: Get node structure.
  • {@link kAPI_OP_MATCH_UNITS}: Match domains.
  • {@link kAPI_OP_ADD_USER}: Add user.
  • {@link kAPI_OP_GET_USER}: Get user.

Any unrecognised operation will raise an exception.

Derived classes should match custom operations or call the parent method.

Throws

\OntologyWrapper\Exception

validateListStats()

validateListStats()

Validate match label strings services.

This method will validate all service operations which match label strings, the method will perform the following actions:

  • Validate operator: If the parameter is missing, it will set it by default as "contains case and accent insensitive"; if the parameter is set, it will ensure that it is conformant with the requested operation.
  • Check limit: If the parameter is missing, the method will raise an exception; if its value is larger than the {@link kSTANDARDS_STRINGS_LIMIT} constant, it will set it to that value.
  • Check pattern: If the parameter is missing, the method will raise an exception.

Throws

\OntologyWrapper\Exception

validateMatchLabelStrings()

validateMatchLabelStrings()

Validate match label strings services.

This method will validate all service operations which match label strings, the method will perform the following actions:

  • Validate operator: If the parameter is missing, it will set it by default as "contains case and accent insensitive"; if the parameter is set, it will ensure that it is conformant with the requested operation.
  • Check limit: If the parameter is missing, the method will raise an exception; if its value is larger than the {@link kSTANDARDS_STRINGS_LIMIT} constant, it will set it to that value.
  • Check pattern: If the parameter is missing, the method will raise an exception.

Throws

\OntologyWrapper\Exception

validateMatchTagByIdentifier()

validateMatchTagByIdentifier()

Validate get tag by identifier service.

This method will check whether the tag identifier was provided and will normalise it in an array.

Throws

\OntologyWrapper\Exception

validateGetTagEnumerations()

validateGetTagEnumerations()

Validate get tag enumerations service.

This method will validate all service operations which return tag enumerated sets, the method will perform the following actions:

  • Check tag: If the parameter is missing, the method will raise an exception.
  • Validate tag: The method will check whether the provided tag reference is valid, if that is not the case, the method will raise an exception.
  • Check limit: The limit will be reset if the recurse parameter is provided, if not, the limit is required and will be set to the {@link kSTANDARDS_ENUMS_LIMIT} constant if larger.

Throws

\OntologyWrapper\Exception

validateGetNodeEnumerations()

validateGetNodeEnumerations()

Validate get node enumerations service.

This method will validate all service operations which return node enumerated sets, the method will perform the following actions:

  • Check node: If the parameter is missing, the method will raise an exception.
  • Check limit: The limit will be reset if the recurse parameter is provided, if not, the limit is required and will be set to the {@link kSTANDARDS_ENUMS_LIMIT} constant if larger.

Throws

\OntologyWrapper\Exception

validateGetNodeStruct()

validateGetNodeStruct()

Validate get node form service.

This method will validate all service operations which return node form structures, the method will perform the following actions:

  • Check node: If the parameter is missing, the method will raise an exception.
  • Check limit: The limit will be reset if the recurse parameter is provided, if not, the limit is required and will be set to the {@link kSTANDARDS_ENUMS_LIMIT} constant if larger.

Throws

\OntologyWrapper\Exception

validateMatchUnits()

validateMatchUnits()

Validate match units service.

This method will validate all service operations which match units using a list of criteria, the method will perform the following actions:

  • Check criteria: The method will check whether the criteria was provided.
  • Validate group: If the group parameter was provided, we clear the results type parameter.
  • Validate results type: If the group parameter was not provided, we assert the group parameter.
  • Validate shape: If that parameter is provided:
    • Check shape value format.
    • Check shape structure.
    • Check shape type; if point, we assert the distance parameter.
  • Assert limits: If the results type was provided, we assert this parameter.
  • Check criteria parameters: The method will check whether all the required criteria parameters are there.

Throws

\OntologyWrapper\Exception

validateGetUnit()

validateGetUnit()

Validate get unit service.

This method will validate all service operations which match a single unit using an identifier, the method will perform the following actions:

  • Check identifier: The method will check whether the identifier was provided.

Throws

\OntologyWrapper\Exception

validateGetUser()

validateGetUser()

Validate get user service.

This method will call the unit validation process, then check whether the identifier parameter has the correct format.

Throws

\OntologyWrapper\Exception

validateAddUser()

validateAddUser()

Validate add user service.

This method will ensure the user object was set.

Throws

\OntologyWrapper\Exception

validateSearchCriteria()

validateSearchCriteria()

Validate search criteria.

This method will validate the search criteria, this method assumes the criteria is present.

While validating the criteria, the method will cluster the criteria in the filter data member.

Throws

\OntologyWrapper\Exception

validateStringMatchOperator()

validateStringMatchOperator(string $theValue)

Validate string match operator.

This method will validate the operator parameter passed to all service operations which match strings, the method will perform the following operations:

  • Assert that the parameter is an array.
  • Assert that the array is not empty.
  • Assert that the parameter contains no more than one main operator.
  • Assert that the parameter contains at least one main operator.

If the operator is missing we will assume by default contains case and accent insensitive.

Any error will raise an exception.

Parameters

string $theValue

Operator value.

Throws

\OntologyWrapper\Exception

validateRangeMatchOperator()

validateRangeMatchOperator(string $theValue)

Validate range match operator.

This method will validate the operator parameter passed to all service operations which match ranges, the method will perform the following operations:

  • Assert that the parameter is an array.
  • Assert that the array is not empty.
  • Assert that the parameter contains no more than one main operator.
  • Assert that the parameter contains at least one main operator.

Any error will raise an exception.

Parameters

string $theValue

Operator value.

Throws

\OntologyWrapper\Exception

validateCollection()

validateCollection(array $theValue)

Validate collection reference.

This method will validate the collection parameter.

Any error will raise an exception.

This method expects the collection parameter to be an array if provided.

Parameters

array $theValue

Collection.

Throws

\OntologyWrapper\Exception

validateRecurseFlag()

validateRecurseFlag(int $theLimit)

Validate recurse flag.

This method will validate the recurse flag parameter passed to all service operations which may recursively traverse structures.

The method will remove paging if the {@link kAPI_PARAM_RECURSE} flag was provided; if the flag was not provided, the method will set the default limits to the provided maximum value, or raise an exception if both the flag and limits are missing.

Any error will raise an exception.

Parameters

int $theLimit

Default limits.

Throws

\OntologyWrapper\Exception

validateGroup()

validateGroup() : array

Validate group offset

This method will validate the provided group offset and raise an exception if the related tag does not have the {@link kTYPE_SUMMARY} kind.

The method will set the normalised list of group leaf tag sequence numbers in the {@link kAPI_PARAM_GROUP} parameter and collect all group element information in the internal {@link kAPI_PARAM_GROUP_DATA} parameter.

Group elements can be provided as tag native identifiers or offsets.

Throws

\OntologyWrapper\Exception

Returns

array —

Normalised group list.

validateShape()

validateShape(array $theValue)

Validate shape

This method will validate the shape parameter passed to all service operations which should select objects based on geographic queries.

Any error will raise an exception.

Parameters

array $theValue

Shape value.

Throws

\OntologyWrapper\Exception

executeRequest()

executeRequest()

Execute request.

This method will parse the request operation and execute the appropriate action.

In this class we execute the following operations:

  • {@link kAPI_OP_PING}: Ping.
  • {@link kAPI_OP_LIST_CONSTANTS}: List parameter constants.
  • {@link kAPI_OP_LIST_OPERATORS}: List operator parameters.
  • {@link kAPI_OP_LIST_REF_COUNTS}: List reference count parameters.
  • {@link kAPI_OP_LIST_STATS}: List statistics by domain.
  • {@link kAPI_OP_MATCH_TAG_LABELS}: Match tag labels.
  • {@link kAPI_OP_MATCH_TAG_BY_IDENTIFIER}: Match tag by identifier.
  • {@link kAPI_OP_MATCH_TAG_SUMMARY_LABELS}: Match summary tag labels.
  • {@link kAPI_OP_MATCH_TERM_LABELS}: Match term labels.
  • {@link kAPI_OP_MATCH_TAG_BY_LABEL}: Match tag by labels.
  • {@link kAPI_OP_MATCH_SUMMARY_TAG_BY_LABEL}: Match summary tag by label.
  • {@link kAPI_OP_MATCH_TERM_BY_LABEL}: Match term by labels.
  • {@link kAPI_OP_GET_TAG_ENUMERATIONS}: Get tag enumerations.
  • {@link kAPI_OP_GET_NODE_ENUMERATIONS}: Get node enumerations.
  • {@link kAPI_OP_GET_NODE_FORM}: Get node form.
  • {@link kAPI_OP_GET_NODE_STRUCT}: Get node structure.
  • {@link kAPI_OP_MATCH_UNITS}: Match domains.
  • {@link kAPI_OP_ADD_USER}: Add user.

Derived classes can parse their custom operations or call the parent method.

executePing()

executePing()

Execute ping request.

This method will handle the {@link kAPI_OP_PING} operation.

executeListParameterConstants()

executeListParameterConstants()

Execute list parameter constants request.

This method will handle the {@link kAPI_OP_LIST_CONSTANTS} operation.

executeListParameterOperators()

executeListParameterOperators()

Execute list operator parameters request.

This method will handle the {@link kAPI_OP_LIST_OPERATORS} operation.

executeListReferenceCountParameters()

executeListReferenceCountParameters()

Execute list operator parameters request.

This method will handle the {@link kAPI_OP_LIST_OPERATORS} operation.

executeListStats()

executeListStats()

Execute list statistics request.

This method will handle the {@link kAPI_OP_LIST_STATS} operation.

executeMatchTagLabels()

executeMatchTagLabels()

Match tag labels.

The method will resolve the appropriate collection and pass it to the {@link executeMatchLabelStrings()} method.

executeMatchTermLabels()

executeMatchTermLabels()

Match term labels.

The method will resolve the appropriate collection and pass it to the {@link executeMatchLabelStrings()} method.

executeMatchTagByLabel()

executeMatchTagByLabel()

Match tag by label.

The method will resolve the appropriate collection and pass it to the {@link executeMatchLabelObjects()} method.

executeMatchTagByIdentifier()

executeMatchTagByIdentifier()

Match tag by identifier.

The method will resolve the appropriate collection and pass it to the {@link executeMatchLabelObjects()} method.

executeMatchTermByLabel()

executeMatchTermByLabel()

Match term by label.

The method will resolve the appropriate collection and pass it to the {@link executeMatchLabelObjects()} method.

executeGetTagEnumerations()

executeGetTagEnumerations()

Get tag enumerations.

The method will perform the following actions:

  • Locate tag node.
  • Locate all enumerated types or values pointing to that node.
  • Load all found elements.
  • Recurse nested enumerations.

executeGetNodeEnumerations()

executeGetNodeEnumerations()

Get node enumerations.

The method will perform the following actions:

  • Locate all enumerated types or values pointing to node parameter.
  • Load all found elements.
  • Recurse nested enumerations.

executeGetNodeStructure()

executeGetNodeStructure()

Get node structure.

The method will return the structure corresponding to the node stored in {@link kAPI_PARAM_NODE}.

executeMatchUnits()

executeMatchUnits()

Match units.

The method will perform the following actions:

  • Cluster by feature: The method will cluster the search criteria by tag feature.

executeGetUnit()

executeGetUnit()

Get unit.

The method will match the unit and return a clustered, formatted or marker result.

executeGetUser()

executeGetUser()

Get user.

The method will match the user and return a clustered, formatted or marker result.

executeAddUser()

executeAddUser()

Add user.

The method will add the provided user to the database.

executeMatchLabelStrings()

executeMatchLabelStrings(\OntologyWrapper\CollectionObject $theCollection)

Match label strings.

This method will match all label strings from objects stored in the provided collection.

The method uses the {@link executeMatchLabelStringsQuery()} method to produce the query cursor and the {@link executeMatchLabelStringsResults()} method to compile the results.

Parameters

\OntologyWrapper\CollectionObject $theCollection

Data collection.

executeMatchLabelObjects()

executeMatchLabelObjects(\OntologyWrapper\CollectionObject $theCollection)

Match label objects.

This method will match all objects in the provided collection matching labels.

The method uses the {@link executeMatchLabelStringsQuery()} method to produce the query cursor and the {@link executeMatchLabelObjectsResults()} method to compile the results.

Parameters

\OntologyWrapper\CollectionObject $theCollection

Data collection.

executeMatchLabelStringsQuery()

executeMatchLabelStringsQuery(\OntologyWrapper\CollectionObject $theCollection, array $theFields) : \OntologyWrapper\ObjectIterator

Query label strings.

This method will match all label strings from objects stored in the provided collection and return a recordset.

The method expects the following parameters to have been set:

  • {@link kAPI_PARAM_PATTERN}: Match pattern.
  • {@link kAPI_PARAM_REF_COUNT}: Collection reference count.
  • {@link kAPI_PARAM_OPERATOR}: Match operator.
  • {@link kAPI_REQUEST_LANGUAGE}: String language.
  • {@link kAPI_PAGING_LIMIT}: Limits.

The last parameter represents the fields selection.

The method will set the affected count and will skip eventual records, other cursor operations will have to be performed by the caller.

Parameters

\OntologyWrapper\CollectionObject $theCollection

Data collection.

array $theFields

Fields selection.

Returns

\OntologyWrapper\ObjectIterator

Matched data or NULL.

executeMatchLabelStringsResults()

executeMatchLabelStringsResults(\OntologyWrapper\ObjectIterator $theIterator)

Build label strings results.

This method will use the provided cursor to fill the service results with the requested label strings.

Parameters

\OntologyWrapper\ObjectIterator $theIterator

Iterator object.

executeMatchLabelObjectsResults()

executeMatchLabelObjectsResults(\OntologyWrapper\ObjectIterator $theIterator)

Build label objects results.

This method will use the provided cursor to fill the service results with the requested label objects.

Parameters

\OntologyWrapper\ObjectIterator $theIterator

Iterator object.

executeLoadEnumerations()

executeLoadEnumerations(\OntologyWrapper\ObjectIterator $theIterator, array $theContainer)

Load enumerations.

This method expects an iterator containing a list of enumerations and a reference to the results element that will receive the results.

Parameters

\OntologyWrapper\ObjectIterator $theIterator

Iterator object.

array $theContainer

Reference to the results container.

executeLoadEnumeration()

executeLoadEnumeration(array $theEdge, array $theContainer)

Load single enumeration.

This method expects an iterator containing a list of enumerations and a reference to the results element that will receive the results.

Parameters

array $theEdge

Edge object.

array $theContainer

Reference to the results container.

executeGroupUnits()

executeGroupUnits(array $theGroup, array $theContainer, string $theCollection)

Group units.

This method expects the filter data member set with the requested query.

Parameters

array $theGroup

Groupings list.

array $theContainer

Reference to the results container.

string $theCollection

collection name.

executeTableUnits()

executeTableUnits(array $theContainer, string $theCollection)

Cluster units.

This method expects the filter data member set with the requested query.

Parameters

array $theContainer

Reference to the results container.

string $theCollection

collection name.

executeFormattedUnits()

executeFormattedUnits(array $theContainer, string $theCollection)

Format units.

This method expects the filter data member set with the requested query.

Parameters

array $theContainer

Reference to the results container.

string $theCollection

collection name.

executeMarkerUnits()

executeMarkerUnits(array $theContainer, string $theCollection)

Marker units.

This method expects the filter data member set with the requested query.

Parameters

array $theContainer

Reference to the results container.

string $theCollection

collection name.

executeClusterUnits()

executeClusterUnits(array $theContainer, string $theCollection)

Cluster units.

This method expects the filter data member set with the requested query.

Parameters

array $theContainer

Reference to the results container.

string $theCollection

collection name.

executeUnitStats()

executeUnitStats(array $theContainer, string $theCollection)

Perform statistics.

This method expects the filter data member set with the requested query.

Parameters

array $theContainer

Reference to the results container.

string $theCollection

collection name.

executeUnitStat1()

executeUnitStat1(array $theContainer, \OntologyWrapper\ObjectIterator $theIterator)

Perform statistic 1.

This method will perform the statistics according to the data provided in the iterator parameter.

Parameters

array $theContainer

Reference to the results container.

\OntologyWrapper\ObjectIterator $theIterator

Iterator.

executeUnitStat2()

executeUnitStat2(array $theContainer, \OntologyWrapper\ObjectIterator $theIterator)

Perform statistic 2.

This method will perform the statistics according to the data provided in the iterator parameter.

Parameters

array $theContainer

Reference to the results container.

\OntologyWrapper\ObjectIterator $theIterator

Iterator.

executeUnitStat3()

executeUnitStat3(array $theContainer, \OntologyWrapper\ObjectIterator $theIterator)

Perform statistic 3.

This method will perform the statistics according to the data provided in the iterator parameter.

Parameters

array $theContainer

Reference to the results container.

\OntologyWrapper\ObjectIterator $theIterator

Iterator.

executeUnitStat4()

executeUnitStat4(array $theContainer, \OntologyWrapper\ObjectIterator $theIterator)

Perform statistic 4.

This method will perform the statistics according to the data provided in the iterator parameter.

Parameters

array $theContainer

Reference to the results container.

\OntologyWrapper\ObjectIterator $theIterator

Iterator.

executeUnitStat5()

executeUnitStat5(array $theContainer, \OntologyWrapper\ObjectIterator $theIterator)

Perform statistic 5.

This method will perform the statistics according to the data provided in the iterator parameter.

Parameters

array $theContainer

Reference to the results container.

\OntologyWrapper\ObjectIterator $theIterator

Iterator.

executeUnitStat6()

executeUnitStat6(array $theContainer, \OntologyWrapper\ObjectIterator $theIterator)

Perform statistic 5.

This method will perform the statistics according to the data provided in the iterator parameter.

Parameters

array $theContainer

Reference to the results container.

\OntologyWrapper\ObjectIterator $theIterator

Iterator.

executeUnitStat7()

executeUnitStat7(array $theContainer, \OntologyWrapper\ObjectIterator $theIterator)

Perform statistic 7.

This method will perform the statistics according to the data provided in the iterator parameter.

Parameters

array $theContainer

Reference to the results container.

\OntologyWrapper\ObjectIterator $theIterator

Iterator.

executeSerialiseResults()

executeSerialiseResults(\OntologyWrapper\ObjectIterator $theIterator)

Serialise results.

This method will userialise the data from the provided iterator.

Parameters

\OntologyWrapper\ObjectIterator $theIterator

Iterator object.

executeSerialiseSummaryTags()

executeSerialiseSummaryTags(\OntologyWrapper\ObjectIterator $theIterator)

Serialise summary tags.

This method will serialise the data from the provided iterator which is expected to hold a list of summary tag objects.

Parameters

\OntologyWrapper\ObjectIterator $theIterator

Iterator object.

handleException()

handleException(\OntologyWrapper\Exception $theException)

Handle exception.

This method should be called whenever an exception is catched, it will load the exception arguments in the {@link kAPI_RESPONSE_STATUS} block, delete all other blocks and return the JSON encoded result.

Note that the script will exit in this method.

Parameters

\OntologyWrapper\Exception $theException

Exception.

stringMatchPattern()

stringMatchPattern(string $thePattern, array $theOperator) : array

Return string match criteria pattern.

This method will return the pattern corresponding to the provided operator that should be used to match a string.

The methoid will only consider the following main operators:

  • {@link kOPERATOR_EQUAL}: Equality.
  • {@link kOPERATOR_EQUAL_NOT}: Inequality.
  • {@link kOPERATOR_PREFIX}: Prefix.
  • {@link kOPERATOR_CONTAINS}: Contains.
  • {@link kOPERATOR_SUFFIX}: Suffix.
  • {@link kOPERATOR_REGEX}: Regular expression.

If none of the above are present in the operator, the method will raise an exception.

The method will only return the match value to be used in the filter criteria, it is up to the caller to add the property reference.

Parameters

string $thePattern

Match pattern.

array $theOperator

Match operator.

Returns

array —

Search criteria.

rangeMatchPattern()

rangeMatchPattern(mixed $theMin, mixed $theMax, array $theOperator) : array

Return range match criteria pattern.

This method will return the query corresponding to the provided range input type.

Depending on the clause operator:

  • {@link kOPERATOR_IRANGE}: Include bounds.
  • {@link kOPERATOR_ERANGE}: Exclude bounds.

If none of the above are present in the operator, the method will assume range inclusive.

The method will only return the match value to be used in the filter criteria, it is up to the caller to add the property reference.

Parameters

mixed $theMin

Minimum bound.

mixed $theMax

Maximum bound.

array $theOperator

Match operator.

Returns

array —

Search criteria.

shapeMatchPattern()

shapeMatchPattern(array $theShape) : array

Return shape match criteria pattern.

This method will return the query corresponding to the provided shape input type.

Parameters

array $theShape

Shape criteria.

Returns

array —

Search criteria.

resolveFilter()

resolveFilter()

Resolve filter.

This method will convert the clustered clauses stored in the filter data member into a query that can be used by the current database.

getRefCountTag()

getRefCountTag(array $theCollection) : mixed

Get reference count tag.

This method will return the reference count tags related to the provided} value, which should be the {@link kAPI_PARAM_REF_COUNT} service parameter.

If the value is an array, the method will return an array indexed by the element with as value the reference count tag; if the value has one element, the method will return the reference count tag; if the value is missing, the method will return NULL.

Parameters

array $theCollection

Collection name.

Returns

mixed —

Reference count tags.

buildCriteria()

buildCriteria(string $theOffset, mixed $theValue, array $theOffsets) : array

Build criteria entry.

This method will return a criteria entry according to the provided parameters; it is the responsibility of the caller to manage the criteria element key.

The match is assumed an exact match.

Parameters

string $theOffset

Offset.

mixed $theValue

Value.

array $theOffsets

Offsets list.

Returns

array —

Criteria record.

traverseStructure()

traverseStructure(array $theContainer, int $theNode, string $theLanguage, int $theParent, string $theRefCount) : array

Traverse structure.

This method will traverse the structure of the provided form node, loading the information in the provided container.

The information is loaded as follows:

  • {@lnk kAPI_PARAM_RESPONSE_FRMT_NAME}: The node label, or the label of the element the node references.
  • {@lnk kAPI_PARAM_RESPONSE_FRMT_INFO}: The node description, the definition of the term, or the description of the tag.
  • {@lnk kAPI_PARAM_TAG}: If the node references a tag, the tag's native identifier.
  • {@lnk kAPI_PARAM_RESPONSE_CHILDREN}: If there are nodes relating to the provided node via the {@link kPREDICATE_PROPERTY_OF} or {@link kPREDICATE_SUBCLASS_OF} predicates, these elements will be loaded in this property; in the latter predicate case, the related node will act as a proxy for the current element.

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

Parameters

array $theContainer

Receives information.

int $theNode

Node native identifier.

string $theLanguage

Default language.

int $theParent

Parent node native identifier.

string $theRefCount

Reference count tag.

Returns

array —

Criteria record.

traverseEdges()

traverseEdges(array $theContainer, int $theNode, string $theLanguage, int $theParent, string $theRefCount) : array

Traverse edges.

This method will scan the edges that point to the provided node, recursing subclass predicates.

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

Parameters

array $theContainer

Receives information.

int $theNode

Node native identifier.

string $theLanguage

Default language.

int $theParent

Parent node native identifier.

string $theRefCount

Reference count tag.

Returns

array —

Criteria record.

loadNodeElementInfo()

loadNodeElementInfo(array $theContainer, mixed $theNode, string $theLanguage, int $theParent, string $theRefCount) : \OntologyWrapper\Node

Load node element information.

This method will load the provided container with the information pertaining to the provided node, the information will be set as follows:

  • {@lnk kAPI_PARAM_RESPONSE_FRMT_NAME}: The node label, or the label of the element the node references.
  • {@lnk kAPI_PARAM_RESPONSE_FRMT_INFO}: The node description, the definition of the term, or the description of the tag.
  • {@lnk kAPI_PARAM_TAG}: If the node references a tag, the tag's native identifier.

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

Parameters

array $theContainer

Receives information.

mixed $theNode

Node native identifier.

string $theLanguage

Default language.

int $theParent

Parent node native identifier.

string $theRefCount

Reference count tag.

Returns

\OntologyWrapper\Node

Node object.

getStatistics()

getStatistics(array $theContainer, string $theLanguage, string $theDomain, string $theStatistics)

Load statistics information information.

This method will load the provided container with the information pertaining to the statistics related to the provided domain in the provided language.

The container is expected to point to an array.

Parameters

array $theContainer

Results container.

string $theLanguage

Default language.

string $theDomain

Statistics domain.

string $theStatistics

Optional statistics code.

setStatisticsCriteria()

setStatisticsCriteria(array $theContainer, string $theStatistics, string $theDomain)

Set statistics criteria.

This method will update the criteria according to the requested statistics.

The container is expected to hold the current criteria.

Parameters

array $theContainer

Current criteria.

string $theStatistics

Statistics code.

string $theDomain

Statistics domain.

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.