Skip to content

Commit

Permalink
Clean whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ehennestad committed Nov 15, 2024
1 parent c10c916 commit 393b865
Show file tree
Hide file tree
Showing 37 changed files with 99 additions and 114 deletions.
9 changes: 4 additions & 5 deletions code/+openminds/@Collection/Collection.m
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function updateLinks(obj)
obj openminds.Collection
savePath (1,1) string
options.SaveToSingleFile (1,1) logical = true
%options.IncludeEmptyProperties (1,1) logical = false
% options.IncludeEmptyProperties (1,1) logical = false
end

% Update links before saving
Expand Down Expand Up @@ -336,12 +336,11 @@ function load(obj, filePath)%, options)
outputPaths = saveInstances(instance, filePath, options)

instances = loadInstances(filePath)

end

methods (Access = protected)

%Add an instance to the Node container.
% Add an instance to the Node container.
function addNode(obj, instance, options)

arguments
Expand All @@ -362,7 +361,7 @@ function addNode(obj, instance, options)

if isConfigured(obj.Nodes)
if isKey(obj.Nodes, instance.id)
%warning('Node with id %s already exists in collection', instance.id)
% warning('Node with id %s already exists in collection', instance.id)
if options.AbortIfNodeExists
return
end
Expand All @@ -389,7 +388,7 @@ function addNode(obj, instance, options)
obj.addSubNodes(instance)
end

%Add sub node instances (linked types) to the Node container.
% Add sub node instances (linked types) to the Node container.
function addSubNodes(obj, instance)
% Add links.
linkedTypes = instance.getLinkedTypes();
Expand Down
4 changes: 2 additions & 2 deletions code/+openminds/@Collection/loadInstances.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

arguments
filePath (1,:) string = ""
%options.RecursionDepth = 1
% options.RecursionDepth = 1
end

import openminds.internal.serializer.JsonLdSerializer
Expand Down Expand Up @@ -39,7 +39,7 @@

if ~isfield(thisInstance, 'at_type')
continue % Todo: Why skip?
%instances{i} = struct('id', thisInstance.at_id);
% instances{i} = struct('id', thisInstance.at_id);
else
openMindsType = thisInstance.at_type;
className = openminds.internal.utility.string.type2class(openMindsType);
Expand Down
2 changes: 1 addition & 1 deletion code/internal/+openminds/+abstract/ControlledTerm.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function deserializeFromName(obj, instanceName)
end
else
error('No matching instances were found for name "%s"', instanceName)
%error('Deserialization from user instance is not implemented yet')
% error('Deserialization from user instance is not implemented yet')
end
propNames = {'at_id', 'name', 'definition', 'description', 'interlexIdentifier', 'knowledgeSpaceLink', 'preferredOntologyIdentifier', 'synonym'};

Expand Down
12 changes: 6 additions & 6 deletions code/internal/+openminds/+abstract/Schema.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
classdef Schema < handle & openminds.internal.extern.uiw.mixin.AssignPVPairs & ...
openminds.internal.mixin.CustomInstanceDisplay & openminds.internal.mixin.StructAdapter
%Schema Abstract base class shared by all concrete Schema classes
% Schema Abstract base class shared by all concrete Schema classes

% Todo:
% [ ] Validate schema. I.e are all required variables filled out
Expand Down Expand Up @@ -226,7 +226,7 @@

elseif numel(subs) > 1 && strcmp(subs(2).type, '()')
try
%linkedObj = obj.subsref(subs(1:2));
% linkedObj = obj.subsref(subs(1:2));
obj = builtin('subsasgn', obj, subs, value);

catch MECause
Expand Down Expand Up @@ -254,7 +254,7 @@
error(errorStruct)
end

