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

Fix Skosmos 2 deprecated concept pages (bool value causes crash) #1673

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion model/Concept.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Concept extends VocabularyDataObject implements Modifiable
'skos:member', # this shouldn't be shown on the group page
'dc:created', # handled separately
'dc:modified', # handled separately
'owl:deprecated', # indicated visually
);

/** related concepts that should be shown to users in the appendix */
Expand Down Expand Up @@ -660,7 +661,7 @@ public function removeDuplicatePropertyValues($ret, $duplicates)
foreach ($ret as $prop) {
foreach ($prop->getValues() as $value) {
$label = $value->getLabel();
$propertyValues[(method_exists($label, 'getValue')) ? $label->getValue() : $label][] = $value->getType();
$propertyValues[(is_object($label) && method_exists($label, 'getValue')) ? $label->getValue() : $label][] = $value->getType();
}
}

Expand Down
12 changes: 12 additions & 0 deletions tests/ConceptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ public function testGetPropertiesAlphabeticalSortingOfPropertyValues()
}
}

/**
* @covers Concept::getProperties
* @covers Concept::removeDuplicatePropertyValues
*/
public function testGetPropertiesOfDeprecatedConcept()
{
$results = $this->vocab->getConceptInfo('http://www.skosmos.skos/test/ta111', 'en');
$concept = reset($results);
$props = $concept->getProperties();
$this->assertNotContains('owl:deprecated', $props);
}

/**
* @covers Concept::getMappingProperties
* @covers ConceptProperty::getValues
Expand Down
7 changes: 7 additions & 0 deletions tests/test-vocab-data/default_graph.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.

# these triples are not part of any specific test vocabulary
# but they should be accessible through the Fuseki default graph

owl:deprecated a owl:DatatypeProperty; rdfs:label "deprecated" .
Loading