linked_research_metadata 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09fb2c4a097df4a9c607c75f7ec3dcfbb3f74108
|
4
|
+
data.tar.gz: 0b4632b0da51c220b5a11f74055966fb1cd282dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5fca99bc0c6beaf8a33aba4f426c2975245eb9a4a53708052bf1903fb6343eda2142e4399db8be84c876c411ca2f8ffa4c3651971b2cadc2fd9e8d5c24e65af
|
7
|
+
data.tar.gz: ec48b1aa65477f340487a9739d2da7fae4c59766f337f4fe3b62774dd3cef4be34e07ab89845a5a6fa9374666b88672f696ba454f2f8e70c356ba0fa14828dce
|
data/CHANGELOG.md
CHANGED
@@ -23,7 +23,7 @@ module LinkedResearchMetadata
|
|
23
23
|
@resource = dataset_extractor.find uuid: uuid
|
24
24
|
raise 'No metadata for ' + uuid if !@resource
|
25
25
|
dataset_uri = mint_uri uuid, :dataset
|
26
|
-
@resource_uri = RDF::URI.new
|
26
|
+
@resource_uri = RDF::URI.new(dataset_uri)
|
27
27
|
build_graph
|
28
28
|
@graph
|
29
29
|
end
|
@@ -31,14 +31,14 @@ module LinkedResearchMetadata
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def meta
|
34
|
-
|
34
|
+
add_triple @resource_uri, RDF.type, RDF::URI.new("#{vocab(:vivo)}Dataset")
|
35
35
|
end
|
36
36
|
|
37
37
|
def available
|
38
38
|
object = @resource.available
|
39
39
|
if object
|
40
40
|
object_literal = RDF::Literal.new(object.strftime("%F"), datatype: RDF::XSD.date)
|
41
|
-
|
41
|
+
add_triple @resource_uri, RDF::Vocab::DC.available, object_literal
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -46,98 +46,99 @@ module LinkedResearchMetadata
|
|
46
46
|
object = @resource.created
|
47
47
|
if object
|
48
48
|
object_literal = RDF::Literal.new(object.strftime("%F"), datatype: RDF::XSD.date)
|
49
|
-
|
49
|
+
add_triple @resource_uri, RDF::Vocab::DC.created, object_literal
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
def doi
|
54
54
|
if @resource.doi
|
55
|
-
doi_uri = RDF::URI.new
|
55
|
+
doi_uri = RDF::URI.new(@resource.doi)
|
56
56
|
doi_predicate_uri = RDF::Vocab::DC.identifier
|
57
|
-
|
57
|
+
add_triple @resource_uri, doi_predicate_uri, doi_uri
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
def description
|
62
62
|
object = @resource.description
|
63
63
|
if object
|
64
|
-
|
64
|
+
object.tr!('\\','') # remove any backslashes
|
65
|
+
add_triple @resource_uri, RDF::Vocab::DC.description, object
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
69
|
def files
|
69
70
|
@resource.files.each do |i|
|
70
|
-
file_uri = RDF::URI.new
|
71
|
+
file_uri = RDF::URI.new(mint_uri(SecureRandom.uuid, :file))
|
71
72
|
|
72
|
-
|
73
|
+
add_triple @resource_uri, RDF::Vocab::DC.hasPart, file_uri
|
73
74
|
|
74
75
|
# license
|
75
76
|
if i.license && i.license.url
|
76
|
-
uri = RDF::URI.new
|
77
|
-
|
77
|
+
uri = RDF::URI.new(i.license.url)
|
78
|
+
add_triple file_uri, RDF::Vocab::DC.license, uri
|
78
79
|
end
|
79
80
|
|
80
81
|
# mime
|
81
|
-
|
82
|
+
add_triple file_uri, RDF::Vocab::DC.format, i.mime
|
82
83
|
|
83
84
|
# size
|
84
85
|
size_predicate = RDF::Vocab::DC.extent
|
85
|
-
|
86
|
+
add_triple file_uri, size_predicate, i.size
|
86
87
|
|
87
88
|
#name
|
88
|
-
|
89
|
+
add_triple file_uri, RDF::Vocab::DC.title, i.name
|
89
90
|
|
90
91
|
#type
|
91
|
-
|
92
|
+
add_triple file_uri, RDF.type, RDF::Vocab::PREMIS.File
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
95
96
|
def keywords
|
96
97
|
@resource.keywords.each do |i|
|
97
|
-
|
98
|
+
add_triple @resource_uri, RDF::Vocab::DC.subject, i
|
98
99
|
end
|
99
100
|
end
|
100
101
|
|
101
102
|
def person(person_uri, uuid, name)
|
102
|
-
|
103
|
-
|
103
|
+
add_triple person_uri, RDF.type, RDF::Vocab::FOAF.Person
|
104
|
+
add_triple person_uri, RDF::Vocab::FOAF.name, name
|
104
105
|
person_extractor = Puree::Extractor::Person.new @config
|
105
106
|
person = person_extractor.find uuid: uuid
|
106
107
|
if person
|
107
108
|
person.affiliations.each do |i|
|
108
|
-
organisation_uri = RDF::URI.new
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
organisation_uri = RDF::URI.new(mint_uri(i.uuid, :organisation))
|
110
|
+
add_triple person_uri, RDF::Vocab::MADS.hasAffiliation, organisation_uri
|
111
|
+
add_triple organisation_uri, RDF::Vocab::DC.title, i.name
|
112
|
+
add_triple organisation_uri, RDF.type, RDF::Vocab::FOAF.Organization
|
112
113
|
end
|
113
114
|
if person.orcid
|
114
|
-
orcid_uri = RDF::URI.new
|
115
|
-
orcid_predicate_uri = RDF::URI.new
|
116
|
-
|
115
|
+
orcid_uri = RDF::URI.new("http://orcid.org/#{person.orcid}")
|
116
|
+
orcid_predicate_uri = RDF::URI.new("#{vocab(:vivo)}OrcidId")
|
117
|
+
add_triple person_uri, orcid_predicate_uri, orcid_uri
|
117
118
|
end
|
118
119
|
end
|
119
120
|
end
|
120
121
|
|
121
122
|
def projects
|
122
123
|
@resource.projects.each do |i|
|
123
|
-
project_uri = RDF::URI.new
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
project_uri = RDF::URI.new(mint_uri(i.uuid, :project))
|
125
|
+
add_triple @resource_uri, RDF::Vocab::DC.relation, project_uri
|
126
|
+
add_triple project_uri, RDF::Vocab::DC.title, i.title
|
127
|
+
add_triple project_uri, RDF.type, RDF::URI.new("#{vocab(:vivo)}Project")
|
127
128
|
end
|
128
129
|
end
|
129
130
|
|
130
131
|
def publications
|
131
132
|
@resource.publications.each do |i|
|
132
133
|
if i.type == 'Dataset'
|
133
|
-
publication_uri = RDF::URI.new
|
134
|
-
|
134
|
+
publication_uri = RDF::URI.new(mint_uri(i.uuid, :dataset))
|
135
|
+
add_triple publication_uri, RDF.type, RDF::URI.new("#{vocab(:vivo)}Dataset")
|
135
136
|
else
|
136
|
-
publication_uri = RDF::URI.new
|
137
|
-
|
137
|
+
publication_uri = RDF::URI.new(mint_uri(i.uuid, :publication))
|
138
|
+
add_triple publication_uri, RDF.type, RDF::URI.new("#{vocab(:swpo)}Publication")
|
138
139
|
end
|
139
|
-
|
140
|
-
|
140
|
+
add_triple @resource_uri, RDF::Vocab::DC.relation, publication_uri
|
141
|
+
add_triple publication_uri, RDF::Vocab::DC.title, i.title
|
141
142
|
end
|
142
143
|
end
|
143
144
|
|
@@ -158,13 +159,13 @@ module LinkedResearchMetadata
|
|
158
159
|
else
|
159
160
|
uuid = SecureRandom.uuid
|
160
161
|
end
|
161
|
-
person_uri = RDF::URI.new
|
162
|
+
person_uri = RDF::URI.new(mint_uri(uuid, :person))
|
162
163
|
if i.role == 'Creator'
|
163
|
-
|
164
|
+
add_triple @resource_uri, RDF::Vocab::DC.creator, person_uri
|
164
165
|
person person_uri, uuid, name
|
165
166
|
end
|
166
167
|
if i.role == 'Contributor'
|
167
|
-
|
168
|
+
add_triple @resource_uri, RDF::Vocab::DC.contributor, person_uri
|
168
169
|
person person_uri, uuid, name
|
169
170
|
end
|
170
171
|
end
|
@@ -174,7 +175,7 @@ module LinkedResearchMetadata
|
|
174
175
|
|
175
176
|
def spatial
|
176
177
|
@resource.spatial_places.each do |i|
|
177
|
-
|
178
|
+
add_triple @resource_uri, RDF::Vocab::DC.spatial, i
|
178
179
|
end
|
179
180
|
end
|
180
181
|
|
@@ -189,7 +190,7 @@ module LinkedResearchMetadata
|
|
189
190
|
temporal_range << t.end.strftime("%F")
|
190
191
|
end
|
191
192
|
object = temporal_range
|
192
|
-
|
193
|
+
add_triple @resource_uri, RDF::Vocab::DC.temporal, object
|
193
194
|
end
|
194
195
|
end
|
195
196
|
end
|
@@ -197,7 +198,7 @@ module LinkedResearchMetadata
|
|
197
198
|
def title
|
198
199
|
object = @resource.title
|
199
200
|
if object
|
200
|
-
|
201
|
+
add_triple @resource_uri, RDF::Vocab::DC.title, object
|
201
202
|
end
|
202
203
|
end
|
203
204
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linked_research_metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Albin-Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puree
|