@@ -80,6 +80,8 @@ class BioschemasTest < ActionDispatch::IntegrationTest
8080 event = events ( :course_event )
8181 event . external_resources . create! ( { title : 'Cool website' , url : 'https://external-resource.pizza' } )
8282 event . node_names = [ 'Test Node' ]
83+ event . contributors = [ { name : 'Contri Butor' , orcid : '0000-0002-1694-233X' } ]
84+ event . instructors = [ { name : 'Josiah Carberry' , orcid : 'https://orcid.org/0000-0002-1825-0097' } , { name : 'Gordon Freeman' } ]
8385 event . save!
8486 url = event_url ( event . slug )
8587
@@ -213,6 +215,37 @@ class BioschemasTest < ActionDispatch::IntegrationTest
213215 assert_includes providers , [ 'ELIXIR Test Node' , 'http://example.com' ]
214216 assert_includes providers , [ 'Goblet' , 'http://mygoblet.org' ]
215217 assert_includes providers , [ 'University of Manchester' , nil ]
218+
219+ # Contributors
220+ q = RDF ::Query . new do
221+ pattern RDF ::Query ::Pattern . new ( course_instance_uri , RDF ::Vocab ::SCHEMA . contributor , :contributor_info )
222+ pattern RDF ::Query ::Pattern . new ( :contributor_info , RDF ::Vocab ::SCHEMA . name , :name )
223+ pattern RDF ::Query ::Pattern . new ( :contributor_info , RDF ::Vocab ::SCHEMA . identifier , :identifier , optional : true )
224+ end
225+ results = graph . query ( q )
226+ assert_equal 1 , results . count
227+ contributors = results . map { |r | { name : r . name . to_s ,
228+ id : r . contributor_info . to_s . start_with? ( 'http' ) ? r . contributor_info . to_s : nil ,
229+ identifier : r [ :identifier ] &.to_s } }
230+ assert_includes contributors , { name : 'Contri Butor' ,
231+ id : 'https://orcid.org/0000-0002-1694-233X' ,
232+ identifier : 'https://orcid.org/0000-0002-1694-233X' }
233+
234+ # Instructors
235+ q = RDF ::Query . new do
236+ pattern RDF ::Query ::Pattern . new ( course_instance_uri , RDF ::Vocab ::SCHEMA . instructor , :instructor_info )
237+ pattern RDF ::Query ::Pattern . new ( :instructor_info , RDF ::Vocab ::SCHEMA . name , :name )
238+ pattern RDF ::Query ::Pattern . new ( :instructor_info , RDF ::Vocab ::SCHEMA . identifier , :identifier , optional : true )
239+ end
240+ results = graph . query ( q )
241+ assert_equal 2 , results . count
242+ instructors = results . map { |r | { name : r . name . to_s ,
243+ id : r . instructor_info . to_s . start_with? ( 'http' ) ? r . instructor_info . to_s : nil ,
244+ identifier : r [ :identifier ] &.to_s } }
245+ assert_includes instructors , { name : 'Josiah Carberry' ,
246+ id : 'https://orcid.org/0000-0002-1825-0097' ,
247+ identifier : 'https://orcid.org/0000-0002-1825-0097' }
248+ assert_includes instructors , { name : 'Gordon Freeman' , id : nil , identifier : nil }
216249 end
217250
218251 test 'handles non-list markdown for prereqs on course event' do
0 commit comments