%obj.subsasgn(subs, value);
% obj.subsasgn(subs, value);
otherwise
ME = MException('OPENMINDS_MATLAB:UnhandledIndexAssignment', ...
'Unhandled index assignment, please report');
Expand Down Expand Up @@ -302,7 +302,7 @@
if obj.isSubsForPublicPropertyValue(subs)
evtData = PropertyValueChangedEventData(value, oldValue, false); % false for unlinked prop
obj.notify('InstanceChanged', evtData)
%fprintf('Set unlinked property of %s\n', class(obj))
% fprintf('Set unlinked property of %s\n', class(obj))
end
end
end
Expand Down Expand Up @@ -370,7 +370,7 @@
if numel(subs) > 1
% Todo: Remove as this appears to be unused
if strcmp( subs(2).type, '()' ) && iscell(values)
%subs(2).type = '{}';
% subs(2).type = '{}';
end

if numOutputs > 0
Expand Down Expand Up @@ -569,7 +569,7 @@ function assignInstanceId(obj, id)

import openminds.internal.utility.getSchemaDocLink

%annotation = obj.getSchemaShortName(class(obj));
% annotation = obj.getSchemaShortName(class(obj));
annotation = getSchemaDocLink( class(obj) );
end

Expand Down
14 changes: 7 additions & 7 deletions code/internal/+openminds/+constant/BaseURI.m
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
function baseURI = BaseURI(version)
% BaseURI Get the base URI for the specified OpenMINDS schema version
%
% baseURI = openminds.constant.BaseURI(version) returns the base URI as a
% string that corresponds to the specified OpenMINDS schema version. This
% function dynamically selects the URI based on the version input. If no
% version is specified, the version number for the active openMINDS version
% baseURI = openminds.constant.BaseURI(version) returns the base URI as a
% string that corresponds to the specified OpenMINDS schema version. This
% function dynamically selects the URI based on the version input. If no
% version is specified, the version number for the active openMINDS version
% is selected.
%
% Input:
% version - (optional) An instance of openminds.internal.utility.VersionNumber
% specifying the schema version. If no version is provided,
% the function automatically retrieves the current schema
% version - (optional) An instance of openminds.internal.utility.VersionNumber
% specifying the schema version. If no version is provided,
% the function automatically retrieves the current schema
% version using openminds.getSchemaVersion.
%
% Output:
Expand Down
4 changes: 2 additions & 2 deletions code/internal/+openminds/+constant/LATEST_VERSION.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
function str = LATEST_VERSION()
str = "4.0";
end
str = "4.0";

Check warning on line 2 in code/internal/+openminds/+constant/LATEST_VERSION.m

View check run for this annotation

Codecov / codecov/patch

code/internal/+openminds/+constant/LATEST_VERSION.m#L2

Added line #L2 was not covered by tests
end
10 changes: 5 additions & 5 deletions code/internal/+openminds/+internal/+abstract/LinkedCategory.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@

% Todo: Consider indicating that the array has mixed types,
% i.e is heterogeneous-like...
%docLinkStr = sprintf('1x%d heterogeneous %s', numel(obj), docLinkStr);
% docLinkStr = sprintf('1x%d heterogeneous %s', numel(obj), docLinkStr);

