Skip to content

Commit

Permalink
Don't perform label and subPropertyOf lookups for well-known properti…
Browse files Browse the repository at this point in the history
…es. Part of NatLibFi#836
  • Loading branch information
osma committed Jan 9, 2019
1 parent 1211ff6 commit 9de5b86
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions model/Concept.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,16 @@ public function getProperties()
$propres = new EasyRdf\Resource($prop, $this->graph);
$proplabel = $propres->label($this->getEnvLang()) ? $propres->label($this->getEnvLang()) : $propres->label();

// check if the property is one of the well-known properties for which we have a gettext translation
// if it is then we can skip the additional lookups in the default graph
$propkey = (substr($prop, 0, 5) == 'dc11:') ?
str_replace('dc11:', 'dc:', $prop) : $prop;
$is_well_known = (gettext($propkey) != $propkey);

// if not found in current vocabulary, look up in the default graph to be able
// to read an ontology loaded in a separate graph
// note that this imply that the property has an rdf:type declared for the query to work
if(!$proplabel) {
if(!$is_well_known && !$proplabel) {
$envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang());

$defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, '');
Expand All @@ -533,7 +539,7 @@ public function getProperties()
}

// also look up superprops in the default graph if not found in current vocabulary
if(!$superprops || empty($superprops)) {
if(!$is_well_known && (!$superprops || empty($superprops))) {
$superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri);
}

Expand Down

0 comments on commit 9de5b86

Please sign in to comment.