Skip to content

Commit 80688f0

Browse files
authored
Merge pull request #14 from casework/change_variable_name_hints
Change variable name hints
2 parents ea3fff6 + 89ba137 commit 80688f0

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

exifread_case/exifread_case.py

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -78,56 +78,56 @@ def n_cyber_object_to_node(graph):
7878
:param graph: rdflib graph object for adding nodes to
7979
:return: The four nodes for each fo the other functions to fill
8080
"""
81-
cyber_object_facet = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="observableobject-"))
82-
n_raster_facets = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="rasterpicture-"))
83-
n_file_facets = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="filefacet-"))
84-
n_content_facets = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="contentfacet-"))
85-
n_exif_facets = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="exiffacet-"))
81+
cyber_object = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="observableobject-"))
82+
n_raster_facet = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="rasterpicture-"))
83+
n_file_facet = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="filefacet-"))
84+
n_content_facet = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="contentfacet-"))
85+
n_exif_facet = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="exiffacet-"))
8686
graph.add((
87-
cyber_object_facet,
87+
cyber_object,
8888
NS_RDF.type,
8989
NS_UCO_OBSERVABLE.ObservableObject
9090
))
9191
graph.add((
92-
cyber_object_facet,
92+
cyber_object,
9393
NS_UCO_OBSERVABLE.hasChanged,
9494
rdflib.Literal(False)
9595
))
9696
graph.add((
97-
cyber_object_facet,
97+
cyber_object,
9898
NS_UCO_CORE.hasFacet,
99-
n_exif_facets
99+
n_exif_facet
100100
))
101101
graph.add((
102-
cyber_object_facet,
102+
cyber_object,
103103
NS_UCO_CORE.hasFacet,
104-
n_raster_facets
104+
n_raster_facet
105105
))
106106
graph.add((
107-
cyber_object_facet,
107+
cyber_object,
108108
NS_UCO_CORE.hasFacet,
109-
n_file_facets
109+
n_file_facet
110110
))
111-
return n_exif_facets, n_raster_facets, n_file_facets, n_content_facets
111+
return n_exif_facet, n_raster_facet, n_file_facet, n_content_facet
112112

113113

114-
def filecontent_object_to_node(graph, n_content_facets, file_information):
114+
def filecontent_object_to_node(graph, n_content_facet, file_information):
115115
"""
116116
Unused: Create a node that will add the file content facet node to the graph
117117
:param graph: rdflib graph object for adding nodes to
118-
:param n_content_facets: Blank node to contain all content facet information
118+
:param n_content_facet: Blank node to contain all content facet information
119119
:param file_information: Dictionary containing information about file being analysed
120120
:return: None
121121
"""
122122
byte_order_facet = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="byteorder-"))
123123
file_hash_facet = rdflib.URIRef(get_node_iri(ns=ns_kb, prefix="hash-"))
124124
graph.add((
125-
n_content_facets,
125+
n_content_facet,
126126
NS_RDF.type,
127127
NS_UCO_OBSERVABLE.ContentDataFacet
128128
))
129129
graph.add((
130-
n_content_facets,
130+
n_content_facet,
131131
NS_UCO_OBSERVABLE.byteOrder,
132132
byte_order_facet
133133
))
@@ -143,19 +143,19 @@ def filecontent_object_to_node(graph, n_content_facets, file_information):
143143
))
144144
if 'mimetype' in file_information.keys():
145145
graph.add((
146-
n_content_facets,
146+
n_content_facet,
147147
NS_UCO_OBSERVABLE.mimeType,
148148
rdflib.Literal(file_information["mimetype"])
149149
))
150150
if 'size' in file_information.keys():
151151
graph.add((
152-
n_content_facets,
152+
n_content_facet,
153153
NS_UCO_OBSERVABLE.sizeInBytes,
154154
rdflib.term.Literal(file_information["size"],
155155
datatype=NS_XSD.integer)
156156
))
157157
graph.add((
158-
n_content_facets,
158+
n_content_facet,
159159
NS_UCO_OBSERVABLE.hash,
160160
file_hash_facet
161161
))
@@ -166,90 +166,90 @@ def filecontent_object_to_node(graph, n_content_facets, file_information):
166166
))
167167

168168

169-
def filefacets_object_to_node(graph, n_file_facets, file_information):
169+
def filefacets_object_to_node(graph, n_file_facet, file_information):
170170
"""
171171
Adding file facet object to the graph object
172172
:param graph: rdflib graph object for adding nodes to
173-
:param n_file_facets: file facet node to add facets of file to
173+
:param n_file_facet: file facet node to add facets of file to
174174
:param file_information: Dictionary containing information about file being analysed
175175
:return: None
176176
"""
177177
file_name, ext = os.path.splitext(file_information['Filename'])
178178
file_ext = ext[1:]
179179
graph.add((
180-
n_file_facets,
180+
n_file_facet,
181181
NS_RDF.type,
182182
NS_UCO_OBSERVABLE.FileFacet
183183
))
184184
graph.add((
185-
n_file_facets,
185+
n_file_facet,
186186
NS_UCO_OBSERVABLE.fileName,
187187
rdflib.Literal(os.path.basename(file_information["Filename"]))
188188
))
189189
graph.add((
190-
n_file_facets,
190+
n_file_facet,
191191
NS_UCO_OBSERVABLE.filePath,
192192
rdflib.Literal(os.path.abspath(file_information["Filename"]))
193193
))
194194
graph.add((
195-
n_file_facets,
195+
n_file_facet,
196196
NS_UCO_OBSERVABLE.extension,
197197
rdflib.Literal(file_ext)
198198
))
199199
if 'size' in file_information.keys():
200200
graph.add((
201-
n_file_facets,
201+
n_file_facet,
202202
NS_UCO_OBSERVABLE.sizeInBytes,
203203
rdflib.term.Literal(file_information["size"],
204204
datatype=NS_XSD.integer)
205205
))
206206

207207

208-
def raster_object_to_node(graph, controlled_dict, n_raster_facets, file_information):
208+
def raster_object_to_node(graph, controlled_dict, n_raster_facet, file_information):
209209
"""
210210
Adding file's raster facet objects to the graph object
211211
:param graph: rdflib graph object for adding nodes to
212212
:param controlled_dict: Dictionary containing the EXIF information from image
213-
:param n_raster_facets: raster facet node to add raster facets of file to
213+
:param n_raster_facet: raster facet node to add raster facets of file to
214214
:param file_information: Dictionary containing information about file being analysed
215215
:return: None
216216
"""
217217
file_name, ext = os.path.splitext(file_information['Filename'])
218218
file_ext = ext[1:]
219219
graph.add((
220-
n_raster_facets,
220+
n_raster_facet,
221221
NS_RDF.type,
222222
NS_UCO_OBSERVABLE.RasterPictureFacet
223223
))
224224
graph.add((
225-
n_raster_facets,
225+
n_raster_facet,
226226
NS_UCO_OBSERVABLE.pictureType,
227227
rdflib.Literal(file_ext)
228228
))
229229
# :TODO The below feels a bit hacky probably a better way to do it
230230
if 'EXIF ExifImageLength' in controlled_dict.keys():
231231
graph.add((
232-
n_raster_facets,
232+
n_raster_facet,
233233
NS_UCO_OBSERVABLE.pictureHeight,
234234
rdflib.term.Literal(int(float(str(controlled_dict['EXIF ExifImageLength']))),
235235
datatype=NS_XSD.integer)
236236
))
237237
if 'EXIF ExifImageWidth' in controlled_dict.keys():
238238
graph.add((
239-
n_raster_facets,
239+
n_raster_facet,
240240
NS_UCO_OBSERVABLE.pictureWidth,
241241
rdflib.term.Literal(int(float(str(controlled_dict['EXIF ExifImageWidth']))),
242242
datatype=NS_XSD.integer)
243243
))
244244
if 'EXIF CompressedBitsPerPixel' in controlled_dict.keys():
245245
graph.add((
246-
n_raster_facets,
246+
n_raster_facet,
247247
NS_UCO_OBSERVABLE.bitsPerPixel,
248248
rdflib.term.Literal(int(float(str(controlled_dict['EXIF CompressedBitsPerPixel']))),
249249
datatype=NS_XSD.integer)
250250
))
251251
graph.add((
252-
n_raster_facets,
252+
n_raster_facet,
253253
NS_RDFS.comment,
254254
rdflib.Literal("Information represented here from exif information not from "
255255
"file system stats except for extension, which uses os python lib")
@@ -327,11 +327,11 @@ def main():
327327
tag_dict = create_exif_dict(tags)
328328
case_utils.local_uuid.configure()
329329
out_graph = rdflib.Graph()
330-
exif_facet_node, raster_facets_node, file_facets_node, content_facets \
330+
exif_facet_node, raster_facet_node, file_facet_node, content_facet_node \
331331
= n_cyber_object_to_node(out_graph)
332332
controlled_dictionary_object_to_node(out_graph, tag_dict, exif_facet_node)
333-
filefacets_object_to_node(out_graph, file_facets_node, file_info)
334-
raster_object_to_node(out_graph, tag_dict, raster_facets_node, file_info)
333+
filefacets_object_to_node(out_graph, file_facet_node, file_info)
334+
raster_object_to_node(out_graph, tag_dict, raster_facet_node, file_info)
335335

336336
context = {"kb": "http://example.org/kb/",
337337
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",

0 commit comments

Comments
 (0)