docLinkStr = sprintf('1x%d %s', numel(obj), docLinkStr);
if isempty(obj)
Expand Down Expand Up @@ -234,8 +234,8 @@ function displayNonScalarObject(obj)
stringArray = strjoin( arrayfun(@(o) o.Instance.id, obj, 'UniformOutput', false), newline);
else
repArray = arrayfun(@(o) o.Instance.compactRepresentationForSingleLine, obj, 'UniformOutput', false);
%stringArray = cellfun(@(r) r.Representation, repArray);
%rep = fullDataRepresentation(obj, displayConfiguration, 'StringArray', stringArray, 'Annotation', annotation');
% stringArray = cellfun(@(r) r.Representation, repArray);
% rep = fullDataRepresentation(obj, displayConfiguration, 'StringArray', stringArray, 'Annotation', annotation');
stringArray = cellfun(@(r) " "+ r.PaddedDisplayOutput, repArray);
stringArray = strrep(stringArray, '[', '');
stringArray = strrep(stringArray, ']', '');
Expand All @@ -252,8 +252,8 @@ function displayNonScalarObject(obj)

function stringArray = getStringArrayForSingleLine(obj)
repArray = arrayfun(@(o) o.Instance.compactRepresentationForSingleLine, obj, 'UniformOutput', false);
%stringArray = cellfun(@(r) r.Representation, repArray);
%rep = fullDataRepresentation(obj, displayConfiguration, 'StringArray', stringArray, 'Annotation', annotation');
% stringArray = cellfun(@(r) r.Representation, repArray);
% rep = fullDataRepresentation(obj, displayConfiguration, 'StringArray', stringArray, 'Annotation', annotation');

stringArray = cellfun(@(r) r.PaddedDisplayOutput, repArray);
stringArray = strrep(stringArray, '[', '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function delete(obj)

function set.Direction(obj, dir)
obj.Direction = dir;
%fprintf('Direction set: %s\n', obj.Direction)
% fprintf('Direction set: %s\n', obj.Direction)
end

function set.Value(obj, value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function saveClassdef(obj)
fwrite(fid, obj.ClassDefText);
fclose(fid);

%fprintf('Saved class definition for %s to:\n"%s"\n', obj.ClassName, filePath)
% fprintf('Saved class definition for %s to:\n"%s"\n', obj.ClassName, filePath)
end

function appendLine(obj, numIndent, str)
Expand Down Expand Up @@ -319,7 +319,7 @@ function startFunctionBlock(obj, functionName, options)
function endFunctionBlock(obj)
numIndent = 2;
obj.appendLine(numIndent, "end");
%obj.appendLine(numIndent, ""); % Add empty line
% obj.appendLine(numIndent, ""); % Add empty line
obj.CurrentStep = "methods";
end
end
Expand Down
34 changes: 15 additions & 19 deletions code/internal/+openminds/+internal/+generator/SchemaTranslator.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

obj.saveClassdef()

%obj.saveAlias()
% obj.saveAlias()

if ~nargout
clear obj
Expand Down Expand Up @@ -225,7 +225,7 @@ function assignOutputFile(obj)
function saveAlias(obj)
filePath = obj.getAliasFilePath();

%fullClassName = obj.getFullClassName();
% fullClassName = obj.getFullClassName();
fullClassNameSimple = obj.getFullClassName("simple");

folderPath = fullfile( openminds.internal.rootpath, 'internal', 'resources', 'templates' );
Expand All @@ -240,7 +240,6 @@ function saveAlias(obj)
fid = fopen(filePath, 'w');
fwrite(fid, str);
fclose(fid);

end
end

Expand Down Expand Up @@ -447,11 +446,10 @@ function writeLinkedPropertyBlock(obj)
obj.appendLine(3, sprintf("'%s', {%s}%s", keyName, linkedTypesStr, lineBreak))
end
obj.appendLine(2, ')')

end

obj.endPropertyBlock()
%obj.writeLinkedPropertyBlo
% obj.writeLinkedPropertyBlo
end

function writeSchemaProperties(obj)
Expand All @@ -468,7 +466,6 @@ function writeSchemaProperties(obj)
end
obj.endPropertyBlock()
else

end
end

Expand Down Expand Up @@ -573,18 +570,18 @@ function addSchemaProperty(obj, propertyName, propertyAttributes)
elseif numel(clsNames) == 1
dataType = clsNames{1};
else
%dataType = 'cell';
%validationFcnStr(end+1) = obj.getMultiTypeValidationFunctionString(propertyName, clsNames);
% dataType = 'cell';
% validationFcnStr(end+1) = obj.getMultiTypeValidationFunctionString(propertyName, clsNames);

dataType = createPropertyLinksetClass(obj.SchemaName, propertyName, clsNames, allowMultiple);

%dataType = clsNames{1};
%warning('Multiple schemas allowed for property %s of schema %s', propertyName, obj.SchemaName)
% dataType = clsNames{1};
% warning('Multiple schemas allowed for property %s of schema %s', propertyName, obj.SchemaName)
end

elseif isfield(propertyAttributes, 'x_linkedCategories')
clsNames = cellfun(@(str) openminds.internal.utility.string.buildClassName(str, '', 'category'), propertyAttributes.x_linkedCategories, 'UniformOutput', false);
%dataType = sprintf('{%s}', strjoin(clsNames, ', '));
% dataType = sprintf('{%s}', strjoin(clsNames, ', '));
attributeNames = setdiff(attributeNames, 'x_linkedCategories');
dataType = clsNames{1};
if numel(clsNames) > 1
Expand All @@ -600,7 +597,6 @@ function addSchemaProperty(obj, propertyName, propertyAttributes)
dataType = itemDef.type;
itemFields = setdiff(itemFields, 'type');
else

end
% Todo: note: item is a nested attribute field....
if ~isempty(itemFields)
Expand Down Expand Up @@ -679,7 +675,7 @@ function addSchemaProperty(obj, propertyName, propertyAttributes)
end
case 'description'
% str = propertyAttributes.description;
%disp(['description: ', str])
% disp(['description: ', str])
otherwise
disp(['additional attributenames: ', attributeNames])
end
Expand All @@ -689,19 +685,19 @@ function addSchemaProperty(obj, propertyName, propertyAttributes)
if isempty(validationFcnStr)
obj.addProperty(propertyName, 'Size', sizeAttribute, ...
'Type', dataType)
%newStr = sprintf('%s %s %s', propertyName, sizeAttribute, dataType);
% newStr = sprintf('%s %s %s', propertyName, sizeAttribute, dataType);
else

validationFcnStr = sprintf("{%s}", strjoin(validationFcnStr, ", "));

obj.addProperty(propertyName, 'Size', sizeAttribute, ...
'Type', dataType, 'Validator', validationFcnStr)
%newStr = sprintf('%s %s %s %s', propertyName, sizeAttribute, dataType, validationFcnStr);
% newStr = sprintf('%s %s %s %s', propertyName, sizeAttribute, dataType, validationFcnStr);
end

%newStr = obj.indentLine(newStr, 2);
%obj.appendLine(newStr)
%obj.appendLine('')
% newStr = obj.indentLine(newStr, 2);
% obj.appendLine(newStr)
% obj.appendLine('')
end
end

Expand Down Expand Up @@ -841,7 +837,7 @@ function writeEnumSwitchBlock(obj)
end

obj.appendLine(4, "")
%obj.writeEmptyLine()
% obj.writeEmptyLine()
end
obj.appendLine(3, 'end')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ function downloadSchemas(versionNumber)
delete(tempPath)

% Save the current commit ID
%openminds.internal.utility.git.saveCurrentSchemaCommitID()
% openminds.internal.utility.git.saveCurrentSchemaCommitID()
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
tempsavepath = tempname;
tempsavepath = [tempsavepath, '.mat'];

%disp(tempsavepath)
% disp(tempsavepath)
cleanupObj = onCleanup(@(filepath)delete(tempsavepath));

count = 0;
Expand All @@ -36,22 +36,22 @@
S.(iSchemaName).propertyName = "lookupLabel";
S.(iSchemaName).stringFormat = "sprintf('%s', lookupLabel)";

%pass
% pass
elseif isprop(itemPreSave, 'fullName')
S.(iSchemaName).propertyName = 'fullName';
S.(iSchemaName).stringFormat = "sprintf('%s', fullName)";

%pass
% pass
elseif isprop(itemPreSave, 'identifier')
S.(iSchemaName).propertyName = 'identifier';
S.(iSchemaName).stringFormat = "sprintf('%s', identifier)";

%pass
% pass
elseif isprop(itemPreSave, 'name')
S.(iSchemaName).propertyName = 'name';
S.(iSchemaName).stringFormat = "sprintf('%s', name)";

%pass
% pass
else

S.(iSchemaName).propertyName = '';
Expand All @@ -63,10 +63,9 @@
catch ME
fprintf('Could not create schema %s due to error:\n%s\n', ...
iSchemaName, ME.message)

end
end

%T = cell2table(C, 'VariableNames', {'SchemaName', 'Failure point', 'Error Message', 'Extended Error'});
%fprintf('Number of tests that failed: %d/%d\n', numTestsFailed, numTestsTotal)
% T = cell2table(C, 'VariableNames', {'SchemaName', 'Failure point', 'Error Message', 'Extended Error'});
% fprintf('Number of tests that failed: %d/%d\n', numTestsFailed, numTestsTotal)
end
Loading

0 comments on commit 393b865

Please sign in to comment.