Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion code/+openminds/@Collection/Collection.m
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function remove(obj, instance)
end

if obj.NumNodes > 0 && isKey(obj.Nodes, instanceId)
try
try
instanceType = class( obj.Nodes{instanceId} );
catch % < R2023a
instance = obj.Nodes(instanceId);
Expand Down
16 changes: 8 additions & 8 deletions code/+openminds/fromTypeName.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
%
% Syntax:
% instance = openminds.fromTypeName(typeNameIRI, identifier)
% Creates an instance of the class corresponding to the specified type
% Creates an instance of the class corresponding to the specified type
% name IRI using the provided identifier.
%
% Input Arguments:
% typeNameIRI (string) - The IRI representing the type name (must
% typeNameIRI (string) - The IRI representing the type name (must
% be a valid OpenMINDS IRI).
% instanceIdentifier (string) - Optional. An identifier (@id) of the instance
% to create.
%
% Output Arguments:
% instance - A blank metadata instance of the class corresponding to the
% instance - A blank metadata instance of the class corresponding to the
% given type name.
%
% Example:
% IRI = 'https://openminds.om-i.org/types/Person';
% openminds.fromTypeName(IRI)
%
% ans =
%
%
% ans =
%
% Person (https://openminds.om-i.org/types/Person) with properties:
%
%
% affiliation: [None] (Affiliation)
% alternateName: [1×0 string]
% associatedAccount: [None] (AccountInformation)
% contactInformation: [None] (ContactInformation)
% digitalIdentifier: [None] (ORCID)
% familyName: ""
% givenName: ""
%
%
% Required Properties: givenName

arguments
Expand Down
20 changes: 10 additions & 10 deletions code/+openminds/instanceFromIRI.m
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
function instance = instanceFromIRI(IRI)
% instanceFromIRI - Create an instance from an openMINDS IRI
%
%
% Syntax:
% instance = openminds.instanceFromIRI(IRI) Creates an instance based on the
% instance = openminds.instanceFromIRI(IRI) Creates an instance based on the
% provided openMINDS IRI.
%
%
% Input Arguments:
% IRI - A scalar string representing an openMINDS instance IRI.
%
%
% Output Arguments:
% instance - A metadata instance corresponding to the given IRI.
%
% Example:
%
%
% IRI = "https://openminds.ebrains.eu/instances/biologicalSex/male";
% instance = openminds.instanceFromIRI(IRI)
%
% instance =
%
%
% instance =
%
% BiologicalSex (https://openminds.om-i.org/types/BiologicalSex) with properties:
%
%
% definition: "Biological sex that produces sperm cells (spermatozoa)."
% description: "A male organism typically has the capacity to produce relatively small, usually mobile gametes (reproductive cells), called sperm cells (or spermatozoa). In the process of fertilization, these sperm cells fuse with a larger, usually immobile female gamete, called egg cell (or ovum)."
% interlexIdentifier: "http://uri.interlex.org/base/ilx_0106489"
% knowledgeSpaceLink: ""
% name: "male"
% preferredOntologyIdentifier: "http://purl.obolibrary.org/obo/PATO_0000384"
% synonym: [1×0 string]
%
%
% Required Properties: name

arguments
Expand Down
2 changes: 1 addition & 1 deletion code/+openminds/toolboxdir.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function folderPath = toolboxdir()
% Root folder for the openMINDS_MATLAB toolbox
%
% folderPath = openminds.toolboxdir() returns a character vector that is the
% folderPath = openminds.toolboxdir() returns a character vector that is the
% absolute path to the root of the toolbox folder

folderPath = fileparts(fileparts(mfilename('fullpath')));
Expand Down
12 changes: 6 additions & 6 deletions code/+openminds/version.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
% versionStr = openminds.version() returns the version string of the currently active
% version of the openMINDS metadata model
%
% openminds.version(versionSpec) changes the currently active version of the
% openminds.version(versionSpec) changes the currently active version of the
% openMINDS metadata model to the provided version
%
% Input Arguments:
% version (numeric or string) -
% The version number to set for the openMINDS metadata model. If this
% Input Arguments:
% version (numeric or string) -
% The version number to set for the openMINDS metadata model. If this
% argument is missing, the current version will be retrieved.
%
% Output Arguments:
% versionStr - A string representing the current or newly set version
% Output Arguments:
% versionStr - A string representing the current or newly set version
% of the openMINDS metadata model.

arguments
Expand Down
84 changes: 5 additions & 79 deletions code/internal/+openminds/+abstract/Schema.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,51 +99,6 @@
end
end

methods (Access = public, Hidden)

function tf = isPropertyWithLinkedType(obj, propertyName)
% Return true if property value is a linked type.
propertyNamesWithLinkedType = fieldnames(obj.LINKED_PROPERTIES);
tf = any( strcmp(propertyNamesWithLinkedType, propertyName) );
end

function linkedTypesForProperty = getLinkedTypesForProperty(obj, propertyName)
% Return linked types that are allowed for given property.
if obj.isPropertyWithLinkedType(propertyName)
linkedTypesForProperty = obj.LINKED_PROPERTIES.(propertyName);
else
error('Property %s does not have linked types', propertyName);
end
end

function tf = isLinkedTypeOfProperty(obj, type)
%isLinkedTypeOfProperty ???
tf = false;

propertyNames = fieldnames( obj.LINKED_PROPERTIES );

for i = 1:numel(propertyNames)
types = obj.LINKED_PROPERTIES.(propertyNames{i});

for j = 1:numel(types)
thisType = types{j};

tf = strcmp(thisType, type);
if tf; return; end

thisTypeSplit = strsplit(thisType, '/');
tf = strcmp(thisTypeSplit{end}, type);
if tf; return; end
end
end
end

function propertyName = linkedTypeOfProperty(obj, type)
% Get property name which can be linked to given type
propertyName = obj.linkedTypeOfPropertyStatic(type, obj.LINKED_PROPERTIES);
end
end

methods (Hidden) % Todo: remove?
function str = char(obj)
str = obj.getDisplayLabel();
Expand Down Expand Up @@ -172,11 +127,11 @@
propName = subs(1).subs;
className = class(obj.(propName));

% Get the actual instance from a linkset subclass.
% Get the actual instance from a MixedTypeSet subclass.
if contains(className, 'openminds.internal.mixedtype')
try
% Place the openMINDS instance object in a linkset
% wrapper class
% Place the openMINDS instance object in a
% MixedTypeSet wrapper class
classFcn = str2func(className);
value = classFcn(value);
catch MECause
Expand Down Expand Up @@ -440,7 +395,7 @@
% if strcmp(s(1).type, '.') && strcmp(s(2).type, '()')
% %linkedTypeValues = builtin('subsref', obj, s(1:2));
% linkedTypeValues = obj.subsref(s(1:2));
%
%
% elseif strcmp(s(1).type, '.')
% linkedTypeValues = builtin('subsref', obj, s(1));
% end
Expand Down Expand Up @@ -569,7 +524,7 @@ function assignInstanceId(obj, id)
end
end

methods (Access = protected)
methods (Access = protected) % Methods related to object display
function displayLabel = getDisplayLabel(obj)
%schemaShortName = obj.getSchemaShortName(class(obj));

Expand Down Expand Up @@ -615,35 +570,6 @@ function assignInstanceId(obj, id)
shortSchemaName = getSchemaName(fullSchemaName);
end
end

methods (Static, Hidden)

function propertyName = linkedTypeOfPropertyStatic(type, linkedTypeProperties)
propertyName = "";
propertyNamesWithLinkedType = fieldnames( linkedTypeProperties );

for i = 1:numel(propertyNamesWithLinkedType)
types = linkedTypeProperties.(propertyNamesWithLinkedType{i});

for j = 1:numel(types)
thisType = types{j};

tf = strcmp(thisType, type);
if tf
propertyName = propertyNamesWithLinkedType{i};
return
end

thisTypeSplit = strsplit(thisType, '/');
tf = strcmp(thisTypeSplit{end}, type);
if tf
propertyName = propertyNamesWithLinkedType{i};
return
end
end
end
end
end
end

function x = row(x)
Expand Down
26 changes: 13 additions & 13 deletions code/internal/+openminds/+base/TypesEnumerationBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,25 @@
% fromClassName - Get a Type enum from a class name
%
% Syntax:
% typeEnum = openminds.enum.Types.fromClassName(className) Converts
% typeEnum = openminds.enum.Types.fromClassName(className) Converts
% the provided class name(s) into the appropriate enumeration value (s).
%
% Input Arguments:
% className - A string array representing the class name(s) to be
% converted.
%
% Output Arguments:
% typeEnum - The corresponding enumeration value(s) from
% typeEnum - The corresponding enumeration value(s) from
% openminds.enum.Types.
%
% Example:
%
% openminds.enum.Types.fromClassName("openminds.core.Person")
%
% ans =
%
%
% ans =
%
% Types enumeration
%
%
% Person

arguments
Expand All @@ -107,26 +107,26 @@
% fromAtType - Convert an @type string to its corresponding enumeration.
%
% Syntax:
% typeEnum = openminds.enum.Types.fromAtType(typeName) Converts the
% typeEnum = openminds.enum.Types.fromAtType(typeName) Converts the
% provided @type string into the appropriate enumeration value.
%
% Input Arguments:
% typeName - A string array representing the @type to be converted.
% The @type URI is expected to match Base URI for the
% The @type URI is expected to match Base URI for the
% currently active openMINDS version
%
% Output Arguments:
% typeEnum - The corresponding enumeration value(s) from
% typeEnum - The corresponding enumeration value(s) from
% openminds.enum.Types.
%
% Example:
%
% openminds.enum.Types.fromAtType("https://openminds.om-i.org/types/Person")
%
% ans =
%
%
% ans =
%
% Types enumeration
%
%
% Person

arguments
Expand Down
4 changes: 2 additions & 2 deletions code/internal/+openminds/+constant/BaseURI.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
%
% baseURI = openminds.constant.BaseURI(version) returns the base URI as a
% string that corresponds to the base resource identifier for the specified
% OpenMINDS model version. This function dynamically selects the URI based on
% the version input. If no version is specified, the version number of the
% OpenMINDS model version. This function dynamically selects the URI based on
% the version input. If no version is specified, the version number of the
% currently active openMINDS model is selected.
%
% Input:
Expand Down
Loading
Loading