Verifying the Behavior of Normalization in Archivematica

Overview In Archivematica, you can configure settings such as Normalization in Preservation Planning. This is a memo on verifying this behavior. Configuration Normalization-related settings can be checked at the following location. /fpr/fprule/normalization/ In the above, for items where Purpose is Preservation and Format is Truevision TGA Bitmap, it instructs to perform Transcoding to tif with convert as described in Command. Execution Example The following is used as the processing target. ...

August 23, 2024 · 1 min · Nakamura

Specifying Sort Order in Drupal Facets

Overview These are notes on specifying the sort order in Drupal Facets. Method You can change the facet settings by accessing the following: /admin/config/search/facets Clicking the edit button for each facet navigates to the following screen: At the bottom of the screen, there is a Facet sorting section where you can configure sorting by count and by name. To sort by name, uncheck Sort by count. Summary I hope this serves as a useful reference when working with Drupal. ...

August 23, 2024 · 1 min · Nakamura

Exporting Tropy Data to Omeka S

Overview I had the opportunity to export Tropy data to Omeka S, so this is a memo of the process. Instructions A machine translation of the official manual is provided at the end of this article. Usage Example Below is the Tropy screen. We used images from Irasutoya. As shown, it was possible to annotate images. Below is the result after exporting to Omeka S. The item was registered as a new item along with multiple media including cropped images. ...

August 23, 2024 · 5 min · Nakamura

Preventing Unpublished Content from Being Indexed by Drupal's Search API

Overview This is a memo on how to prevent unpublished content from being indexed by Drupal’s Search API. References This was also documented in the following article. https://www.acquia.com/jp/blog/introduction-to-search-api-1 Method It was necessary to enable “Entity status” at the following location: /admin/config/search/search-api/index/xxx/processors Summary We hope this serves as a useful reference.

August 20, 2024 · 1 min · Nakamura

Sample Program Using the Annotorious OpenSeadragon Plugin

Overview I created a sample program using the Annotorious OpenSeadragon Plugin that allows adding annotations to multiple images loaded from an IIIF manifest file. You can try it at the following link. https://nakamura196.github.io/nuxt3-demo/annotorious Source Code Please refer to the following. https://github.com/nakamura196/nuxt3-demo/blob/main/pages/annotorious/index.vue Key Points npm install –force The library @recogito/annotorious-openseadragon does not appear to support openseadragon v5, so a forced installation was necessary. npm error Could not resolve dependency: npm error peer openseadragon@"^3.0.0 || ^4.0.0" from @recogito/annotorious-openseadragon@2.7.18 npm error node_modules/@recogito/annotorious-openseadragon npm error @recogito/annotorious-openseadragon@"^2.7.18" from the root project plugins I loaded Annotorious as a plugin. ...

August 16, 2024 · 1 min · Nakamura

Setting Field-level Visibility (Public/Private) in Drupal

Overview In Omeka S, visibility can be set at the field level (public/private). These are notes on how to achieve this in Drupal. Installation composer.phar require 'drupal/field_permissions:^1.4' ./vendor/bin/drush en field_permissions Configuration Navigate to the edit page for a specific field of a content type, such as: /admin/structure/types/manage/bib_1/fields/node.bib_1.field_003_permission_number As shown below, you can configure the field visibility. Programmatic Access Field view permissions can be checked using the access function as follows. ...

August 16, 2024 · 1 min · Nakamura

Drupal: Troubleshooting Cache Clear Errors

Overview When clearing the cache in Drupal, the following error sometimes occurred. ./vendor/bin/drush cr In CheckExceptionOnInvalidReferenceBehaviorPass.php line 88: The service "access_check.contact_personal" has a dependency on a non-exist ent service "user.data". Here are my notes on how to resolve this error. References The following was helpful. https://www.drupal.org/forum/support/upgrading-drupal/2018-04-26/after-upgrade-to-853-the-service-access_checkcontact Solution A module named user had been created by the Features module. /modules/custom/user Deleting this resolved the error. Additional Note Similarly, a module named comment was also causing issues. Deleting it likewise resolved the error. ...

August 16, 2024 · 1 min · Nakamura

Applying Google Cloud Vision to Image Files to Create IIIF Manifests and TEI/XML Files

Overview I created a library that applies Google Cloud Vision to image files and generates IIIF manifest and TEI/XML files. https://github.com/nakamura196/iiif_tei_py This article explains how to use the library. Usage You can check the usage and more at the following page. https://nakamura196.github.io/iiif_tei_py/ Installing the Library Install the library from the GitHub repository. pip install https://github.com/nakamura196/iiif_tei_py Creating a GC Service Account Download a GC (Google Cloud) service account key (JSON file) by referring to articles such as the following. ...

August 8, 2024 · 4 min · Nakamura

Handling Errors When Updating Omeka S from v4.0.4 to v4.1

