diff --git a/model/Concept.php b/model/Concept.php index 73608fe16..2630b4c6e 100644 --- a/model/Concept.php +++ b/model/Concept.php @@ -597,7 +597,7 @@ public function getProperties() if (isset($ret[$prop])) { // checking if the property value is not in the current vocabulary - $exvoc = $this->model->guessVocabularyFromURI($val->getUri()); + $exvoc = $this->model->guessVocabularyFromURI($val->getUri(), $this->vocab->getId()); if ($exvoc && $exvoc->getId() !== $this->vocab->getId()) { $ret[$prop]->addValue(new ConceptMappingPropertyValue($this->model, $this->vocab, $val, $this->resource, $prop, $this->clang), $this->clang); continue; diff --git a/model/Model.php b/model/Model.php index b49cbbc95..fd1503aae 100644 --- a/model/Model.php +++ b/model/Model.php @@ -237,24 +237,25 @@ public function searchConcepts($params) foreach ($results as $hit) { if (sizeof($vocabs) == 1) { + $hitvoc = $voc; $hit['vocab'] = $vocabs[0]->getId(); } else { try { - $voc = $this->getVocabularyByGraph($hit['graph']); - $hit['vocab'] = $voc->getId(); + $hitvoc = $this->getVocabularyByGraph($hit['graph']); + $hit['vocab'] = $hitvoc->getId(); } catch (Exception $e) { trigger_error($e->getMessage(), E_USER_WARNING); - $voc = null; + $hitvoc = null; $hit['vocab'] = "???"; } } unset($hit['graph']); - $hit['voc'] = $voc; + $hit['voc'] = $hitvoc; // if uri is a external vocab uri that is included in the current vocab - $realvoc = $this->guessVocabularyFromURI($hit['uri']); - if ($realvoc !== $voc) { + $realvoc = $this->guessVocabularyFromURI($hit['uri'], $voc !== null ? $voc->getId() : null); + if ($realvoc != $hitvoc) { unset($hit['localname']); $hit['exvocab'] = ($realvoc !== null) ? $realvoc->getId() : "???"; }