SIOC Post profile for "AI3:::Adaptive Information"
type: Document
description: A SIOC profile describes the structure and contents of a weblog in a machine readable form. For more information please refer to http://sioc-project.org/.
primary topic: CWPK #31: Reading and Writing Files
generator agent: http://rdfs.org/sioc/wp-sioc.php

CWPK #31: Reading and Writing Files
type: Post
has container: weblog
has creator: Mike Bergman
maker: Mike Bergman
created: 2020-09-08T17:08:40Z
content: We Are Now Generating Info That Requires Persistence We have been opening and using files for many installments in this Cooking with Python and KBpedia series. However, in the past few installments, our methods are also beginning to generate serious results, some of thousands of lines. It is time for us to learn the basic commands for writing and reading files. We will also weave in a new Python import into our workspace, the CSV module. It will be important for us as we begin to import the basic N3 and CSV files that underly KBpedia's build process. Another point we weave through today's installment is the usefulness of following Python's lead in composing the names of our files and methods in a hierarchical and logically named way. Such patterns mean we can more readily find and save the information we want to keep persistent. This patterning, along with some directory structure guidance we will address a few installments from now, help set up a logical way to manage and utilize the information assets in KBpedia (or your own domain extensions of it). Logical organization helps in a system designed for subset selections, semantic technology analysis, and machine learning, where the system itself is built from large, external files and we roundtrip with extractions from the current state of the graph. But reading and writing files is not a new subject for this series. Since early with our exposure to owlready2 and Jupyter Notebook we have been loading and inspecting parts of KBpedia. You may recognize this call from CWPK #19 regarding the smaller KKO (Kbpedia Knowledge Ontology) kko.owl. We have not set up this notebook page sufficiently yet in this installment, so if you run this cell you will get an error: onto.save(file = "C:/1-PythonProjects/kbpedia/sandbox/kko-test.owl", format = "rdfxml") File Object and Methods To get started, let's first focus on the file object and the methods that may be applied to it in Python. A 'file object' has the following components…
encoded: We Are Now Generating Info That Requires Persistence We have been opening and using files for many installments in this Cooking with Python and KBpedia series. However, in the past few installments, our methods are also beginning to generate serious results, some of thousands of lines. It is time for us to learn the basic commands for writing and reading files. We will also weave in a new Python import into our workspace, the CSV module. It will be important for us as we begin to import the basic N3 and CSV files that underly KBpedia‘s build process. Another point we weave through today’s installment is the usefulness of following Python’s lead in composing the names of our files and methods in a hierarchical and logically named way. Such patterns mean we can more readily find and save the information we want to keep persistent. This patterning, along with some directory structure guidance we will address a few installments from now, help set up a logical way to manage and utilize the information assets in KBpedia (or your own domain extensions of it). Logical organization helps in a system designed for subset selections, semantic technology analysis, and machine learning, where the system itself is built from large, external files and we roundtrip with extractions from the current state of the graph. But reading and writing files is not a new subject for this series. Since early with our exposure to owlready2 and Jupyter Notebook we have been loading and inspecting parts of KBpedia. You may recognize this call from CWPK #19 regarding the smaller KKO (Kbpedia Knowledge Ontology) kko.owl. We have not set up this notebook page sufficiently yet in this installment, so if you run this cell you will get an error: onto.save(file = "C:/1-PythonProjects/kbpedia/sandbox/kko-test.owl", format = "rdfxml") File Object and Methods To get started, let’s first focus on the file object and the methods that may be applied to it in Python. A ‘file object’ has the following components…
topic: CWPK
topic: KBpedia
topic: Semantic Web Tools
links to: Cooking with Python and KBpedia
links to: Python
links to: CSV
links to: N3
links to: KBpedia
links to: owlready2
links to: Jupyter Notebook
links to: CWPK #19
links to: KKO
links to: cb1-1
links to: UTF-8
links to: cb2-1
links to: cb3-1
links to: cb4-1
links to: cb4-2
links to: cb6-1
links to: cb6-2
links to: cb6-3
links to: cb6-4
links to: cb7-1
links to: cb7-2
links to: cb7-3
links to: cb8-1
links to: cb8-2
links to: cb8-3
links to: cb9-1
links to: cb9-2
links to: cb10-1
links to: cb10-2
links to: cb10-3
links to: cb11-1
links to: cb11-2
links to: cb11-3
links to: cb11-4
links to: cb11-5
links to: cb11-6
links to: cb12-1
links to: cb12-2
links to: cb12-3
links to: cb12-4
links to: cb12-5
links to: cb12-6
links to: cb13-1
links to: Python keywords
links to: cb14-1
links to: cb14-2
links to: cb14-3
links to: cb14-4
links to: cb14-5
links to: cb14-6
links to: cb15-1
links to: cb15-2
links to: cb15-3
links to: cb15-4
links to: cb16-1
links to: cb16-2
links to: cb16-3
links to: cb16-4
links to: cb16-5
links to: cb16-6
links to: cb16-7
links to: cb16-8
links to: cb16-9
links to: cb16-10
links to: cb17-1
links to: cb17-2
links to: cb17-3
links to: cb17-4
links to: cb17-5

Mike Bergman
type: User

Mike Bergman
type: Person

Cooking with Python and KBpedia
label: CWPK listing

RFC4180

Pandas

NumPy

Input and output

Guide to the Python print() Function

Python print() function

KBpedia

direct download

notify me