Ultralink Autogeneration

Most of the time, Ultralinks are overlaid onto content as a result of Fragment Analysis inside an Ultralink Server. However, you also have the option of programmatically creating Ultralinks on the fly using the autogenUltralinks option.

You should autogenerate Ultralinks when it is not reasonable to create Ultralink or word entires for every matching possibility or if you cannnot predict what text your Ultralink will need to match against. An example would be if you have a specific field that you know always has a certain kind of information in it (like a person's name). Given a name, you can construct relevant links for an Ultralink, but maybe you can't predict or access the entire set of names that could show up in this location. We can still use the information from the surroundings to create useful Ultralinks.

The autogenUltralinks option is most appropriately used in conjunction with the scanningGuides option so that the location where you autogenerate Ultralinks can be specifically targeted.

Examples

In order to understand the format of the autogenUltralinks objects, let's go through some examples.

{
    "([a-zA-Z][a-zA-Z][a-zA-Z0-9]+-[a-zA-Z0-9]+(-[0-9]+)*)":
    {
        "links": { "mylinktype": { "URL": "https://some.server.com?search=MATCHEDWORD" } }
    }
}

Here we have an object that uses a regular expression string for a key, and the value of that entryimilar is an object that describes what links should be attached to the generated Ultralink. The regular expression keys dictate what kind of textual strings should be matched against when determining where and when an Ultralink should be generated. In this example, the given regular expression will match against strings that look like similar to: AJ3-B9, abc-z0, kTy-777, etc. These might be serial numbers or other identifying strings.

When the Ultralink code encounters strings in this format, it will create an Ultralink and add a link of type mylinktype with a URL of https://some.server.com?search=MATCHEDWORD where MATCHEDWORD is a special marker that is replaced by the actual text string that matched the regular expression.

{
    ".*":
    {
        "links": { "mylinktype":    { "URL": "https://some.server.com/?AUTOGENDATA" },
                   "otherlinktype": { "URL": "https://another.site.com/sub/directory/endpoint?AUTOGENDATA" },
                   "yetanotherlt":  { "URL": "https://one.more.site.com/?AUTOGENDATA" } }
    }
}

In this next example, we use a very broad, catch-all regular expression .* which essentially matches against any string. It is only appropriate to use this on very small and specific fragments as dictated by the scanningGuides option that can have any variety of text in them. You can also see here that we use another special keyword AUTOGENDATA. This is replaced by a string key/value pair URL arguments that has been constructed by the objects defined in autogenData field of the relevant scanningGuides path object. That object tells the Ultralink code to look around the environment near the newly generated Ultralink and pick up any data you want passed in to those constructed links. For detail on how this happens, head over to our Scanning Guides document.

PreviousPrev
Next