From 3f843be18673ee5f2f88397ccb13028c7b4ba579 Mon Sep 17 00:00:00 2001 From: Angelo Veltens Date: Thu, 25 Jul 2024 19:45:26 +0200 Subject: [PATCH] rdflib-utils: add documentation --- utils/rdflib/CHANGELOG.md | 36 +++++++++++++++--------- utils/rdflib/src/index.ts | 6 ++++ utils/rdflib/src/module/ModuleSupport.ts | 5 ++++ 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/utils/rdflib/CHANGELOG.md b/utils/rdflib/CHANGELOG.md index 23dcc820..1fbc4840 100644 --- a/utils/rdflib/CHANGELOG.md +++ b/utils/rdflib/CHANGELOG.md @@ -2,7 +2,15 @@ All notable changes to this module 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). +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 + +### Added + +- [discoverType](https://solid-contrib.github.io/data-modules/rdflib-utils/classes/index.ModuleSupport.html#discoverType) ## 0.2.0 @@ -11,16 +19,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - [ModuleSupport](https://solid-contrib.github.io/data-modules/rdflib-utils/classes/index.ModuleSupport.html) - [TypeIndexQuery](https://solid-contrib.github.io/data-modules/rdflib-utils/classes/index.TypeIndexQuery.html) - [addInstanceToTypeIndex](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.addInstanceToTypeIndex.html) -- helper functions to generate terms in common Solid namespaces: - - [ldp](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.ldp.html) - - [pim](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.pim.html) - - [rdf](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.rdf.html) - - [solid](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.solid.html) +- helper functions to generate terms in common Solid namespaces: + - [ldp](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.ldp.html) + - [pim](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.pim.html) + - [rdf](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.rdf.html) + - [solid](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.solid.html) ### Breaking Change -- [generateId](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/identifier.generateId.html): Moved to submodule - +- [generateId](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/identifier.generateId.html): + Moved to submodule ## 0.1.1 @@ -37,9 +45,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - [fetchNode](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.fetchNode.html) - [generateId](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/index.generateId.html) - [test-support](https://solid-contrib.github.io/data-modules/rdflib-utils/modules/test_support.html): - - [expectPatchRequest](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.expectPatchRequest.html) - - [expectPutEmptyTurtleFile](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.expectPutEmptyTurtleFile.html) - - [mockForbidden](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.mockForbidden.html) - - [mockLdpContainer](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.mockLdpContainer.html) - - [mockNotFound](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.mockNotFound.html) - - [mockTurtleDocument](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.mockTurtleDocument.html) \ No newline at end of file + - [expectPatchRequest](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.expectPatchRequest.html) + - [expectPutEmptyTurtleFile](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.expectPutEmptyTurtleFile.html) + - [mockForbidden](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.mockForbidden.html) + - [mockLdpContainer](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.mockLdpContainer.html) + - [mockNotFound](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.mockNotFound.html) + - [mockTurtleDocument](https://solid-contrib.github.io/data-modules/rdflib-utils/functions/test_support.mockTurtleDocument.html) diff --git a/utils/rdflib/src/index.ts b/utils/rdflib/src/index.ts index b4975581..243916a6 100644 --- a/utils/rdflib/src/index.ts +++ b/utils/rdflib/src/index.ts @@ -12,11 +12,17 @@ export interface ModuleConfig { updater: UpdateManager; } +/** + * Lists instances and containers found in a type index + */ export interface TypeRegistrations { instanceContainers: NamedNode[]; instances: NamedNode[]; } +/** + * Type registrations grouped by whether they have been discovered in private or public type index. + */ export interface TypeRegistrationsByVisibility { public: TypeRegistrations; private: TypeRegistrations; diff --git a/utils/rdflib/src/module/ModuleSupport.ts b/utils/rdflib/src/module/ModuleSupport.ts index 14aad3e1..b80d58a7 100644 --- a/utils/rdflib/src/module/ModuleSupport.ts +++ b/utils/rdflib/src/module/ModuleSupport.ts @@ -39,6 +39,11 @@ export class ModuleSupport { return Promise.all(nodes.map((it) => this.fetchNode(it))); } + /** + * Discover storage locations (instances or instance containers) for a given type by fetching and querying private and public type indexes + * @param webId - The WebID to search for type indexes + * @param typeNode - a NamedNode representing the type to discover + */ async discoverType( webId: NamedNode, typeNode: NamedNode,