From 58df9cb476f09e89a4e1311e178b782a3de3c05a Mon Sep 17 00:00:00 2001 From: Lukas Rosenstock Date: Mon, 15 Jun 2026 09:04:16 +0000 Subject: [PATCH] Added getLabel() helper function --- CloudObjects/SDK/CloudObject.php | 7 +++++++ CloudObjects/SDK/Constants.php | 1 + tests/OfflineTests/NodeReaderMockTest.php | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/CloudObjects/SDK/CloudObject.php b/CloudObjects/SDK/CloudObject.php index 70278d0..3077612 100644 --- a/CloudObjects/SDK/CloudObject.php +++ b/CloudObjects/SDK/CloudObject.php @@ -166,4 +166,11 @@ class CloudObject { return $this->getString(Constants::PROPERTY_REVISION); } + /** + * Get the rdfs:label of the object. + */ + public function getLabel() : ?string { + return $this->getString(Constants::RDFS_LABEL); + } + } diff --git a/CloudObjects/SDK/Constants.php b/CloudObjects/SDK/Constants.php index 12ab01d..5233ca8 100644 --- a/CloudObjects/SDK/Constants.php +++ b/CloudObjects/SDK/Constants.php @@ -9,5 +9,6 @@ namespace CloudObjects\SDK; class Constants { const PROPERTY_REVISION = 'coid://cloudobjects.io/isAtRevision'; + const RDFS_LABEL = 'http://www.w3.org/2000/01/rdf-schema#label'; } \ No newline at end of file diff --git a/tests/OfflineTests/NodeReaderMockTest.php b/tests/OfflineTests/NodeReaderMockTest.php index 3c7f7cc..372f47e 100644 --- a/tests/OfflineTests/NodeReaderMockTest.php +++ b/tests/OfflineTests/NodeReaderMockTest.php @@ -126,6 +126,15 @@ class NodeReaderMockTest extends \PHPUnit\Framework\TestCase { $this->assertEquals('coid://cloudobjects.io/Public', $object->getNode('co:isVisibleTo')->getId()); } + public function testConstants() { + $coid = new IRI('coid://cloudobjects.io'); + $this->useRootResourceMock(); + $object = $this->retriever->getCloudObject($coid); + + $this->assertEquals('6-fbea0c90b2c5e5300e4039ed99be9b2d', $object->getRevision()); + $this->assertEquals('CloudObjects', $object->getLabel()); + } + public function testGetAllValuesString1() { $coid = new IRI('coid://cloudobjects.io'); $this->useRootResourceMock();