views:

129

answers:

0

Hi, I would like to bulk load the wurfl database (http://wurfl.sourceforge.net/) and I am not quite sure how to structure my data entities as well as how to write the transforms for the bulkloader config file.

Here is a sample of a node from the wurfl file:

<device id="generic" user_agent="" fall_back="root"> 
   <group id="product_info"> 
     <capability name="mobile_browser" value=""/> 
     <capability name="nokia_feature_pack" value="0"/> 
     <capability name="device_os" value=""/> 
     <capability name="nokia_series" value="0"/> 
     <capability name="model_extra_info" value=""/> 
     <capability name="marketing_name" value=""/> 
     <capability name="can_assign_phone_number" value="true"/> 
     <capability name="release_date" value="2002_january"/> 
     <capability name="unique" value="true"/> 
   </group> 
   <group id="wml_ui"> 
     <capability name="icons_on_menu_items_support" value="false"/> 
     <capability name="opwv_wml_extensions_support" value="false"/> 
     <capability name="built_in_back_button_support" value="false"/> 
     <capability name="proportional_font" value="false"/> 
     <capability name="wml_displays_image_in_center" value="false"/> 
     <capability name="elective_forms_recommended" value="true"/> 
     <capability name="times_square_mode_support" value="false"/> 
   </group> 

There are many more group's. So far this is my bulk loader config file transformers section:

transformers:
- kind: Device
  connector: simplexml
  connector_options:
     xpath_to_nodes: /wurfl/devices/device
     style: attribute_centric
  property_map:
     - property: name
       external_name: id

     - property: user_agent
       external_name: user_agent

     - property: product_info
       external_name: product_info
       import_transform: transform.list_from_child_node("group/capability")
       export_transform: transform.child_node_from_list("capability")

I am not sure if my last property (product_info) will work. Going forward I would like to create a class / entity / kind (not sure what to call it) for each group meaning I will have a classes called ProductInfo, WmlUi, etc...

I am not sure how to link these other classes to the Device they belong to when I do the import though. I assume I should change the key for the Device 'kind' to be the id of the device from the xml doc, in this example that would be 'generic'. But how do I reference it when importing the ProductInfo 'kind'? As I would assume my xpath_to_nodes would like like this: /wurfl/devices/device/group

Is this even the right approach for the Google DataStore?

Thanks.