diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c358ee4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0-alpha2] - 2023-07-31 + +### Added + +- Add a method to set a prefix. +- Add this changelog file. + +## [1.0.0-alpha1] - 2023-07-28 + +- Initial release. + +[unreleased]: https://github.com/assemblee-virtuelle/semantizer-php/compare/v1.0.0-alpha2...HEAD +[1.0.0-alpha2]: https://github.com/assemblee-virtuelle/semantizer-php/compare/v1.0.0-alpha1...v1.0.0-alpha2 +[1.0.0-alpha1]: https://github.com/assemblee-virtuelle/semantizer-php/releases/tag/v1.0.0-alpha1 diff --git a/composer.json b/composer.json index d58067d..4f19bc4 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "virtual-assembly/semantizer", "type": "library", - "version": "1.0.0-alpha1", + "version": "1.0.0-alpha2", "description": "A library to enhance your object model with semantic data.", "keywords": ["semantic web","rdf","object model"], "homepage": "https://github.com/assemblee-virtuelle/semantizer-php", diff --git a/src/Semantizer.php b/src/Semantizer.php index 5b6869d..8aa19b3 100644 --- a/src/Semantizer.php +++ b/src/Semantizer.php @@ -41,6 +41,10 @@ public function fetch(string $semanticObjectId): Semanticable { return $this->store->get($semanticObjectId); } + public function setPrefix(string $prefix, string $uri): void { + \EasyRdf\RdfNamespace::set($prefix, $uri); + } + public function store(Semanticable $semanticable): void { $this->store->set($semanticable); } diff --git a/tests/SemantizerTest.php b/tests/SemantizerTest.php index 978fe73..9a07d79 100644 --- a/tests/SemantizerTest.php +++ b/tests/SemantizerTest.php @@ -7,7 +7,7 @@ final class SemantizerTest extends TestCase { public function testExport(): void { $semantizer = new Semantizer(); - \EasyRdf\RdfNamespace::set("dfc", "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#"); + $semantizer->setPrefix("dfc", "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#"); $context = ["https://www.datafoodconsortium.org"];