-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstanceFromIRI.m
More file actions
45 lines (42 loc) · 1.73 KB
/
instanceFromIRI.m
File metadata and controls
45 lines (42 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function instance = instanceFromIRI(IRI)
% instanceFromIRI - Create an instance from an openMINDS IRI
%
% Syntax:
% 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 =
%
% 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
IRI (1,1) string {openminds.mustBeValidOpenMINDSIRI}
end
[typeEnum, instanceName] = openminds.utility.parseInstanceIRI(IRI);
if contains(typeEnum.ClassName, "controlledterms")
instance = feval(typeEnum.ClassName, IRI);
else
fcnStr = sprintf('%s.fromName', typeEnum.ClassName);
instance = feval(fcnStr, instanceName);
end
end