@@ -82,17 +82,19 @@ def create_file_node(
82
82
:returns: The File Observable Object's node.
83
83
:rtype: rdflib.URIRef
84
84
"""
85
+ node_namespace = rdflib .Namespace (node_prefix )
86
+
85
87
if node_iri is None :
86
88
node_slug = "file-" + case_utils .local_uuid .local_uuid ()
87
- node_iri = rdflib . Namespace ( node_prefix ) [node_slug ]
89
+ node_iri = node_namespace [node_slug ]
88
90
n_file = rdflib .URIRef (node_iri )
89
91
graph .add ((n_file , NS_RDF .type , NS_UCO_OBSERVABLE .File ))
90
92
91
93
basename = os .path .basename (filepath )
92
94
literal_basename = rdflib .Literal (basename )
93
95
94
96
file_stat = os .stat (filepath )
95
- n_file_facet = rdflib . BNode ()
97
+ n_file_facet = node_namespace [ "file-facet-" + case_utils . local_uuid . local_uuid ()]
96
98
graph .add (
97
99
(
98
100
n_file_facet ,
@@ -119,7 +121,9 @@ def create_file_node(
119
121
graph .add ((n_file_facet , NS_UCO_OBSERVABLE .modifiedTime , literal_mtime ))
120
122
121
123
if not disable_hashes :
122
- n_contentdata_facet = rdflib .BNode ()
124
+ n_contentdata_facet = node_namespace [
125
+ "content-data-facet-" + case_utils .local_uuid .local_uuid ()
126
+ ]
123
127
graph .add ((n_file , NS_UCO_CORE .hasFacet , n_contentdata_facet ))
124
128
graph .add (
125
129
(n_contentdata_facet , NS_RDF .type , NS_UCO_OBSERVABLE .ContentDataFacet )
@@ -191,7 +195,7 @@ def create_file_node(
191
195
for key in successful_hashdict ._fields :
192
196
if key not in ("md5" , "sha1" , "sha256" , "sha512" ):
193
197
continue
194
- n_hash = rdflib . BNode ()
198
+ n_hash = node_namespace [ "hash-" + case_utils . local_uuid . local_uuid ()]
195
199
graph .add ((n_contentdata_facet , NS_UCO_OBSERVABLE .hash , n_hash ))
196
200
graph .add ((n_hash , NS_RDF .type , NS_UCO_TYPES .Hash ))
197
201
graph .add (
0 commit comments