29
29
30
30
def n_cyber_object_to_node (graph ):
31
31
"""
32
- Initial function to create the blank nodes for each of the file's facet nodes
32
+ Initial function to create the blank nodes for each of
33
+ the file's facet nodes
33
34
:param graph: rdflib graph object for adding nodes to
34
35
:return: The four blank nodes for each fo the other functions to fill
35
36
"""
@@ -39,7 +40,13 @@ def n_cyber_object_to_node(graph):
39
40
n_content_facets = rdflib .BNode ()
40
41
n_exif_facets = rdflib .BNode ()
41
42
graph .add ((cyber_object_facet , NS_RDF .type , NS_UCO_OBSERVABLE .ObservableObject ))
42
- graph .add ((cyber_object_facet , NS_UCO_OBSERVABLE .hasChanged , rdflib .Literal (False )))
43
+ graph .add (
44
+ (
45
+ cyber_object_facet ,
46
+ NS_UCO_OBSERVABLE .hasChanged ,
47
+ rdflib .Literal (False ),
48
+ )
49
+ )
43
50
graph .add ((cyber_object_facet , NS_UCO_CORE .hasFacet , n_exif_facets ))
44
51
graph .add ((cyber_object_facet , NS_UCO_CORE .hasFacet , n_raster_facets ))
45
52
graph .add ((cyber_object_facet , NS_UCO_CORE .hasFacet , n_file_facets ))
@@ -51,7 +58,7 @@ def filefacets_object_to_node(graph, n_file_facets, file_information):
51
58
Adding file facet object to the graph object
52
59
:param graph: rdflib graph object for adding nodes to
53
60
:param n_file_facets: file facet node to add facets of file to
54
- :param file_information: Dictionary containing information about file being analysed
61
+ :param file_information: Dictionary containing info about file analysed
55
62
:return: None
56
63
"""
57
64
file_name , ext = os .path .splitext (file_information ["Filename" ])
@@ -84,10 +91,10 @@ def filefacets_object_to_node(graph, n_file_facets, file_information):
84
91
85
92
def filecontent_object_to_node (graph , n_content_facets , file_information ):
86
93
"""
87
- Unused: Create a node that will add the file content facet node to the graph
94
+ Unused: Create node to add the file content facet node to the graph
88
95
:param graph: rdflib graph object for adding nodes to
89
- :param n_content_facets: Blank node to contain all of the content facet information
90
- :param file_information: Dictionary containing information about file being analysed
96
+ :param n_content_facets: Blank node to contain content facet information
97
+ :param file_information: Dictionary containing info about file analysed
91
98
:return: None
92
99
"""
93
100
byte_order_facet = rdflib .BNode ()
@@ -101,7 +108,13 @@ def filecontent_object_to_node(graph, n_content_facets, file_information):
101
108
NS_UCO_VOCABULARY .EndiannessTypeVocab ,
102
109
)
103
110
)
104
- graph .add ((byte_order_facet , NS_UCO_VOCABULARY .value , rdflib .Literal ("Big-endian" )))
111
+ graph .add (
112
+ (
113
+ byte_order_facet ,
114
+ NS_UCO_VOCABULARY .value ,
115
+ rdflib .Literal ("Big-endian" ),
116
+ )
117
+ )
105
118
if "mimetype" in file_information .keys ():
106
119
graph .add (
107
120
(
@@ -126,16 +139,20 @@ def raster_object_to_node(graph, controlled_dict, n_raster_facets, file_informat
126
139
"""
127
140
Adding file's raster facet objects to the graph object
128
141
:param graph: rdflib graph object for adding nodes to
129
- :param controlled_dict: Dictionary containing the EXIF information from image
142
+ :param controlled_dict: Dictionary containing EXIF information from image
130
143
:param n_raster_facets: raster facet node to add raster facets of file to
131
- :param file_information: Dictionary containing information about file being analysed
144
+ :param file_information: Dictionary containing info about file analysed
132
145
:return: None
133
146
"""
134
147
file_name , ext = os .path .splitext (file_information ["Filename" ])
135
148
file_ext = ext [1 :]
136
149
graph .add ((n_raster_facets , NS_RDF .type , NS_UCO_OBSERVABLE .RasterPictureFacet ))
137
150
graph .add (
138
- (n_raster_facets , NS_UCO_OBSERVABLE .pictureType , rdflib .Literal (file_ext ))
151
+ (
152
+ n_raster_facets ,
153
+ NS_UCO_OBSERVABLE .pictureType ,
154
+ rdflib .Literal (file_ext ),
155
+ )
139
156
)
140
157
# :TODO The below feels a bit hacky probably a better way to do it
141
158
if "EXIF ExifImageLength" in controlled_dict .keys ():
@@ -227,7 +244,13 @@ def controlled_dictionary_object_to_node(graph, controlled_dict, n_exif_facet):
227
244
n_controlled_dictionary = rdflib .BNode ()
228
245
graph .add ((n_exif_facet , NS_RDF .type , NS_UCO_OBSERVABLE .EXIFFacet ))
229
246
graph .add ((n_exif_facet , NS_UCO_OBSERVABLE .exifData , n_controlled_dictionary ))
230
- graph .add ((n_controlled_dictionary , NS_RDF .type , NS_UCO_TYPES .ControlledDictionary ))
247
+ graph .add (
248
+ (
249
+ n_controlled_dictionary ,
250
+ NS_RDF .type ,
251
+ NS_UCO_TYPES .ControlledDictionary ,
252
+ )
253
+ )
231
254
for key in sorted (controlled_dict .keys ()):
232
255
# :TODO stringing all values to ensure they are strings, open to input
233
256
# here as maybe assertion or a better way to do this
0 commit comments