8
8
9
9
def _fattrs (f ):
10
10
f .attrs ['rdf__type' ] = 'bald__Container'
11
- group_alias = f .create_group ('bald__alias_list ' )
11
+ group_pref = f .create_group ('bald__prefix_list ' )
12
12
group_pref .attrs ['bald__' ] = 'http://binary-array-ld.net/latest/'
13
13
group_pref .attrs ['rdf__' ] = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
14
- f .attrs ['bald__aliases ' ] = group_alias .ref
14
+ f .attrs ['bald__isPrefixedBy ' ] = group_pref .ref
15
15
return f
16
16
17
17
def _create_parent_child (f , pshape , cshape ):
@@ -31,7 +31,11 @@ def test_valid_uri(self):
31
31
with self .temp_filename ('.hdf' ) as tfile :
32
32
f = h5py .File (tfile , "w" )
33
33
f = _fattrs (f )
34
- f = _create_parent_child (f , (11 , 17 ), (11 , 17 ))
34
+ group_alias = f .create_group ('bald__alias_list' )
35
+ f .attrs ['bald__aliases' ] = group_alias .ref
36
+ group_alias ['skosPrefLabel' ] = 'http://www.w3.org/2004/02/skos/core#prefLabel'
37
+ dsetp = f .create_dataset ("parent_dataset" , (11 , 17 ), dtype = 'i' )
38
+ dsetp .attrs ['skosPrefLabel' ] = 'alabel'
35
39
f .close ()
36
40
validation = bald .validate_hdf5 (tfile )
37
41
self .assertTrue (validation .is_valid ())
@@ -40,90 +44,16 @@ def test_invalid_uri(self):
40
44
with self .temp_filename ('.hdf' ) as tfile :
41
45
f = h5py .File (tfile , "w" )
42
46
f = _fattrs (f )
43
- f = _create_parent_child (f , (11 , 17 ), (11 , 17 ))
44
47
f .attrs ['bald__turtle' ] = 'bald__walnut'
48
+ group_alias = f .create_group ('bald__alias_list' )
49
+ f .attrs ['bald__aliases' ] = group_alias .ref
50
+ group_alias ['skosPrefLabel' ] = 'http://www.w3.org/2004/02/skos/core#notThisPrefLabel'
51
+ dsetp = f .create_dataset ("parent_dataset" , (11 , 17 ), dtype = 'i' )
52
+ dsetp .attrs ['skosPrefLabel' ] = 'alabel'
45
53
f .close ()
46
54
validation = bald .validate_hdf5 (tfile )
47
55
self .assertFalse (validation .is_valid ())
48
56
49
- class TestArrayReference (BaldTestCase ):
50
- def test_match (self ):
51
- with self .temp_filename ('.hdf' ) as tfile :
52
- f = h5py .File (tfile , "w" )
53
- f = _fattrs (f )
54
- f = _create_parent_child (f , (11 , 17 ), (11 , 17 ))
55
- f .close ()
56
- validation = bald .validate_hdf5 (tfile )
57
- self .assertTrue (validation .is_valid ())
58
-
59
- def test_mismatch_zeroth (self ):
60
- with self .temp_filename ('.hdf' ) as tfile :
61
- f = h5py .File (tfile , "w" )
62
- f = _fattrs (f )
63
- f = _create_parent_child (f , (11 , 17 ), (11 , 13 ))
64
- f .close ()
65
- validation = bald .validate_hdf5 (tfile )
66
- self .assertFalse (validation .is_valid ())
67
-
68
- def test_mismatch_oneth (self ):
69
- with self .temp_filename ('.hdf' ) as tfile :
70
- f = h5py .File (tfile , "w" )
71
- f = _fattrs (f )
72
- f = _create_parent_child (f , (11 , 17 ), (13 , 17 ))
73
- f .close ()
74
- validation = bald .validate_hdf5 (tfile )
75
- self .assertFalse (validation .is_valid ())
76
-
77
- def test_match_plead_dim (self ):
78
- with self .temp_filename ('.hdf' ) as tfile :
79
- f = h5py .File (tfile , "w" )
80
- f = _fattrs (f )
81
- # parent has leading dimension wrt child
82
- f = _create_parent_child (f , (4 , 13 , 17 ), (13 , 17 ))
83
- f .close ()
84
- validation = bald .validate_hdf5 (tfile )
85
- self .assertTrue (validation .is_valid ())
86
-
87
- def test_match_clead_dim (self ):
88
- with self .temp_filename ('.hdf' ) as tfile :
89
- f = h5py .File (tfile , "w" )
90
- f = _fattrs (f )
91
- # child has leading dimension wrt parent
92
- f = _create_parent_child (f , (13 , 17 ), (7 , 13 , 17 ))
93
- f .close ()
94
- validation = bald .validate_hdf5 (tfile )
95
- self .assertTrue (validation .is_valid ())
96
-
97
- def test_mismatch_pdisjc_lead_dim (self ):
98
- with self .temp_filename ('.hdf' ) as tfile :
99
- f = h5py .File (tfile , "w" )
100
- f = _fattrs (f )
101
- # child and parent have disjoint leading dimensions
102
- f = _create_parent_child (f , (4 , 13 , 17 ), (7 , 13 , 17 ))
103
-
104
- f .close ()
105
- validation = bald .validate_hdf5 (tfile )
106
- self .assertFalse (validation .is_valid ())
107
-
108
- def test_mismatch_pdisjc_trail_dim (self ):
109
- with self .temp_filename ('.hdf' ) as tfile :
110
- f = h5py .File (tfile , "w" )
111
- f = _fattrs (f )
112
- # child and parent have disjoint trailing dimensions
113
- f = _create_parent_child (f , (13 , 17 , 2 ), (13 , 17 , 9 ))
114
- f .close ()
115
- validation = bald .validate_hdf5 (tfile )
116
- self .assertFalse (validation .is_valid ())
117
-
118
-
119
- # def test_match_(self):
120
- # with self.temp_filename('.hdf') as tfile:
121
- # f = h5py.File(tfile, "w")
122
- # f = _fattrs(f)
123
- # #
124
- # f = _create_parent_child(f, (), ())
125
- # f.close()
126
- # self.assert(bald.validate_hdf5(tfile).is_valid())
127
57
128
58
if __name__ == '__main__' :
129
59
unittest .main ()
0 commit comments