def create_file_node(self, doc_file):
file_node = URIRef('<STR_LIT>'.format(<EOL>id=str(doc_file.spdx_id)))<EOL>type_triple = (file_node, RDF.type, self.spdx_namespace.File)<EOL>self.graph.add(type_triple)<EOL>name_triple = (file_node, self.spdx_namespace.fileName, Literal(doc_file.name))<EOL>self.graph.add(name_triple)<EOL>if doc_file.has_optional_field('<STR_LIT>'):<EOL><INDENT>comment_triple = (file_node, RDFS.comment, Literal(doc_file.comment))<EOL>self.graph.add(comment_triple)<EOL><DEDENT>if doc_file.has_optional_field('<STR_LIT:type>'):<EOL><INDENT>ftype = self.spdx_namespace[self.FILE_TYPES[doc_file.type]]<EOL>ftype_triple = (file_node, self.spdx_namespace.fileType, ftype)<EOL>self.graph.add(ftype_triple)<EOL><DEDENT>self.graph.add((file_node, self.spdx_namespace.checksum, self.create_checksum_node(doc_file.chk_sum)))<EOL>conc_lic_node = self.license_or_special(doc_file.conc_lics)<EOL>conc_lic_triple = (file_node, self.spdx_namespace.licenseConcluded, conc_lic_node)<EOL>self.graph.add(conc_lic_triple)<EOL>license_info_nodes = map(self.license_or_special, doc_file.licenses_in_file)<EOL>for lic in license_info_nodes:<EOL><INDENT>triple = (file_node, self.spdx_namespace.licenseInfoInFile, lic)<EOL>self.graph.add(triple)<EOL><DEDENT>if doc_file.has_optional_field('<STR_LIT>'):<EOL><INDENT>comment_triple = (file_node, self.spdx_namespace.licenseComments, Literal(doc_file.license_comment))<EOL>self.graph.add(comment_triple)<EOL><DEDENT>cr_text_node = self.to_special_value(doc_file.copyright)<EOL>cr_text_triple = (file_node, self.spdx_namespace.copyrightText, cr_text_node)<EOL>self.graph.add(cr_text_triple)<EOL>if doc_file.has_optional_field('<STR_LIT>'):<EOL><INDENT>notice_triple = (file_node, self.spdx_namespace.noticeText, doc_file.notice)<EOL>self.graph.add(notice_triple)<EOL><DEDENT>contrib_nodes = map(lambda c: Literal(c), doc_file.contributors)<EOL>contrib_triples = [(file_node, self.spdx_namespace.fileContributor, node) for node in contrib_nodes]<EOL>for triple in contrib_triples:<EOL><INDENT>self.graph.add(triple)<EOL><DEDENT>return file_node<EOL>
Create a node for spdx.file.