Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't perform label and subPropertyOf lookups for well-known properties #837

Merged
merged 1 commit into from
Jan 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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