-
Notifications
You must be signed in to change notification settings - Fork 6
processing error with create.network_data.from.file module (gml) #27
Comments
Do you think it'd be fair to assume that if a gml file has no 'label' attribute, the 'id' attribute should be used? Or could the node_id in a gml file also have a different name than 'id'? The reason I'm asking is, we could make it easier for users by trying to import a gml file as is, without the label input option, and if we get a processing error we try again, this time with label set to 'id'. This would only work if the 'id' field can be relied upon to exist. And also that if there is a label, the attribute is called 'label'. Which, if I think about it, is probably not the case, since otherwise networkx wouldn't let us specify a custom one? |
Apparently, node "id" cannot be relied upon to exist for all nodes, because the field is not necessary for isolated nodes (nodes that are not connected to any other nodes). (Reference: https://intranet.icar.cnr.it/wp-content/uploads/2018/12/RT-ICAR-PA-2018-06.pdf). Although, in that case networkX will also throw an error: node #X has no 'id' attribute. Also "label" can be entirely missing or there could be a "name" field which has the same function. (Reference: http://docs.yworks.com/yfiles/doc/developers-guide/gml.html). After some experimenting, "label" seems to be an entirely custom field that could be called anything ('tag', 'description', or whatever). Apart from all possible gml file variations, I have never seen a gml file without node ids. |
Ok, I guess it doesn't hurt to just try again with the 'id' string as 'label'. If it doesn't work, we'd have needed another input anyway, and if it does, we at least have a valid 'network_data' dataset. And even if it has a potentially incorrect label (but I'd guess it's more often we have no label than one that isn't using the 'label' attribute), we can always have a module that can 'clean' up those kind of things (which we'll need anyway I think). The strategy I'm going for here is that it's better to have a good chance of something working without needing any additional user input (that could be confusing, cluttering up our UI, even though it would not be needed in a majority of the cases). If our bet is wrong, and most of the cases are very specific, then we have to have a more powerful module anyway, but at least we'll have some evidence that it's necessary, and a good idea what it needs to be able to handle. Anyway, I'll implement this 'try with 'id' label if it fails' case for the next version, and then we'll see where we are at. |
Actually, I can add a 3rd one if the 2nd one fails, which tries the 'name' attribute. |
Describe the bug
When trying to create network data from a gml file that does not have "label" attributes networkX will throw a processing error "node #0 has no 'label' attribute".
To Reproduce
Steps to reproduce the behavior:
Expected behavior
If a gml file does not have a label attribute, it should be possible to set label attribute to id. Every gml file will at least have node ids; labels are optional. However, label should not be set to id by default, because otherwise existing label information is not onboarded.
My temporary solution was to add an optional "label" input for onboarding gml file format.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: