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.
The filter requires the following parameters to work
- A namespace to use
- A server and pool of a noids service to use
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:
-
Any item not of type
fobject
is skipped. -
Any item of type
fobject
which does not have apid
field will be assigned one using the provided namespace and an identifier generated by the noids service. -
Any item of type
fobject
which has a label in itspid
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. -
Any item of type
fobject
which otherwise has apid
is skipped.
The filter uses the following rules to provide for linking in the RELS-EXT section:
-
Any item not of type
fobject
is skipped. -
Any item of type
fobject
with norels-ext
section is skipped. -
Any item of type
fobject
with arels-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.
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)
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.
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"
}
]