Overview During the Omeka S update process, the following error occurred. Fatal error: Uncaught ArgumentCountError: Too few arguments to function Omeka\View\Renderer\ApiJsonRenderer::__construct(), 0 passed This is a personal note on how to address this error. Solution The solution was found at the following link. https://forum.omeka.org/t/upgrade-from-4-0-4-to-4-1-failed/22281 Specifically, uninstalling the Next module resolved the above issue. Summary I hope this serves as a useful reference for those encountering the same issue.

August 1, 2024 · 1 min · Nakamura

Updating Omeka S

Overview This is a personal note on updating Omeka S. Please also refer to the following official documentation. https://omeka.org/s/docs/user-manual/install/#updating Preparation: Backup Before performing update operations, be sure to create backups of the database and all files in case of unforeseen circumstances. 1. Database Backup Create a database dump file using the mysqldump command or similar. # mysqldump -u [DB username] -p [DB name] > [output filename] mysqldump -u db_user -p omeka_s_db > omeka_s_backup.sql 2. File Backup Back up (duplicate) the entire Omeka S installation directory. ...

August 1, 2024 · 3 min · Nakamura

Exporting Only Specific Items and Selected Fields Using Omeka S BulkExport

Overview This article introduces how to export only specific items with selected fields using Omeka S BulkExport. Here, we will limit the export to items that have “Table Of Contents (dcterms:tableOfContents)” and export only “Title (dcterms:title)” and “Identifier (dcterms:identifier)”. Related The following article explains the overview of the Omeka S BulkExport module. This time, I will explain based on a specific use case. Method Navigate to the following path. ...

July 31, 2024 · 1 min · Nakamura

Registering RDF Data to Dydra Using Python

Overview I created a library for registering RDF data to Dydra using Python. https://github.com/nakamura196/dydra-py It includes some incomplete implementations, but we hope it proves useful in some situations. Implementation Details The import is performed in the following file. https://github.com/nakamura196/dydra-py/blob/main/dydra_py/api.py#L55 It uses the SPARQL INSERT DATA operation as follows. def import_by_file(self, file_path, format, graph_uri=None, verbose=False): """ Imports RDF data from a file into the Dydra store. Args: file_path (str): The path to the RDF file to import. format (str): The format of the RDF file (e.g., 'xml', 'nt'). graph_uri (str, optional): URI of the graph where data will be inserted. Defaults to None. """ headers = { "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/sparql-update" } files = self._chunk_rdf_file(file_path, format=format) print("Number of chunks: ", len(files)) for file in tqdm(files): # RDFファイルの読み込み graph = rdflib.Graph() graph.parse(file, format=format) # フォーマットはファイルに応じて変更 nt_data = graph.serialize(format='nt') if graph_uri is None: query = f""" INSERT DATA {{ {nt_data} }} """ else: query = f""" INSERT DATA {{ GRAPH <{graph_uri}> {{ {nt_data} }} }} """ if verbose: print(query) response = requests.post(self.endpoint, data=query, headers=headers) if response.status_code == 200: print("Data successfully inserted.") else: print(f"Error: {response.status_code} {response.text}") Key Design Decision One notable design decision was handling large RDF files. When uploading large RDF files all at once, there were cases where the process would stop midway. ...

July 26, 2024 · 2 min · Nakamura

Deleting All Files in OpenAI Storage

Overview This is a memo on how to delete all files in OpenAI storage. The following page was helpful. https://community.openai.com/t/deleting-everything-in-storage/664945 Background There was a case where I wanted to bulk-delete multiple files uploaded using code like the following. file_paths = glob("data/txt/*.txt") file_streams = [open(path, "rb") for path in file_paths] # Use the upload and poll SDK helper to upload the files, add them to the vector store, # and poll the status of the file batch for completion. file_batch = client.beta.vector_stores.file_batches.upload_and_poll( vector_store_id=vector_store.id, files=file_streams ) # You can print the status and the file counts of the batch to see the result of this operation. print(file_batch.status) print(file_batch.file_counts) Method Running the following code allowed me to perform bulk deletion. ...

July 24, 2024 · 3 min · Nakamura

Bringing a Specified Marker to the Front in nuxt3-leaflet

Overview This is a memo on how to bring a specified marker to the front in nuxt3-leaflet. Method By using the z-index-offset attribute on LMarker as shown below, I was able to bring a specified marker to the front. <template v-for="marker in markers"> <LMarker @click="selectMarker(marker)" :lat-lng="[marker.lat, marker.lng]" :z-index-offset="selectedSpotId === marker.id ? 1000 : 0" > <LTooltip> {{ marker.title }} </LTooltip> <LIcon :iconUrl="marker.icon" :iconSize="[25, 41]" :iconAnchor="[12, 41]" :popupAnchor="[1, -34]" :tooltipAnchor="[16, -28]" shadowUrl="https://esm.sh/leaflet@1.9.2/dist/images/marker-shadow.png" :shadowSize="[41, 41]" :shadowAnchor="[12, 41]" ></LIcon> </LMarker> </template> Summary I hope this is helpful when using nuxt3-leaflet. ...

