Convert from Tripod value object format (comapct) to ExtendedGraph format (verbose)

@param array $mongoValueObject
@return array
773408
private function toGraphValueObject($mongoValueObject)
    {
        $simpleGraphValueObject = array();

        if (array_key_exists(VALUE_LITERAL,$mongoValueObject))
        {
            // only allow valid values
            if($this->isValidLiteral($mongoValueObject[VALUE_LITERAL])){
                // single value literal
                $simpleGraphValueObject[] = array(
                    'type'=>'literal',
                    'value'=>$mongoValueObject[VALUE_LITERAL]);
            }
        }
        else if (array_key_exists(VALUE_URI,$mongoValueObject))
        {
            // only allow valid values
            if($this->isValidResource($mongoValueObject[VALUE_URI])) {
                // single value uri
                $simpleGraphValueObject[] = array(
                    'type' => 'uri',
                    'value' => $this->_labeller->qname_to_alias($mongoValueObject[VALUE_URI]));
            }
        }
        else
        {
            // If we have an array of values
            foreach ($mongoValueObject as $kvp)
            {
                foreach ($kvp as $type=>$value)
                {
                    // Make sure the value is valid
                    if($type==VALUE_LITERAL){
                        if(!$this->isValidLiteral($value)){
                            continue;
                        }
                        $valueTypeLabel = 'literal';
                    }
                    else{
                        if(!$this->isValidResource($value)){
                            continue;
                        }
                        $valueTypeLabel = 'uri';
                    }
                    $simpleGraphValueObject[] = array(
                        'type'=>$valueTypeLabel,
                        'value'=>($type==VALUE_URI) ? $this->_labeller->qname_to_alias($value) : $value);
                }
            }
        }
        // Otherwise we have found valid values
        return $simpleGraphValueObject;
    }
961074
public function values(Interfaces\JavaObject $javaObject)
    {
        try {
            return $this->pjbProxyClient->getValues($javaObject);
        } catch (Pjb62BrokenConnectionException | Exception\InvalidUsageException $e) {
            PjbProxyClient::unregisterInstance();
            throw new BrokenConnectionException($e->getMessage(), $e->getCode(), $e);
        }
    }
607009
protected function getPersistentValues(PersistentObject $object) {
    $values = [];

    // attribute definitions
    $attributeDescs = $this->getAttributes();
    foreach($attributeDescs as $curAttributeDesc) {
      if ($curAttributeDesc instanceof RDBAttributeDescription) {
        // add only attributes that are defined in the object
        $attribName = $curAttributeDesc->getName();
        //if ($object->hasValue($attribName)) {
          $values[$attribName] = $object->getValue($attribName);
        //}
      }
    }
    return $values;
  }
927789
public function getValue($returnObject = false){

        $returnValue = null;

        if(!is_null($this->value)){
            $returnValue = ($returnObject) ? $this->value : $this->value->getValue(); //return mixed
        }

        return $returnValue;
    }
132114
private static function createDynamicBrickArrayForDocument($postValues, $documentObj)
    {
        $documentObj->dynamicBricks = array();
        if (isset($postValues['dynamicBricks'])) {
            foreach ($postValues['dynamicBricks'] as $brickTypeSlug => $brick) {
                foreach ($brick as $brickContent) {
                    $brickObj = new \stdClass();
                    $brickObj->type = $brickTypeSlug;
                    $brickObj->fields = Sanitizer::sanitizeBrickContent($brickContent);
                    $dynamicBricks = $documentObj->dynamicBricks;
                    $dynamicBricks[] = $brickObj;
                    $documentObj->dynamicBricks = $dynamicBricks;
                }
            }
        }
        return $documentObj;
    }
1026766
public function getNameAndPayload(array $serializedObject)
    {
        if (!$this->isSerializedObject($serializedObject)) {
            throw new \InvalidArgumentException();
        }

        $name = $serializedObject['_metadata']['name'];
        $payload = $serializedObject;
        unset($payload['_metadata']);

        return [
            $name,
            $payload,
        ];
    }
1215035
public function getObjectsByPropertyValueBetween($property, $valueA, $valueB, array $select, $objectType = NULL, $objectURI = NULL, $objectId = NULL)
    {

        if (empty($property) || empty($valueA) || empty($valueB) || empty($select))
            return false; //We must have eactly one property value pair defined 

        $query = static::getObjectQuery($select, "?{$this->valueGroup}property_values", $objectId, $objectType, $objectURI);

        $query .= "\nGROUP BY o.object_id";
        $query .= "\nHAVING {$property} BETWEEN {$valueA} AND {$valueB}"; //@TODO check if we are comparing dates and use CAST() to convert to dates 


        $results = $this->database->prepare($query)->execute();

        return $results;
    }
214494
public static function convertToDb($value)
    {
        if (!is_array($value)) {
            return [];
        }

        // see DateType::convertToDatabaseValue()
        $convertor = function ($value) {
            if ($value === null || $value instanceof \MongoDate) {
                return $value;
            }

            try {
                $datetime = DateType::getDateTime($value);
                return new \MongoDate($datetime->format('U'), $datetime->format('u'));
            } catch (\InvalidArgumentException $e) {
                return null;
            }
        };

        return array_values(array_filter(array_map($convertor, $value)));
    }
