-
Notifications
You must be signed in to change notification settings - Fork 0
/
urn_components.jl
59 lines (51 loc) · 1 KB
/
urn_components.jl
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
$(SIGNATURES)
Extract CITE2 namespace from a CtsUrn.
# Examples
```julia-repl
julia>
namespace(Cite2Urn("urn:cite2:hmt:msA.v1:12r"))
```
"""
function namespace(u::Cite2Urn)
allcomponents = components(u.urn)
allcomponents[3]
end
"""
$(SIGNATURES)
Extract CITE2 work component from a CtsUrn.
# Examples
```julia-repl
julia>
collectioncomponent(Cite2Urn("urn:cite2:hmt:msA.v1:12r"))
```
"""
function collectioncomponent(u::Cite2Urn)
allcomponents = components(u.urn)
allcomponents[4]
end
"""
$(SIGNATURES)
Extract CITE2 object component from a CtsUrn.
# Examples
```julia-repl
julia>
objectcomponent(Cite2Urn("urn:cite2:hmt:msA.v1:12r"))
```
"""
function objectcomponent(u::Cite2Urn)
allcomponents = components(u.urn)
if allcomponents[5] == ""
nothing
else
allcomponents[5]
end
end
"""
$(SIGNATURES)
Extract parts ofr CITE2 object component from a CtsUrn.
"""
function collectionparts(u::Cite2Urn)
component = collectioncomponent(u)
split(component, ".")
end