概念/对象的数据转换
<h2>概念</h2>
<ol>
<li>从Concept_Summary_Table 获取概念列表 concept_li</li>
<li>遍历concept_li 提取概念名concept_name</li>
<li>提取concept_name对应的数据 c=Concept(concept_name)
c.details
<pre><code>{u'aka': u'搞笑剧,剧场',
u'allow_upload': True,
u'engname': u'c134',
u'expression': u'',
u'isabstract': u'false',
u'name': u'电影',
u'namevalid': True,
u'ordered': False,
u'regex': u'',
u'type': u'normal'}</code></pre>
<p>4.获取有效数据</p>
<pre><code>{
u'aka': u'搞笑剧,剧场',
u'engname': u'c134',
u'name': u'电影',
u'type': u'normal',
u'cuser':'root',
u'summary':'',
u'image':'',
u'ctime':'', # 当时时间
u'mtime':'',# 当时时间
u'update_time':'',# 当时时间
}</code></pre>
<p>5.补充概念数据</p>
<pre><code>c=Concept(concept_name)
front_type =c.getFrontType('_ftype')
obj_number=c.getObjectNumber()
all_obj_number=c.getObjectNumber(True)
code=engname.replace('c')
cpath=ConceptBuild()._getConceptCpath(concept_name)
units={} // 目前数值概念暂无单位
object_group=[] // 目前概念暂无数据
meta_type=''
relation_stat={u'_compression_rate': 3.024912,u'_related_number': 0.0,u'_related_stregth': 0.045569}
从c.getProperty()
数据:{u'_compression_rate': 3.024912,u'_related_number': 0.0,u'_related_stregth': 0.045569}</code></pre>
<p>6.补充 name_mappers name_roots</p>
<pre><code>name_mappers, name_roots = mapManager.getConceptNameMappersAndNameRoots(data['name'], data['aka'])</code></pre>
<p>7.写入数据
最终数据</p>
<pre><code>{
u'aka': u'搞笑剧,剧场',
u'engname': u'c134',
u'name': u'电影',
u'type': u'normal',
u'cuser':'root',
u'summary':'', # 概念暂无
u'image':'', # 概念暂无
u'ctime':'', # 当时时间
u'mtime':'',
u'update_time':'',
'front_type' :c.getFrontType('_ftype'),
'obj_number':c.getObjectNumber(),,
'all_obj_number':c.getObjectNumber(True),
'code':engname.replace('c'),
'cpath':ConceptBuild()._getConceptCpath(concept_name),
'units':{},// 目前数值概念暂无单位
'object_group':[], // 目前概念暂无数据
'meta_type':'',// 目前概念暂无数据
'relation_stat':{u'_compression_rate': 3.024912,u'_related_number': 0.0,u'_related_stregth': 0.045569}
'name_mappers':[], # mapManager.getConceptNameMappersAndNameRoots(data['name'], data['aka'])
'name_roots':[], # mapManager.getConceptNameMappersAndNameRoots(data['name'], data['aka'])
},</code></pre>
<p>直接写入这个键中Concept_Summary_Table</p></li>
</ol>
<h2>对象</h2>
<ol>
<li>主键 o=Object(obj_key)</li>
<li>获取对象的基本信息 o.details
<pre><code>{u'aka': None,
u'c_name': u'漫画形象',
u'name': u'c302_e8VI94Kx',
u'obj_name': u'白小飞',
u'resource': None,
u'structure': None}</code></pre></li>
<li>
<p>获取有效数据</p>
<pre><code>{
u'aka': '',
u'c_name': u'漫画形象',
u'name': u'c302_e8VI94Kx',
u'preffix':'',# 对象暂无 默认空字符串
u'suffix':'',# 对象暂无 默认空字符串
u'obj_name': u'白小飞',
u'structure':'',,# 对象暂无 默认空字符串
u'base_object':'',,# 对象暂无 默认空字符串
u'cuser':'root',
u'ctime':'', # 当时时间
u'mtime':'', # 当时时间
u'update_time':'',# 当时时间
}</code></pre>
</li>
<li>加工数据
<pre><code>cpath=concept.cpath
summary=''
image = ''
video = ''
audio = ''
belong_object=''
sub_objects=[]
relation_stat={}# SearchBasicFunctions.py中 CategorizeObjectDimensions()
# 必须现有relation_stat 才可以计算relation_snapshot
relation_snapshot={}
object_group=[]</code></pre></li>
<li>根据对象的类型补充values和ext_data数据
检查对象是否是数字对象,如果是如下,如果不是默认为空字典
<pre><code>values={number=o.numbers,unit=o.unit}</code></pre>
<p>检查对象是否是geo对象,如果是如下,如果不是默认为空字典</p>
<pre><code>ext_data={lon=o.lon,lat=o.lat}</code></pre></li>
</ol>
<p>6.补充 name_mappers name_roots</p>
<pre><code>name_mappers, name_roots = mapManager.getConceptNameMappersAndNameRoots(data['name'], data['aka'])</code></pre>
<p>7.从对象的附加属性中删除unit</p>
<p>8.写入数据
最终数据</p>
<pre><code>{
u'aka': '',
u'c_name': u'漫画形象',
u'name': u'c302_e8VI94Kx',
u'preffix':'',# 对象暂无 默认空字符串
u'suffix':'',# 对象暂无 默认空字符串
u'obj_name': u'白小飞',
u'structure':'', # 对象暂无
u'base_object':'', # 对象暂无
u'cuser':'root',
u'ctime':'', # 当时时间
u'mtime':'',
u'update_time':'',
'cpath'=concept.cpath,
'summary'='',// 是如果对象附加属性有_summary则写入,如果_info的文本长度小于100,排除_info是资源文本标签
'image '=' o.img[0],
'video '=' o.video[0],
'audio '=' o.audio[0],
'belong_object'='', # 对象暂无
'sub_objects'=[], # 对象暂无
'relation_stat'={}, # 对象暂无
'relation_snapshot'={}, # 对象暂无
'object_group'=[], # 对象暂无
'name_mappers':[],# mapManager.getConceptNameMappersAndNameRoots(data['name'], data['aka'])
'name_roots':[],# mapManager.getConceptNameMappersAndNameRoots(data['name'], data['aka'])
'values':{number=o.numbers,unit=o.unit}
'ext_data':{lon=o.lon,lat=o.lat}
}</code></pre>
<p>直接插入到表名 概念_Object_Basic_Table </p>