July 23, 2024 · 1 min · Nakamura

LEAF Writer: Adding Mirador

Overview This is a record of investigating how to customize LEAF Writer. https://gitlab.com/calincs/cwrc/leaf-writer/leaf-writer This time, we add Mirador as shown below. Method Please refer to the following. https://gitlab.com/nakamura196/leaf-writer/-/commit/377438739cdeb0a7b770ee9d4b9fea86081179d8 The file that needs to be modified is as follows. import $ from 'jquery'; import 'jquery-ui'; import Writer from '../../../Writer'; // @ts-ignore import Mirador from 'mirador'; interface IiifViewerProps { attribute?: string; parentId: string; tag?: string; writer: Writer; } class IiifViewer { readonly writer: Writer; readonly id: string; readonly tagName: string; readonly attrName: string; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents miradorInstance: any | null; $pageBreaks: unknown; currentIndex = -1; ignoreScroll = false; constructor({ attribute, parentId, tag, writer }: IiifViewerProps) { this.writer = writer; this.id = `${parentId}_iiifViewer`; this.tagName = tag ?? 'pb'; // page break element name this.attrName = attribute ?? 'facs'; // attribute that stores the image URL $(`#${parentId}`).append(` <div id="${this.id}" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0"></div> `); this.writer.event('loadingDocument').subscribe(() => this.reset()); this.writer.event('documentLoaded').subscribe((success: boolean, body: HTMLElement) => { console.log('documentLoaded', success, body); if (!success) return; this.processDocument(body); }); this.writer.event('writerInitialized').subscribe(() => { if (!this.writer.editor) return; }); } private processDocument(doc: HTMLElement) { // (doc).find const $facsimile = $(doc).find(`*[_tag="facsimile"]`); const manifestUri = $facsimile.attr('sameas'); const config = { id: this.id, windows: [ { loadedManifest: manifestUri, }, ], window: { sideBarOpen: false, }, }; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access this.miradorInstance = Mirador.viewer(config); } reset() { this.$pageBreaks = null; this.currentIndex = -1; } } export default IiifViewer; The following section retrieves information from <facsimile sameAs="https://dl.ndl.go.jp/api/iiif/3437686/manifest.json">. ...

July 23, 2024 · 2 min · Nakamura

Bug in Omeka S IIIF Server Module [3.6.19, 3.6.20]

Overview A bug has been confirmed in versions 3.6.19 and 3.6.20 of the Omeka S IIIF Server module where URIs are malformed. Specifically, the FQDN becomes incorrect, like the following. https://xxx.yyy.zzz.jp//aaa.bbb.ccc.jp/iiif/3/1234/manifest Workaround As of the time of writing this article, version 3.6.21 has not been released, so I recommend using version 3.6.18 or earlier of the module. Summary I hope this serves as a useful reference.

July 19, 2024 · 1 min · Nakamura

A Library for Creating RDF Files from VSDX Files

Overview This is a memo about a library I created for generating RDF files from VSDX files. https://github.com/nakamura196/vsdx-rdf Background I have been exploring methods for creating RDF data using Microsoft Visio in articles like the following. This article corresponds to the note in the above article that said “This library will be introduced in a separate article.” Usage Please refer to the following. https://nakamura196.github.io/vsdx-rdf/ Google Colab A notebook is available for trying out this library. ...

July 18, 2024 · 1 min · Nakamura

Handling concurrent.futures.process.BrokenProcessPool

Overview When running nbdev_prepare with nbdev, the following error occurred. concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending. Solution Running the following command beforehand resolved the error. export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES Summary I hope this is helpful for anyone experiencing the same issue.

July 18, 2024 · 1 min · Nakamura

Using Node.js to Validate JSON:API Compliance

Overview This is a note about using the following repository to validate JSON:API compliance. https://github.com/elliotttf/jsonapi-validator At the time of writing this article, it appears to have not been updated for 7 years, so it may not support the latest schemas, but I was able to perform simple validation. Usage I prepared the following repository to try the library above. https://github.com/nakamura196/jsonapi-validator-demo Installation This assumes the use of nvm, but it is not required. ...

July 18, 2024 · 2 min · Nakamura

Trying Out virtual-museum-tour-threejs

Overview I had the opportunity to try out the following repository, so this is a memo of my experience. https://github.com/theringsofsaturn/virtual-museum-tour-threejs A tutorial video was also available at the following link. https://www.youtube.com/watch?v=8oQC0ICNtL0 Fork I forked the repository, made some modifications, and made the build results available on GitHub Pages. https://nakamura196.github.io/virtual-museum-tour-threejs/ Summary This should be a useful reference for developing apps with Three.js.

July 15, 2024 · 1 min · Nakamura