SFULibrary / islandora_rest_ingester

Command-line tool for ingesting objects via the Islandora REST interface
The Unlicense
3 stars 0 forks source link

Add ability to add arbitrary relationships #1

Closed mjordan closed 6 years ago

mjordan commented 7 years ago

We need to be able to add arbitrary relationships. Not sure how to best implement this on the command line though.

Adding relationships necessary for compound, paged, newspapers, etc. is related to this.

mjordan commented 7 years ago

First step will be to break out the add relationship REST calls into a function so we can reuse it for arbitrary relationships.

mjordan commented 6 years ago

One option is to encode relationships in a file that corresponds to each object. The structure of the relationship data should correspond to Islandora REST's pattern for expressing relationships:

Variable Name Description
uri The predicate URI for the given predicate.
predicate The predicate of the relationship.
object Object of the relationship.
type The type of the relationship object. Can be either 'uri', 'string', 'int', 'date', 'none'. Defaults to 'uri'.

The object-level file could be in JSON or YAML. The ingester would read this file and issue REST requests for each of the relationships expressed in the file.

mjordan commented 6 years ago

YAML example:

relationships:
  - uri: "I am a URI"
    predicate: "I am a predicate"
    object: "I am an object"
    type: "I am a type"
  - uri: "I am another URI"
    predicate: "I am another predicate"
    object: "I am another object"
    type: "I am another type"

JSON example:

{"relationships":[{"uri":"I am a URI","predicate":"I am a predicate","object":"I am an object","type":"I am a type"},{"uri":"I am another URI","predicate":"I am another predicate","object":"I am another object","type":"I am another type"}]}

or

{
  "relationships": [
    {
      "uri": "I am a URI",
      "predicate": "I am a predicate",
      "object": "I am an object",
      "type": "I am a type"
    },
    {
      "uri": "I am another URI",
      "predicate": "I am another predicate",
      "object": "I am another object",
      "type": "I am another type"
    }
  ]
}
mjordan commented 6 years ago

https://github.com/mjordan/islandora_rest_ingester/blob/issue-9/includes/Ingester.php#L119 provides a generic method for adding relationships. How additional relationships are expressed for ingesting at the object level is still open.

mjordan commented 6 years ago

Added with f48d115d9aff16481ab78faa32a9f7b9cb15e363. Relationships must be expressed in JSON.