Skip to content
Open
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
5 changes: 1 addition & 4 deletions code/+openminds/@Collection/Collection.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@
end

properties (SetAccess = protected)
LinkResolver

% MetadataStore - Optional metadata store for saving/loading
MetadataStore openminds.interface.MetadataStore = openminds.internal.FileMetadataStore.empty
end
Expand Down Expand Up @@ -114,7 +112,6 @@
arguments
options.Name (1,1) string = ""
options.Description (1,1) string = ""
options.LinkResolver (1,:) = []
options.MetadataStore openminds.interface.MetadataStore = openminds.internal.FileMetadataStore.empty
end

Expand Down Expand Up @@ -385,7 +382,7 @@ function updateLinks(obj)
outputPaths = tempStore.save(instances);

elseif ~isempty(options.MetadataStore)
outputPaths = obj.MetadataStore.save(instances);
outputPaths = options.MetadataStore.save(instances);

elseif ~isempty(obj.MetadataStore)
% Use configured store
Expand Down
17 changes: 17 additions & 0 deletions tools/tests/unitTests/CollectionTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,23 @@ function testSaveAndLoad(testCase)
testCase.verifyTrue(newCollection.isKey(org.id));
end

function testSaveWithMetadataStoreOption(testCase)
% A store passed to save by name-value must be the store used.
% This went through obj.MetadataStore instead, which is empty
% unless the collection was constructed with one.

personInstance = openminds.core.Person('givenName', "Store");
collection = openminds.Collection(personInstance);

filePath = fullfile(pwd, "via-option.jsonld"); % WorkingFolderFixture cwd
fileStore = openminds.internal.FileMetadataStore(filePath);

collection.save("", "MetadataStore", fileStore);

testCase.verifyTrue(isfile(filePath), ...
'The store passed by name-value should have been used to save.')
end

function testSaveToMultipleFiles(testCase)
% Test saving a collection to multiple files
collection = openminds.Collection();
Expand Down
Loading