This repository has been archived by the owner on Jul 10, 2020. It is now read-only.
forked from CSIRO-enviro-informatics/VocPrez
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest_endpoints.py
1353 lines (1163 loc) · 60 KB
/
test_endpoints.py
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import requests
import json
import re
BASE_URLS = [
"http://localhost:5000",
# 'http://vocabs.gsq.cat'
]
N_TRIPLES_PATTERN = (
r'(_:(.+)|<.+>) (_:(.+)|<.+>) ("(.+)"@en)|(_:(.+)|(".+"\^\^)?<.+>) .'
)
#
# -- Test static pages -------------------------------------------------------------------------------------------------
#
def test_index_html():
for BASE_URL in BASE_URLS:
content = requests.get(BASE_URL).content.decode("utf-8")
assert "<h1>System Home</h1>" in content, BASE_URL
def test_about_html():
for BASE_URL in BASE_URLS:
content = requests.get(BASE_URL + "/about").content.decode("utf-8")
assert (
"<p>A read-only web delivery system for Simple Knowledge Organization System (SKOS)-formulated RDF "
"vocabularies.</p>" in content
), BASE_URL
#
# -- Test vocabulary register ------------------------------------------------------------------------------------------
#
def test_vocabulary_register_ckan_view_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?vocab_id=&_view=ckan&_format=application/json&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
content = json.loads(content)
assert "head" and "results" in content, BASE_URL
assert "s" and "pl" in content["head"]["vars"], BASE_URL
def test_vocabulary_register_reg_view_html():
for BASE_URL in BASE_URLS:
content = requests.get(BASE_URL + "/vocabulary/").content.decode("utf-8")
assert "Search <em>Vocabularies:</em><br>" in content, BASE_URL
def test_vocabulary_register_reg_view_turtle():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?vocab_id=&_view=reg&_format=text/turtle&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
assert (
"""@prefix ereg: <https://promsns.org/def/eregistry#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix reg: <http://purl.org/linked-data/registry#> .
@prefix xhv: <https://www.w3.org/1999/xhtml/vocab#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> ."""
in content
), BASE_URL
def test_vocabulary_register_reg_view_xml():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?vocab_id=&_view=reg&_format=application/rdf+xml&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
assert (
"""<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:ldp="http://www.w3.org/ns/ldp#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:reg="http://purl.org/linked-data/registry#"
xmlns:xhv="https://www.w3.org/1999/xhtml/vocab#"
>"""
in content
), BASE_URL
def test_vocabulary_register_reg_view_app_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?vocab_id=&_view=reg&_format=application/json&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
content = json.loads(content)
assert (
"uri"
and "label"
and "comment"
and "contained_item_classes"
and "default_view"
and "register_items"
and "views" in content
), BASE_URL
def test_vocabulary_register_reg_view_ld_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?vocab_id=&_view=reg&_format=application/ld+json&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
content = json.loads(content)
assert "@id" in content[0].keys(), BASE_URL
def test_vocabulary_register_reg_view_text_n3():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?vocab_id=&_view=reg&_format=text/n3&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
assert (
"""@prefix ereg: <https://promsns.org/def/eregistry#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix reg: <http://purl.org/linked-data/registry#> .
@prefix xhv: <https://www.w3.org/1999/xhtml/vocab#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> ."""
in content
), BASE_URL
def test_vocabulary_register_reg_view_app_n3():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?vocab_id=&_view=reg&_format=application/n-triples&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
content = content.split("\n")
for line in content:
line = line.strip()
if line != "":
result = re.search(N_TRIPLES_PATTERN, line)
assert result is not None, "URL: {} \n\nLine: {}".format(BASE_URL, line)
def test_vocabulary_register_alternates_view_html():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL + "/vocabulary/?_view=alternates"
).content.decode("utf-8")
assert (
'<td><a href="https://promsns.org/def/alt">https://promsns.org/def/alt</a></td>'
in content
)
assert "<h1>Alternates View</h1>" in content, BASE_URL
def test_vocabulary_register_alternates_view_app_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?_view=alternates&_format=application/json&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
content = json.loads(content)
assert content["uri"] == BASE_URL + "/vocabulary/"
assert content["default_view"] == "reg"
assert "ckan" and "reg" and "alternates" in content["views"], BASE_URL
def test_vocabulary_register_alternates_view_turtle():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?_view=alternates&_format=text/turtle&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
assert (
"""@prefix alt: <http://promsns.org/def/alt#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix prof: <https://w3c.github.io/dxwg/profiledesc#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> ."""
in content
), BASE_URL
def test_vocabulary_register_alternates_view_xml():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?_view=alternates&_format=application/rdf+xml&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
assert (
"""<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:alt="http://promsns.org/def/alt#"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:prof="https://w3c.github.io/dxwg/profiledesc#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>"""
in content
), BASE_URL
def test_vocabulary_register_alternates_view_ld_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?_view=alternates&_format=application/ld+json&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
content = json.loads(content)
assert "@id" in content[0].keys(), BASE_URL
def test_vocabulary_register_alternates_view_text_n3():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?_view=alternates&_format=text/n3&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
assert (
"""@prefix alt: <http://promsns.org/def/alt#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix prof: <https://w3c.github.io/dxwg/profiledesc#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> ."""
in content
), BASE_URL
def test_vocabulary_register_alternates_view_app_n_triples():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/?_view=alternates&_format=application/n-triples&uri="
+ BASE_URL
+ "/vocabulary/"
).content.decode("utf-8")
content = content.split("\n")
for line in content:
line = line.strip()
if line != "":
result = re.search(N_TRIPLES_PATTERN, line)
assert result is not None, "URL: {} \n\nLine: {}".format(BASE_URL, line)
#
# -- Test Vocabulary Instance (File Source) ----------------------------------------------------------------------------
#
def test_file_vocabulary_instance_dcat_view_html():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL + "/vocabulary/contact_type?_view=dcat&_format=text/html&uri="
"http%3A//resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
).content.decode("utf-8")
# Title
assert "<h1>Vocabulary: Contact Type</h1>" in content, BASE_URL
# URI
assert (
'<a href="http://resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype">'
"http://resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype</a>"
in content
), BASE_URL
# Description
assert (
"<td>This scheme describes the concept space for Contact Type concepts, as defined by the IUGS "
"Commission for Geoscience Information (CGI) Geoscience Terminology Working Group. By extension, it "
"includes all concepts in this conceptScheme, as well as concepts in any previous versions of the "
"scheme. Designed for use in the contactType property in GeoSciML Contact elements.</td>"
in content
), BASE_URL
# Creator
assert (
'<td><a href="http://editor.vocabs.ands.org.au/user/CGI-Concept-Definition-Task-Group">'
"CGI-Concept-Definition-Task-Group</a></td>" in content
), BASE_URL
# Version
assert (
"""<tr>
<th>Version Info:</th><td>v0.1</td>
</tr>"""
in content
), BASE_URL
# Top Concepts
assert (
""" <tr>
<th>Top Concepts:</th>
<td>
<a href="/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/contact">contact</a><br />
</td>
</tr>"""
in content
), BASE_URL
# Concept Hierarchy
assert (
""" <tr>
<th>Concept Hierarchy:</th>
<td>
<ul>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/contact">contact</a> (1)<ul>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/chronostratigraphic_zone_contact">chronostratigraphic-zone contact</a> (2)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/faulted_contact">faulted contact</a> (2)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/geologic_province_contact">geologic province contact</a> (2)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/geophysical_contact">geophysical contact</a> (2)<ul>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/conductivity_contact">conductivity contact</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/density_contact">density contact</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/magnetic_contact">magnetic contact</a> (3)<ul>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/magnetic_polarity_contact">magnetic polarity contact</a> (4)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/magnetic_susceptiblity_contact">magnetic susceptiblity contact</a> (4)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/magnetization_contact">magnetization contact</a> (4)</li>
</ul>
</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/radiometric_contact">radiometric contact</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/seismic_contact">seismic contact</a> (3)</li>
</ul>
</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/glacial_stationary_line">glacial stationary line</a> (2)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/lithogenetic_contact">lithogenetic contact</a> (2)<ul>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/deformation_zone_contact">deformation zone contact</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/depositional_contact">depositional contact</a> (3)<ul>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/conformable_contact">conformable contact</a> (4)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/unconformable_contact">unconformable contact</a> (4)<ul>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/angular_unconformable_contact">angular unconformable contact</a> (5)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/buttress_unconformity">buttress unconformity</a> (5)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/disconformable_contact">disconformable contact</a> (5)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/nonconformable_contact">nonconformable contact</a> (5)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/paraconformable_contact">paraconformable contact</a> (5)</li>
</ul>
</li>
</ul>
</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/igneous_intrusive_contact">igneous intrusive contact</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/igneous_phase_contact">igneous phase contact</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/impact_structure_boundary">impact structure boundary</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/metamorphic_contact">metamorphic contact</a> (3)<ul>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/alteration_facies_contact">alteration facies contact</a> (4)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/metamorphic_facies_contact">metamorphic facies contact</a> (4)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/metasomatic_facies_contact">metasomatic facies contact</a> (4)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/mineralisation_assemblage_contact">mineralisation assemblage contact</a> (4)</li>
</ul>
</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/sedimentary_facies_contact">sedimentary facies contact</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/sedimentary_intrusive_contact">sedimentary intrusive contact</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/volcanic_subsidence_zone_boundary">volcanic subsidence zone boundary</a> (3)</li>
<li><a href="{0}/object?vocab_id=contact_type&uri=http%3A//resource.geosciml.org/classifier/cgi/contacttype/weathering_contact">weathering contact</a> (3)</li>
</ul>
</li>
</ul>
</li>
</ul>
</td>
</tr>""".format(
BASE_URL
)
in content
), BASE_URL
def test_file_vocabulary_instance_dcat_view_app_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type?_view=dcat&_format=application/json&uri="
"http%3A//resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
).content.decode("utf-8")
content = json.loads(content)
count = 0
for c in content:
if c.get("@id"):
if (
c["@id"]
== "http://resource.geosciml.org/classifier/cgi/contacttype/contact"
):
count += 1
if c.get("http://www.w3.org/2004/02/skos/core#prefLabel"):
if (
c["http://www.w3.org/2004/02/skos/core#prefLabel"][0]["@value"]
== "contact"
):
count += 1
assert count == 2, BASE_URL
def test_file_vocabulary_instance_dcat_view_turtle():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL + "/vocabulary/contact_type?_view=dcat&_format=text/turtle&uri="
"http%3A//resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
).content.decode("utf-8")
assert (
"""@prefix dcat: <https://www.w3.org/ns/dcat#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype> a dcat:Dataset ;
dct:creator <http://editor.vocabs.ands.org.au/user/CGI-Concept-Definition-Task-Group> ;
dct:description "This scheme describes the concept space for Contact Type concepts, as defined by the IUGS Commission for Geoscience Information (CGI) Geoscience Terminology Working Group. By extension, it includes all concepts in this conceptScheme, as well as concepts in any previous versions of the scheme. Designed for use in the contactType property in GeoSciML Contact elements."@en ;
dct:title "Contact Type"@en ;
owl:versionInfo "v0.1" ;
skos:hasTopConcept <http://resource.geosciml.org/classifier/cgi/contacttype/contact> .
<http://resource.geosciml.org/classifier/cgi/contacttype/contact> skos:prefLabel "contact"@en ."""
in content
), BASE_URL
def test_file_vocabulary_instance_dcat_view_xml():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type?_view=dcat&_format=application/rdf+xml&uri="
"http%3A//resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
).content.decode("utf-8")
assert (
"""<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:dct="http://purl.org/dc/terms/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
>"""
in content
), BASE_URL
def test_file_vocabulary_instance_dcat_view_ld_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type?_view=dcat&_format=application/ld+json&uri="
"http%3A//resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
).content.decode("utf-8")
content = json.loads(content)
count = 0
for c in content:
if (
c.get("@id")
== "http://resource.geosciml.org/classifier/cgi/contacttype/contact"
):
count += 1
if c.get("http://www.w3.org/2004/02/skos/core#prefLabel"):
if (
c["http://www.w3.org/2004/02/skos/core#prefLabel"][0]["@value"]
== "contact"
):
count += 1
assert count == 2
def test_file_vocabulary_instance_dcat_view_text_n3():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL + "/vocabulary/contact_type?_view=dcat&_format=text/n3&uri="
"http%3A//resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
).content.decode("utf-8")
assert (
"""@prefix dcat: <https://www.w3.org/ns/dcat#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype> a dcat:Dataset ;
dct:creator <http://editor.vocabs.ands.org.au/user/CGI-Concept-Definition-Task-Group> ;
dct:description "This scheme describes the concept space for Contact Type concepts, as defined by the IUGS Commission for Geoscience Information (CGI) Geoscience Terminology Working Group. By extension, it includes all concepts in this conceptScheme, as well as concepts in any previous versions of the scheme. Designed for use in the contactType property in GeoSciML Contact elements."@en ;
dct:title "Contact Type"@en ;
owl:versionInfo "v0.1" ;
skos:hasTopConcept <http://resource.geosciml.org/classifier/cgi/contacttype/contact> .
<http://resource.geosciml.org/classifier/cgi/contacttype/contact> skos:prefLabel "contact"@en .
"""
in content
), BASE_URL
def test_file_vocabulary_instance_dcat_view_app_n3():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type?_view=dcat&_format=application/n-triples&uri="
"http%3A//resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
).content.decode("utf-8")
content = content.split("\n")
for line in content:
line = line.strip()
if line != "":
result = re.search(N_TRIPLES_PATTERN, line)
assert result is not None, "URL: {} \n\nLine: {}".format(BASE_URL, line)
def test_file_vocabulary_instance_alternates_view_html():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type?_view=alternates&_format=text/html&uri="
"http%3A//resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
).content.decode("utf-8")
assert (
"""<h1>Alternates View</h1>
<h2>Instance <a href="http://resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype">Contact Type</a></h2>"""
in content
), BASE_URL
def test_file_vocabulary_instance_alternates_view_app_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type?_view=alternates&_format=application/json&uri="
"http%3A//resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
).content.decode("utf-8")
content = json.loads(content)
assert (
content["uri"]
== "http://resource.geosciml.org/classifierscheme/cgi/2016.01/contacttype"
), BASE_URL
assert content["views"] == ["dcat", "alternates"], BASE_URL
assert content["default_view"] == "dcat", BASE_URL
#
# -- Test Vocabulary Instance's Concept Register -----------------------------------------------------------------------
#
def test_file_vocabulary_instance_concept_register_ckan_view_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=ckan&_format=application/json&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
content = json.loads(content)
assert (
content["results"]["bindings"][0]["pl"]["value"]
== "alteration facies contact"
), BASE_URL
assert content["results"]["bindings"][0]["s"][
"value"
] == "{}/vocabulary/contact_type/concept/contact_type".format(BASE_URL)
def test_file_vocabulary_instance_concept_register_reg_view_html():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=reg&_format=text/html&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
assert (
""" <div class="row">
<div class="col-md-8">
<h1>Register</h1>
<h2>Of
<a href="{}/vocabulary/contact_type"><em>Contact Type - File concepts</em></a>""".format(
BASE_URL
)
in content
), BASE_URL
def test_file_vocabulary_instance_concept_register_reg_view_app_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=reg&_format=application/json&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
content = json.loads(content)
assert content.get("uri") == "{}/vocabulary/contact_type/concept/".format(
BASE_URL
)
assert content.get("views") == ["ckan", "reg", "alternates"], BASE_URL
assert content.get("default_view") == "reg", BASE_URL
assert (
content.get("register_items") is not None
and len(content["register_items"]) == 20
), BASE_URL
def test_file_vocabulary_instance_concept_register_reg_view_turtle():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=reg&_format=text/turtle&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
assert (
"""@prefix ereg: <https://promsns.org/def/eregistry#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix reg: <http://purl.org/linked-data/registry#> .
@prefix xhv: <https://www.w3.org/1999/xhtml/vocab#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://resource.geosciml.org/classifier/cgi/contacttype/alteration_facies_contact> rdfs:label "alteration facies contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/angular_unconformable_contact> rdfs:label "angular unconformable contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/buttress_unconformity> rdfs:label "buttress unconformity"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/chronostratigraphic_zone_contact> rdfs:label "chronostratigraphic-zone contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/conductivity_contact> rdfs:label "conductivity contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/conformable_contact> rdfs:label "conformable contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/contact> rdfs:label "contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/deformation_zone_contact> rdfs:label "deformation zone contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/density_contact> rdfs:label "density contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/depositional_contact> rdfs:label "depositional contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/disconformable_contact> rdfs:label "disconformable contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/faulted_contact> rdfs:label "faulted contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/geologic_province_contact> rdfs:label "geologic province contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/geophysical_contact> rdfs:label "geophysical contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/glacial_stationary_line> rdfs:label "glacial stationary line"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/igneous_intrusive_contact> rdfs:label "igneous intrusive contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/igneous_phase_contact> rdfs:label "igneous phase contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/impact_structure_boundary> rdfs:label "impact structure boundary"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/lithogenetic_contact> rdfs:label "lithogenetic contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/magnetic_contact> rdfs:label "magnetic contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<{0}/vocabulary/contact_type/concept/?per_page=20&page=1> a ldp:Page ;
ldp:pageOf <{0}/vocabulary/contact_type/concept/> ;
xhv:first <{0}/vocabulary/contact_type/concept/?per_page=20&page=1> ;
xhv:last <{0}/vocabulary/contact_type/concept/?per_page=20&page=3> ;
xhv:next <{0}/vocabulary/contact_type/concept/?per_page=20&page=2> .
<{0}/vocabulary/contact_type/concept/> a reg:Register ;
rdfs:label "Test Label"^^xsd:string ;
rdfs:comment "Test Comment"^^xsd:string .""".format(
BASE_URL
)
in content
), BASE_URL
def test_file_vocabulary_instance_concept_register_reg_view_xml():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=reg&_format=application/rdf+xml&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
assert (
"""<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:ldp="http://www.w3.org/ns/ldp#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:reg="http://purl.org/linked-data/registry#"
xmlns:xhv="https://www.w3.org/1999/xhtml/vocab#"
>""".format(
BASE_URL
)
in content
), BASE_URL
def test_file_vocabulary_instance_concept_register_reg_view_ld_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=reg&_format=application/ld+json&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
content = json.loads(content)
count = 0
for c in content:
if (
c.get("@id")
== "http://resource.geosciml.org/classifier/cgi/contacttype/geophysical_contact"
):
count += 1
if c.get("@type") == ["http://purl.org/linked-data/registry#Register"]:
count += 1
if c.get("http://purl.org/linked-data/registry#register"):
assert c["http://purl.org/linked-data/registry#register"][0][
"@id"
] == "{}/vocabulary/contact_type/concept/".format(BASE_URL)
assert count == 2
def test_file_vocabulary_instance_concept_register_reg_view_text_n3():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=reg&_format=text/n3&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
assert (
"""@prefix ereg: <https://promsns.org/def/eregistry#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix reg: <http://purl.org/linked-data/registry#> .
@prefix xhv: <https://www.w3.org/1999/xhtml/vocab#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://resource.geosciml.org/classifier/cgi/contacttype/alteration_facies_contact> rdfs:label "alteration facies contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/angular_unconformable_contact> rdfs:label "angular unconformable contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/buttress_unconformity> rdfs:label "buttress unconformity"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/chronostratigraphic_zone_contact> rdfs:label "chronostratigraphic-zone contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/conductivity_contact> rdfs:label "conductivity contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/conformable_contact> rdfs:label "conformable contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/contact> rdfs:label "contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/deformation_zone_contact> rdfs:label "deformation zone contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/density_contact> rdfs:label "density contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/depositional_contact> rdfs:label "depositional contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/disconformable_contact> rdfs:label "disconformable contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/faulted_contact> rdfs:label "faulted contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/geologic_province_contact> rdfs:label "geologic province contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/geophysical_contact> rdfs:label "geophysical contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/glacial_stationary_line> rdfs:label "glacial stationary line"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/igneous_intrusive_contact> rdfs:label "igneous intrusive contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/igneous_phase_contact> rdfs:label "igneous phase contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/impact_structure_boundary> rdfs:label "impact structure boundary"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/lithogenetic_contact> rdfs:label "lithogenetic contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<http://resource.geosciml.org/classifier/cgi/contacttype/magnetic_contact> rdfs:label "magnetic contact"@en ;
reg:register <{0}/vocabulary/contact_type/concept/> .
<{0}/vocabulary/contact_type/concept/?per_page=20&page=1> a ldp:Page ;
ldp:pageOf <{0}/vocabulary/contact_type/concept/> ;
xhv:first <{0}/vocabulary/contact_type/concept/?per_page=20&page=1> ;
xhv:last <{0}/vocabulary/contact_type/concept/?per_page=20&page=3> ;
xhv:next <{0}/vocabulary/contact_type/concept/?per_page=20&page=2> .
<{0}/vocabulary/contact_type/concept/> a reg:Register ;
rdfs:label "Test Label"^^xsd:string ;
rdfs:comment "Test Comment"^^xsd:string .""".format(
BASE_URL
)
in content
), BASE_URL
def test_file_vocabulary_instance_concept_register_reg_view_app_n_triples():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=reg&_format=application/n-triples&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
content = content.split("\n")
for line in content:
line = line.strip()
if line != "":
result = re.search(N_TRIPLES_PATTERN, line)
assert result is not None, "URL: {} \n\nLine: {}".format(BASE_URL, line)
def test_file_vocabulary_instance_concept_register_alternates_view_html():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=alternates&_format=text/html&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
assert (
""" <h1>Alternates View</h1>
<h2>Instance <a href="{0}/vocabulary/contact_type/concept/"></a></h2>
<h4>Default view: <a href="{0}/vocabulary/contact_type/concept/?vocab_id=&_view=reg&uri=""".format(
BASE_URL
)
in content
), BASE_URL
def test_file_vocabulary_instance_concept_register_alternates_view_app_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=alternates&_format=application/json&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
content = json.loads(content)
assert content["uri"] == "{}/vocabulary/contact_type/concept/".format(
BASE_URL
), BASE_URL
assert content["views"] == ["ckan", "reg", "alternates"], BASE_URL
assert content["default_view"] == "reg", BASE_URL
def test_file_vocabulary_instance_concept_register_alternates_view_turtle():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=alternates&_format=text/turtle&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
assert (
"""@prefix alt: <http://promsns.org/def/alt#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix prof: <https://w3c.github.io/dxwg/profiledesc#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<{}/vocabulary/contact_type/concept/> alt:hasDefaultView""".format(
BASE_URL
)
in content
), BASE_URL
def test_file_vocabulary_instance_concept_register_alternates_view_xml():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=alternates&_format=application/rdf+xml&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
assert (
"""<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:alt="http://promsns.org/def/alt#"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:prof="https://w3c.github.io/dxwg/profiledesc#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>"""
in content
), BASE_URL
def test_file_vocabulary_instance_concept_register_alternates_view_ld_json():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=alternates&_format=application/ld+json&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
content = json.loads(content)
assert content[0]["@id"] == "{}/vocabulary/contact_type/concept/".format(
BASE_URL
), BASE_URL
assert len(content) > 0, BASE_URL
def test_file_vocabulary_instance_concept_register_alternates_view_text_n3():
for BASE_URL in BASE_URLS:
content = requests.get(
BASE_URL
+ "/vocabulary/contact_type/concept/?_view=alternates&_format=text/n3&uri="
+ BASE_URL
+ "/vocabulary/contact_type/concept/"
).content.decode("utf-8")
assert (
"""@prefix alt: <http://promsns.org/def/alt#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix prof: <https://w3c.github.io/dxwg/profiledesc#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .