/**
  * @param SchemaProperty     $property
  * @param Criteria           $cLang
  * @param ProfileProperty[] $propArray
  * @param Status[]          $statusArray
  * @param bool              $languageArray
  * @param                    $languageDefault
  *
  * @return array
  *
  */
 public function getResourceArray(SchemaProperty $property, Criteria $cLang, $propArray, $statusArray, $languageArray, $languageDefault)
 {
     //todo: this should be based on a constant rather than hard-coded;
     $lexicalAliasProperty = 27;
     //todo: remove hard coded registry URLs
     $resourceArray = [];
     $resourceArray["@id"] = $property->getUri();
     $resourceArray["isDefinedBy"] = array("@id" => $this->getUri(), "url" => "http://metadataregistry.org/schema/show/id/" . $this->getId() . ".html", "label" => $this->getName());
     $typeArray = array('property' => "Property", 'class' => "Class", 'subproperty' => "Property", 'subclass' => "Class");
     $resourceArray["url"] = "http://metadataregistry.org/schemaprop/show/id/" . $property->getId() . ".html";
     $elements = $property->getSchemaPropertyElementsRelatedBySchemaPropertyId($cLang);
     /** @var SchemaPropertyElement $element */
     foreach ($elements as $element) {
         /** @var string $ppi */
         $pproperty = $propArray[$element->getProfilePropertyId()];
         $ppi = $pproperty->getLabel();
         //id
         if (!$pproperty->getIsObjectProp()) {
             if ($pproperty->getHasLanguage() && $languageArray) {
                 //we're putting language related elements in a language specific array
                 self::addToGraph($resourceArray[$ppi][$element->getLanguage()], $element->getObject(), $pproperty->getIsSingleton());
             } else {
                 self::addToGraph($resourceArray[$ppi], $element->getObject(), $pproperty->getIsSingleton());
             }
         } else {
             $array = array();
             if ("status" !== $ppi) {
                 if (!in_array($statusArray[$element->getStatusId()][2], ["Deprecated", "Not Approved"])) {
                     $object = $element->getSchemaPropertyRelatedByRelatedSchemaPropertyId();
                     if (!$object) {
                         //there wasn't an ID so we look it up by the URI
                         $object = SchemaPropertyPeer::retrieveByUri($element->getObject());
                         if ($object) {
                             //we now have an ID
                             //todo: log that we did this
                             $element->setRelatedSchemaPropertyId($object->getId());
                             $element->save();
                         }
                     }
                     if ($object) {
                         //we got an object somehow
                         //todo: refactor this to build a language array for lexicalalias and label if uselanguagearray is true
                         //we'll need to get the array of available languages for the schema and do a for/next
                         //todo: we removed the language filter from the query, so we need to check for a language match here
                         $object->setLanguage($languageDefault);
                         if ($lexicalAliasProperty == $pproperty->getId()) {
                             $array = $object->getLexicalAlias();
                             $this->setLexicalArray($element->getObject(), $resourceArray["@id"], 308);
                         } else {
                             $array = array("@id" => $object->getUri(), "lexicalAlias" => $object->getLexicalAlias(), "url" => "http://metadataregistry.org/schemaprop/show/id/" . $object->getId() . ".html", "label" => $object->getLabel());
                             if (empty($array['lexicalAlias'])) {
                                 unset($array['lexicalAlias']);
                             }
                         }
                     } else {
                         if ('@type' == $ppi and isset($typeArray[$element->getObject()])) {
                             $array = $typeArray[$element->getObject()];
                         } else {
                             $array = array("@id" => $element->getObject());
                         }
                     }
                 }
             } else {
                 //it's a status
                 $status = $statusArray[$element->getObject()];
                 $array = array("@id" => $status[3], "lexicalAlias" => "http://metadataregistry.org/uri/RegStatus/" . $status[2] . ".en", "url" => "http://metadataregistry.org/concept/show/id/{$status['4']}.html", "label" => $status[2]);
                 //$resourceArray[ $ppi ] = self::addToGraph($array, $pproperty->getIsSingleton());
             }
             self::addToGraph($resourceArray[$ppi], $array, $pproperty->getIsSingleton());
         }
     }
     ksort($resourceArray, SORT_FLAG_CASE | SORT_NATURAL);
     return $resourceArray;
 }