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 #40: Looping and Multiple Structure File Ingest
generator agent: http://rdfs.org/sioc/wp-sioc.php

CWPK #40: Looping and Multiple Structure File Ingest
type: Post
has container: weblog
has creator: Mike Bergman
maker: Mike Bergman
created: 2020-09-22T15:19:27Z
content: We Build Up Our Ingest Routine to All Structure Now that we have a template for structure builds in this Cooking with Python and KBpedia series, we continue to refine that template to generalize the routine and expand it to looping over multiple input files and to apply it to property structure as well. These are the topics we cover in this current installment, with a detour as I explain below. In order to prep for today's material, I encourage you to go back and look at the large routine we developed in the last installment. We can see three areas we need to address in order to generalize this routine: First, last installment's structure build routine (as designed) requires three passes to complete file ingest. Each one of those passes has a duplicate code section to convert our file input forms to required shorter versions. We would like to extract these duplicates as a helper function in order to lesson code complexity and improve readability Second, we need a more generic way of specifying the input file or files to be processed by the routine, preferably including being able to loop over and process all of the files in a given input dictionary (as housed in config.py), and Third, we would like to generalize the approach to dealing with class hierarchical structure to also deal with property ingest and hierarchical structure. So, with these objectives in mind, let's begin. Adding a Helper Function For reference, here is the code block in the prior installment that we repeat three times, and for which we would like to develop a helper function (BTW, this code block will not run here in isolation): id = row['id'] parent = row['parent'] id = id.replace('http://kbpedia.org/kko/rc/', 'rc.') id = id.replace('http://kbpedia.org/ontologies/kko#', 'kko.') id_frag = id.replace('rc.', '') id_frag = id_frag.replace('kko.', '') parent = parent.replace('http://kbpedia.org/kko/rc/', 'rc.') parent = parent.replace('http://kbpedia.org/ontologies/kko#', 'kko.') parent = parent.re…
encoded: We Build Up Our Ingest Routine to All Structure Now that we have a template for structure builds in this Cooking with Python and KBpedia series, we continue to refine that template to generalize the routine and expand it to looping over multiple input files and to apply it to property structure as well. These are the topics we cover in this current installment, with a detour as I explain below. In order to prep for today’s material, I encourage you to go back and look at the large routine we developed in the last installment. We can see three areas we need to address in order to generalize this routine: First, last installment’s structure build routine (as designed) requires three passes to complete file ingest. Each one of those passes has a duplicate code section to convert our file input forms to required shorter versions. We would like to extract these duplicates as a helper function in order to lesson code complexity and improve readability Second, we need a more generic way of specifying the input file or files to be processed by the routine, preferably including being able to loop over and process all of the files in a given input dictionary (as housed in config.py), and Third, we would like to generalize the approach to dealing with class hierarchical structure to also deal with property ingest and hierarchical structure. So, with these objectives in mind, let’s begin. Adding a Helper Function For reference, here is the code block in the prior installment that we repeat three times, and for which we would like to develop a helper function (BTW, this code block will not run here in isolation): id = row['id'] parent = row['parent'] id = id.replace('http://kbpedia.org/kko/rc/', 'rc.') id = id.replace('http://kbpedia.org/ontologies/kko#', 'kko.') id_frag = id.replace('rc.', '') id_frag = id_frag.replace('kko.', '') parent = parent.replace('http://kbpedia.org/kko/rc/', 'rc.') parent = parent.replace('http://kbpedia.org/ontologies/kko#', 'kko.') parent = parent.re…
topic: CWPK
topic: KBpedia
topic: Semantic Web Tools
has reply: comment-507588
has reply: comment-507589
has reply: comment-507590
links to: Cooking with Python and KBpedia
links to: cb1-1
links to: cb1-2
links to: cb1-3
links to: cb1-4
links to: cb1-5
links to: cb1-6
links to: cb1-7
links to: cb1-8
links to: cb1-9
links to: cb1-10
links to: cb1-11
links to: cb1-12
links to: cb2-1
links to: cb2-2
links to: cb2-3
links to: cb2-4
links to: cb2-5
links to: cb2-6
links to: cb2-7
links to: cb2-8
links to: cb2-9
links to: cb2-10
links to: cb2-11
links to: cb2-12
links to: cb2-13
links to: cb2-14
links to: cb2-15
links to: cb2-16
links to: cb2-17
links to: cb2-18
links to: cb2-19
links to: cb2-20
links to: cb2-21
links to: cb2-22
links to: cb2-23
links to: cb2-24
links to: cb2-25
links to: cb2-26
links to: cb2-27
links to: cb2-28
links to: cb2-29
links to: cb2-30
links to: cb2-31
links to: cb2-32
links to: cb2-33
links to: cb2-34
links to: cb2-35
links to: cb2-36
links to: cb2-37
links to: CSV
links to: KBpedia
links to: CWPK #28
links to: CWPK #35
links to: roundtrip
links to: cb3-1
links to: cb3-2
links to: cb3-3
links to: cb3-4
links to: cb3-5
links to: cb3-6
links to: cb3-7
links to: cb3-8
links to: cb3-9
links to: cb3-10
links to: cb3-11

Mike Bergman
type: User

Mike Bergman
type: Person

Cooking with Python and KBpedia
label: CWPK listing

KBpedia

direct download

notify me