Skip to content

Commit

Permalink
Fixes JSONLD endpoint fail for Extracted Text (#768)
Browse files Browse the repository at this point in the history
* wrapping string in array for case where there's no rdf mapping
* Adding rdf mapping for extracted text
  • Loading branch information
dannylamb authored Apr 1, 2020
1 parent 029bbcf commit 8b7caa9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
langcode: en
status: true
dependencies:
config:
- media.type.extracted_text
enforced:
module:
- islandora_text_extraction_defaults
module:
- media
id: media.extracted_text
targetEntityType: media
bundle: extracted_text
types:
- 'pcdm:File'
fieldMappings:
name:
properties:
- 'dcterms:title'
- 'rdf:label'
created:
properties:
- 'schema:dateCreated'
datatype_callback:
callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value'
changed:
properties:
- 'schema:dateModified'
datatype_callback:
callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value'
uid:
properties:
- 'schema:author'
mapping_type: rel
field_mime_type:
properties:
- 'ebucore:hasMimeType'
field_media_of:
properties:
- 'pcdm:fileOf'
mapping_type: rel
field_original_name:
properties:
- 'premis3:originalName'
field_tags:
properties:
- 'schema:additionalType'
mapping_type: rel
field_file_size:
properties:
- 'premis:hasSize'
3 changes: 3 additions & 0 deletions src/Plugin/ContextReaction/JsonldTypeAlterReaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public function execute(EntityInterface $entity = NULL, array &$normalized = NUL

// Search for the entity in the graph.
foreach ($normalized['@graph'] as &$elem) {
if (!is_array($elem['@type'])) {
$elem['@type'] = [$elem['@type']];
}
if ($elem['@id'] === $this->getSubjectUrl($entity)) {
foreach ($entity->get($config['source_field'])->getValue() as $type) {
// If the configured field is using an entity reference,
Expand Down

0 comments on commit 8b7caa9

Please sign in to comment.