Skip to content

Latest commit

 

History

History
111 lines (78 loc) · 3.26 KB

labels.md

File metadata and controls

111 lines (78 loc) · 3.26 KB

Pid Assigner Filter (aka Labels)

This filter will assign pids to objects which don't have one, and provides a labeling system so items without pids and still be linked together using RELS-EXT relationships.

More thought is needed on how to provide linking in RDF since RDF requires a full URI for subjects and objects.

Parameters

The filter requires the following parameters to work

  • A namespace to use
  • A server and pool of a noids service to use

Output

The service does two things: it assigns identifiers to objects, and it provides identifiers for linking in the RELS-EXT section. The filter uses the following rules to assign identifiers to objects:

  1. Any item not of type fobject is skipped.

  2. Any item of type fobject which does not have a pid field will be assigned one using the provided namespace and an identifier generated by the noids service.

  3. Any item of type fobject which has a label in its pid field will be assigned an pid using the provided namespace and an identifier generated by the noids service. The label will be defined to be the generated identifier.

  4. Any item of type fobject which otherwise has a pid is skipped.

The filter uses the following rules to provide for linking in the RELS-EXT section:

  1. Any item not of type fobject is skipped.

  2. Any item of type fobject with no rels-ext section is skipped.

  3. Any item of type fobject with a rels-ext section has all identifiers which are labels substituted with the pid assigned to the label. It is an error to use a label which cannot be resolved. See Resolution.

Labels

A label has the same textual form whether it is used to assign a pid or to reference an assigned pid. A label begins with a dollar sign and an open parenthesis, contains a label name, and ends with a close parenthesis. For example, $(label-name) A label name may contain any character except close parenthesis ). Labels which end with the following strings are reserved:

-noid
-ns
-info

These suffixes are reserved for future use as providing alternate forms of an identifier.

I see the replacement of labels in text blocks as a possible way to adapt this to use in the descMetadata field, e.g.

https://curate.nd.edu/show/$(label-noid)

Resolution

Identifiers do not need to be defined before they are referenced; they merely need to be defined eventually. This property allows for complicated object constellations such as cycles, and even self-references. It also makes it easier to create input files since ROF creators do not need to make sure objects which define a label are listed before any references to that label.

Example

The following code shows how a list of objects with labels is transformed. The input is

[
  {
    "type" : "fobject",
    "pid"  : "$(first)"
  },
  {
    "type" : "fobject",
    "rels-ext" : {
        "memberOf" : ["$(first)", "$(second)"]
    }
  },
  {
    "type" : "fobject",
    "pid"  : "$(second)"
  }
]

Results in the following output after applying the filter.

[
  {
    "type": "fobject",
    "pid": "temp:001"
  },
  {
    "type": "fobject",
    "rels-ext": {
      "memberOf": [
        "temp:001",
        "temp:003"
      ]
    },
    "pid": "temp:002"
  },
  {
    "type": "fobject",
    "pid": "temp:003"
  }
]