Skip to content

Commit ab4bc73

Browse files
author
Mark Hale
committed
Fix to handle multiple # in vocab URIs.
1 parent 3ea6c18 commit ab4bc73

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

model/VocabularyConfig.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,10 @@ public function getDefaultSidebarView()
536536
public function getId()
537537
{
538538
$uriparts = explode("#", $this->resource->getURI());
539-
if (count($uriparts) != 1)
539+
if (count($uriparts) > 1)
540540
// hash namespace
541541
{
542-
return $uriparts[1];
542+
return $uriparts[count($uriparts) - 1];
543543
}
544544

545545
// slash namespace

tests/VocabularyTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ public function testGetId() {
2525
$this->assertEquals('test', $id);
2626
}
2727

28+
/**
29+
* @covers Vocabulary::getId
30+
*/
31+
public function testGetMultiHashId() {
32+
$vocab = $this->model->getVocabulary('multiHashVocabId');
33+
$id = $vocab->getId();
34+
$this->assertEquals('multiHashVocabId', $id);
35+
}
36+
2837
/**
2938
* @covers Vocabulary::getTitle
3039
*/

tests/testconfig.ttl

+2
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@
429429
skosmos:language "en";
430430
skosmos:sparqlGraph <http://www.skosmos.skos/testOrder/> .
431431

432+
<http://testMultiHashesInUri#vocab#multiHashVocabId> a skosmos:Vocabulary, void:Dataset ;
433+
432434
<http://skosmos.skos/dump/test/groups> dc:format "application/rdf+xml" .
433435

434436
:cat_science a skos:Concept ;

0 commit comments

Comments
 (0)