33760
public static function convertContributors($value, $prevValue)
    {
        $mergeValue = \is_array($prevValue) ? $prevValue : array();
        $mergeValue = array_merge($mergeValue, \is_array($value) ? $value : array());

        if (\count($mergeValue) > 0) {
            $value = $mergeValue;
        }

        return $value;
    }
1343114
protected function convertPointerToMagentoModels($mailValues)
    {
        $newMailValues = [];

        foreach ($mailValues as $key => $value) {
            if (is_array($value)
                && !empty($value['class']) && !empty($value['entity_id'])
            ) {
                $newMailValues[$key] = $this->createAbstractModelFromValue($value);
            }
            /** @noinspection NotOptimalIfConditionsInspection */
            elseif(is_array($value) && !empty($value['class'])) {
                $newMailValues[$key] = $this->createObjectFromValue($value);
            }
            else {
                $newMailValues[$key] = $value;
            }
        }

        return $newMailValues;
    }
157901
public function valueObjects($valueObjectClassMapperClassMap)
    {
        foreach ($valueObjectClassMapperClassMap as $valueObject => $mapper) {
            $this->valueObject($valueObject)->from($mapper);
        }
    }
724188
protected function appendCollectionDoc(TypeDoc $docObject) : array
    {
        $docArray = [];
        if ($docObject instanceof CollectionDoc) {
            $siblingDocList = $this->getSiblingDocList($docObject);
            if (count($siblingDocList)) {
                $docArray['siblings'] = $siblingDocList;
            }
            if (true === $docObject->isAllowExtraSibling()) {
                $docArray['allowExtra'] = $docObject->isAllowExtraSibling();
            }
            if (true === $docObject->isAllowMissingSibling()) {
                $docArray['allowMissing'] = $docObject->isAllowMissingSibling();
            }
        }

        return $docArray;
    }
1315674
function getObjectValues(oObject) {
		var aKeys = Object.keys(oObject),
			aValues = [];

		aKeys.forEach(function(sKey) {
			aValues.push(oObject[sKey]);
		});

		return aValues;
	}
35979
protected function convertObjectsToHashes(array $routeValues)
    {
        foreach ($routeValues as &$value) {
            if (is_object($value)) {
                if ($value instanceof CacheAwareInterface) {
                    $identifier = $value->getCacheEntryIdentifier();
                } else {
                    $identifier = $this->persistenceManager->getIdentifierByObject($value);
                }
                if ($identifier === null) {
                    return null;
                }
                $value = $identifier;
            } elseif (is_array($value)) {
                $value = $this->convertObjectsToHashes($value);
                if ($value === null) {
                    return null;
                }
            }
        }
        return $routeValues;
    }
302110
protected function objectToFields($dataObject) {
		$ret = array();

		$fields = Config::inst()->get($dataObject->ClassName, 'db');
		$fields['Created'] = 'SS_Datetime';
		$fields['LastEdited'] = 'SS_Datetime';

		$ret['ClassName'] = array('Type' => 'Varchar', 'Value' => $dataObject->class);
		$ret['SS_ID'] = array('Type' => 'Int', 'Value' => $dataObject->ID);

		foreach ($fields as $name => $type) {
			if (preg_match('/^(\w+)\(/', $type, $match)) {
				$type = $match[1];
			}

			// Just index everything; the query can figure out what to exclude... !
			$value = $dataObject->$name;

			if ($type == 'MultiValueField' && $value instanceof MultiValueField) {
				$value = $value->getValues();
			}

			$ret[$name] = array('Type' => $type, 'Value' => $value);
		}

		$rels = Config::inst()->get($dataObject->ClassName, 'has_one');

		if($rels) foreach(array_keys($rels) as $rel) {
			$ret["{$rel}ID"] = array(
				'Type'  => 'ForeignKey',
				'Value' => $dataObject->{$rel . "ID"}
			);
		}
		
		if ($dataObject->hasMethod('additionalSolrValues')) {
			$extras = $dataObject->invokeWithExtensions('additionalSolrValues');
			if ($extras && is_array($extras)) {
				foreach ($extras as $add) {
					foreach ($add as $k => $v) {
						$ret[$k] = array(
							'Type'		=> $this->mapper->mapValueToType($k, $v),
							'Value'		=> $v,
						);
					}
				}
			}
		}

		return $ret;
	}
360397
private function processDeserializeTypeCollectionObject(Type\Collection\Object $objectType, $object, array $values)
    {
        $objects = [];
        foreach ($values as $key => $objectFromValue) {
            $objects[$key] = $this->setObjectForClass($objectType->className(), $objectFromValue);
        }

        $object->{$objectType->setter()}($objects);

        return $this;
    }
341926
public function getPropertyValuesArray($object)
    {
        $values = [];
        foreach ($this->entityPropertiesMetadata as $entityPropertyMetadata) {
            $v = $entityPropertyMetadata->getValue($object);
            if (is_object($v)) {
                switch (get_class($v)) {
                    case \DateTime::class:
                        $v = $v->getTimestamp();
                        break;
                }
            }
            $values[$entityPropertyMetadata->getPropertyName()] = $v;
        }

        return $values;
    }