Mercurial > hg > drupalISMI
comparison importFromOpenMind/importer/model2model.py @ 29:1a1877812757
include normalized attributes in neo4j with prefix "_n_"
author | casties |
---|---|
date | Thu, 10 Dec 2015 12:11:25 -0500 |
parents | a9bfd49355f8 |
children | 870b0b3b272f |
comparison
equal
deleted
inserted
replaced
28:a9bfd49355f8 | 29:1a1877812757 |
---|---|
25 'ALIAS': ['label']} | 25 'ALIAS': ['label']} |
26 | 26 |
27 | 27 |
28 # add URLs to nodes using an attribute in a pattern | 28 # add URLs to nodes using an attribute in a pattern |
29 #add_link_attributes = {'ismi_id': 'https://ismi-dev.mpiwg-berlin.mpg.de/drupal-ismi/entity/%s'} | 29 #add_link_attributes = {'ismi_id': 'https://ismi-dev.mpiwg-berlin.mpg.de/drupal-ismi/entity/%s'} |
30 add_link_attributes = {'ismi_id': 'https://ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/public/publicWitness.jsp?eid=%s'} | 30 add_link_attributes = {'ismi_id': 'https://ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/public/entityDetails.xhtml?eid=%s'} |
31 | 31 |
32 | 32 |
33 def fixName(name, is_src_rel=False, is_tar_rel=False, att_from_rel=False): | 33 def fixName(name, is_src_rel=False, is_tar_rel=False, att_from_rel=False): |
34 # these are too embarrassing... | 34 # these are too embarrassing... |
35 if 'FLORUIT' in name: | 35 if 'FLORUIT' in name: |
138 | 138 |
139 # then generate unique name | 139 # then generate unique name |
140 att_name = genAttName(src_attrs, att_name) | 140 att_name = genAttName(src_attrs, att_name) |
141 # add target node's attribute | 141 # add target node's attribute |
142 src_attrs[att_name] = tar_attrs.get(transfer_att) | 142 src_attrs[att_name] = tar_attrs.get(transfer_att) |
143 # also add normalized attribute | |
144 if '_n_'+transfer_att in tar_attrs: | |
145 src_attrs['_n_'+att_name] = tar_attrs.get('_n_'+transfer_att) | |
143 | 146 |
144 # contract target relations | 147 # contract target relations |
145 src_type = src_attrs['type'] | 148 src_type = src_attrs['type'] |
146 if src_type in contract_relations_into_attributes: | 149 if src_type in contract_relations_into_attributes: |
147 # get list of attributes to transfer | 150 # get list of attributes to transfer |
159 | 162 |
160 # then generate unique name | 163 # then generate unique name |
161 att_name = genAttName(tar_attrs, att_name) | 164 att_name = genAttName(tar_attrs, att_name) |
162 # add target node's attribute | 165 # add target node's attribute |
163 tar_attrs[att_name] = src_attrs.get(transfer_att) | 166 tar_attrs[att_name] = src_attrs.get(transfer_att) |
167 # also add normalized attribute | |
168 if '_n_'+transfer_att in src_attrs: | |
169 tar_attrs['_n_'+att_name] = src_attrs.get('_n_'+transfer_att) | |
164 | 170 |
165 cnt += 1 | 171 cnt += 1 |
166 if cnt % 100 == 0: | 172 if cnt % 100 == 0: |
167 print(" %s relations"%cnt) | 173 print(" %s relations"%cnt) |
168 | 174 |