Reducing duplicated code when using many Netlogo Link Breeds Background

I am using many link breeds in Netlogo. I created various getter/setter and lookup functions for each of these breeds. 

Issue

I need to increase my links from 5 different breeds to 44 breeds. And I'm sure copy and pasting these lines of code is not the best approach. If this was a Bash-Shell I would use Indirect Parameter Expansion to reduce the amount of code. 

How can I increase the number of link breeds without duplicating so many lines of code?

Code

Declaration

undirected-link-breed [infection-activities infect-activity]
undirected-link-breed [exposure-activities exposure-activity]
undirected-link-breed [watch-activities watch-activity]
undirected-link-breed [mutation-activities mutation-activity]
undirected-link-breed [spillover-activities spillover-activity]
undirected-link-breed [unknown-activities unknown-activity]


Instantiation

infection-activities-own[
  activity-size
  activity-history
]
exposure-activities-own[
  activity-size
  activity-history
]
watch-activities-own[
  activity-size
  activity-history
]
mutation-activities-own[
  activity-size
  activity-history
]
spillover-activities-own[
  activity-size
  activity-history
]
unknown-activities-own[
  activity-size
  activity-history
]


Some Sample Getters Functions

to-report get-activity-from-field-surveillance
  let activity-breed [breed] of one-of links
  report get-activity-breed-common-name activity-breed
end

to-report get-activity-breed-common-name [layer]
  if layer = infection-activities [report "infection" ]
  if layer = exposure-activities [report "exposure" ]
  if layer = watch-activities [report "watch" ]
  if layer = mutation-activities [report "mutation" ]
  if layer = spillover-activities [report "spillover" ]
end

to-report get-activity [layer]
  set num-edges num-edges + 1
  if layer = "infection" [report infection-activities ]
  if layer = "exposure" [report exposure-activities ]
  if layer = "watch" [report watch-activities ]
  if layer = "mutation" [report mutation-activities ]
  if layer = "spillover" [report spillover-activities ]
  report "ACTIVITY not found"
end

to-report get-activity-breed-for-link [layer selected-agent selected-vector]
  let vector-who get-vector-who selected-vector
  let agent-who get-agent-who selected-agent
  set num-edges num-edges + 1
  if layer = "infection" [report infect-activity vector-who agent-who]
  if layer = "exposure" [report exposure-activity vector-who agent-who]
  if layer = "watch" [report watch-activity vector-who agent-who]
  if layer = "mutation" [report mutation-activity vector-who agent-who]
  if layer = "spillover" [report spillover-activity vector-who agent-who]
  report "ACTIVITY not found"
end

to-report get-activity-color [layer]
  if layer = "infection" [report blue ]
  if layer = "exposure" [report 113 ]
  if layer = "watch" [report brown ]
  if layer = "mutation" [report yellow ]
  if layer = "spillover" [report green ]
  report "ACTIVITY not found"
end
As far as breeds go, I don't know of any other way to build up the amount other than by copying and pasting. Of course, you can automate the creation in another language and then copy that into NetLogo, but in NetLogo itself I don't think there's any way. 

As far as instantiation goes, you can trim down to the more generic links-own and all breeds will inherit those variables:

links-own [
  activity-size
  activity-history
]


For the different getter functions, I wonder if you could make use of dictionaries with the table extension. For example, using your get-activity [layer] reporter as a guide, build an example dictionary that has the key-value pairs defined in your if statements. Assuming this header info:

extensions [ table ]

globals [ 
  layer-activity-dict 
  layer-color-dict
]

undirected-link-breed [infection-activities infect-activity]
undirected-link-breed [exposure-activities exposure-activity]
undirected-link-breed [watch-activities watch-activity]


Start by building the toy dictionary and creating some turtles and a link:

to setup
  ca
  ; build the activity dictionary
  set layer-activity-dict table:make
  let keys [ "infection" "exposure" "watch" ]
  let vals [ "infection-activities" "exposure-activities" "watch-activities" ]
  ( foreach keys vals [ [ k v ] -&gt;
    table:put layer-activity-dict k v 
    ] )

  ; build turtles and some links
  crt 10 [ setxy random-xcor random-ycor ]
  ask n-of 5 turtles [ 
    create-watch-activity-with one-of other turtles 
  ]
  ask n-of 5 turtles [ 
    create-infect-activity-with one-of other turtles 
  ]
  reset-ticks
end


To make use of the dictionary, try something like this reporter, which uses runresult to parse the text from the dictionary entry:

to-report get-activity [layer] ; link-reporter
  report runresult ( table:get layer-activity-dict layer )
end


Testing:

to go
  print get-activity "infection"
  print "Does get-activity return a string?"
  print is-string? get-activity "infection"
  print "Does get-activity return an agentset?"
  print is-agentset? get-activity "infection"

  ask get-activity "infection" [ 
    set color red
  ]
  ask get-activity "watch" [
    set color blue
  ]
end


Note that the reporter structure will vary depending on what your dictionary actually contains. For example, for color there is no runresult needed:

to setup-2
  ca
  ; build the color dictionary
  set layer-color-dict table:make
  let keys [ "infection" "exposure" "watch" ]
  let vals [ blue 113 brown ]
  ( foreach keys vals [ [ k v ] -&gt;
    table:put layer-color-dict k v 
    ] )

  print get-color "infection"
end


to-report get-color [layer] ; link-reporter
  report table:get layer-color-dict layer 
end