Islandora / documentation

Contains islandora's documentation and main issue queue.
MIT License
103 stars 71 forks source link

Use context to set rdf:type based on model and media_use taxonomy terms #1065

Closed dannylamb closed 5 years ago

dannylamb commented 5 years ago

Right now, everything's a PCDM Object or PCDM File, but nothing is an "Collection" or "Original File" or any of the taxonomy terms we're using. That information needs to make its way into the RDF, fedora, and the triplestore.

dannylamb commented 5 years ago

I think these also solve (sort of) solve https://github.com/Islandora-CLAW/CLAW/issues/1001 from @kayakr

seth-shaw-unlv commented 5 years ago

This context config should do it for the Repository item based on field_model:

langcode: en
status: true
dependencies:
  module:
    - islandora
    - node
name: repository_item_type_override
label: 'Repository Item Type Override'
group: Islandora
description: ''
requireAllConditions: false
disabled: false
conditions:
  node_type:
    id: node_type
    bundles:
      islandora_object: islandora_object
    negate: 0
    context_mapping:
      node: '@node.node_route_context:node'
reactions:
  alter_jsonld_type:
    id: alter_jsonld_type
    source_field: field_model
    saved: false
weight: 0

This creates, for a repository item with title "Test" and model set to 'Image', the JSON-LD:

{
  "@graph":[
    {
      "@id":"http://localhost:8000/node/1?_format=jsonld",
      "@type":[
        "http://pcdm.org/models#Object",
        "http://purl.org/coar/resource_type/c_c513"
      ],
      "http://purl.org/dc/terms/title":[
        {
          "@value":"Test",
          "@language":"en"
        }
      ],
      "http://schema.org/author":[
        {
          "@id":"http://localhost:8000/user/1?_format=jsonld"
        }
      ],
      "http://schema.org/dateCreated":[
        {
          "@value":"2019-03-15T19:31:20+00:00",
          "@type":"http://www.w3.org/2001/XMLSchema#dateTime"
        }
      ],
      "http://schema.org/dateModified":[
        {
          "@value":"2019-03-15T19:31:32+00:00",
          "@type":"http://www.w3.org/2001/XMLSchema#dateTime"
        }
      ],
      "http://purl.org/dc/terms/extent":[
        {
          "@value":"1 item",
          "@type":"http://www.w3.org/2001/XMLSchema#string"
        }
      ],
      "http://schema.org/sameAs":[
        {
          "@value":"http://localhost:8000/node/1?_format=jsonld"
        }
      ]
    },
    {
      "@id":"http://localhost:8000/user/1?_format=jsonld",
      "@type":[
        "http://schema.org/Person",
        "http://purl.org/coar/resource_type/c_c513"
      ]
    }
  ]
}
seth-shaw-unlv commented 5 years ago

Oh, I didn't notice you had PRs going up at the same time... silly me. Don't mind me, carry on.