You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -206,6 +206,7 @@ There may be rare occasions in which you don't want the NW extension to remember
206
206
[`nw:save-graphml`](#nwsave-graphml)
207
207
[`nw:load-graphml`](#nwload-graphml)
208
208
[`nw:load`](#nwload)
209
+
[`nw:load-from-string`](#nwload-from-string)
209
210
[`nw:save`](#nwsave)
210
211
211
212
### Centrality Measures
@@ -1337,6 +1338,37 @@ Limitations:
1337
1338
1338
1339
1339
1340
1341
+
### `nw:load-from-string`
1342
+
1343
+
```NetLogo
1344
+
nw:load-from-string format data default-turtle-breed default-link-breed optional-command-block
1345
+
```
1346
+
1347
+
1348
+
Load `data` from an in-memory string rather than from a file. This is useful in NetLogo Web and other contexts where the data comes from somewhere other than the file system, such as the `fetch` or `resource` extensions.
1349
+
1350
+
Because there is no file name to infer the file-type from, the first argument, `format`, names the format explicitly. It is case-insensitive and an optional leading dot is ignored, so `"gml"`, `"GML"`, and `".gml"` are all equivalent. The supported formats are:
1351
+
1352
+
-`dl`
1353
+
-`gdf`
1354
+
-`gexf`
1355
+
-`gml`
1356
+
-`graphml`
1357
+
-`matrix`
1358
+
-`vna`
1359
+
1360
+
Aside from taking its data from a string and its format from the `format` argument, `nw:load-from-string` behaves exactly like the corresponding `nw:load-*` primitive, including matching node and edge attributes to turtle and link variables and honoring `breed`.
1361
+
1362
+
For example, to load a GML network fetched from a URL:
Load network `data` from an in-memory string rather than from a file. This is useful in NetLogo Web and other contexts where the data comes from somewhere other than the file system, such as the `fetch` or `resource` extensions.
1157
+
1158
+
Because there is no file name to infer the file-type from, the first argument, `format`, names the format explicitly. It is case-insensitive and an optional leading dot is ignored, so `"gml"`, `"GML"`, and `".gml"` are all equivalent. The supported formats are:
1159
+
1160
+
- `dl`
1161
+
- `gdf`
1162
+
- `gexf`
1163
+
- `gml`
1164
+
- `graphml`
1165
+
- `matrix`
1166
+
- `vna`
1167
+
1168
+
Aside from taking its data from a string and its format from the `format` argument, `nw:load-from-string` behaves exactly like the corresponding `nw:load-*` primitive, including matching node and edge attributes to turtle and link variables and honoring `breed`.
1169
+
1170
+
For example, to load a GML network fetched from a URL:
Copy file name to clipboardExpand all lines: documentation.yaml
+38Lines changed: 38 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1221,6 +1221,44 @@ primitives:
1221
1221
tags:
1222
1222
- io
1223
1223
type: command
1224
+
- arguments:
1225
+
- name: format
1226
+
type: string
1227
+
- name: data
1228
+
type: string
1229
+
- name: default-turtle-breed
1230
+
type: turtleset
1231
+
- name: default-link-breed
1232
+
type: linkset
1233
+
- name: optional-command-block
1234
+
type: optional command block
1235
+
description: |2
1236
+
1237
+
Load network `data` from an in-memory string rather than from a file. This is useful in NetLogo Web and other contexts where the data comes from somewhere other than the file system, such as the `fetch` or `resource` extensions.
1238
+
1239
+
Because there is no file name to infer the file-type from, the first argument, `format`, names the format explicitly. It is case-insensitive and an optional leading dot is ignored, so `"gml"`, `"GML"`, and `".gml"` are all equivalent. The supported formats are:
1240
+
1241
+
- `dl`
1242
+
- `gdf`
1243
+
- `gexf`
1244
+
- `gml`
1245
+
- `graphml`
1246
+
- `matrix`
1247
+
- `vna`
1248
+
1249
+
Aside from taking its data from a string and its format from the `format` argument, `nw:load-from-string` behaves exactly like the corresponding `nw:load-*` primitive, including matching node and edge attributes to turtle and link variables and honoring `breed`.
1250
+
1251
+
For example, to load a GML network fetched from a URL:
0 commit comments