Trying to Create a ShEx File

Overview ShEx is described on Wikipedia as: Shape Expressions is a data modeling language for validating and describing Resource Description Framework Here are my notes from attempting to create a ShEx file. Creating a ShEx File This time, we start with RDF data in data/tmp/merged.ttl. We use shexer to create a ShEx file from the RDF data. pip install shexer Get the list of classes in the RDF data. ...

April 3, 2023 · Updated: April 3, 2023 · 4 min · Nakamura

Loading .glb Files with Nuxt3 x babylon.js

Overview I encountered an error when attempting to load a .glb file in Nuxt3 x babylon.js, so this is a memo of how I resolved it. Error Details The following error occurred: Unable to load from ./models/test.glb: importScene of undefined from undefined version: undefined, exporter version: undefinedimportScene has failed JSON parse Solution The issue was resolved by additionally installing the following package: npm install @babylonjs/loaders As a result, I was able to display the model with the following JavaScript file: ...

March 29, 2023 · Updated: March 29, 2023 · 1 min · Nakamura

Bidirectional Interaction Between Vue 3 and Babylon.js

Overview I prototyped a program for bidirectional interaction between Vue 3 and Babylon.js. You can check the content at the following link. https://youtube.com/shorts/BIdj-3T2_z8 Demo Site https://nakamura196.github.io/nuxt3-babylonjs/9 Source Code https://github.com/nakamura196/nuxt3-babylonjs/blob/main/pages/9/index.vue Summary We hope this serves as a useful reference.

March 29, 2023 · Updated: March 29, 2023 · 1 min · Nakamura

Web Application for NDL Classical Book OCR Using Hugging Face Space

Overview I created a web application for NDL Classical Book OCR using Hugging Face Space. You can try it at the link below. Upload an image, and after about 1 minute, the OCR result text and JSON data will be displayed. https://huggingface.co/spaces/nakamura196/ndl_kotenseki_ocr The following article was used as a reference for creating this application. https://qiita.com/relu/items/e882e23a9bd07243211b Choosing the Right Tool I have separately prepared a Google Colab tutorial as another environment for trying NDL Classical Book OCR. ...

March 27, 2023 · Updated: March 27, 2023 · 2 min · Nakamura

Running NDL Classical Japanese OCR on Amazon EC2 CPU Environment

Overview This is a memo of running NDL Classical Japanese OCR on an Amazon EC2 CPU environment. The advantage is that it can be run without preparing an expensive GPU environment, but please note that it takes about 30 seconds to 1 minute per image. The following article was referenced when building this environment. https://qiita.com/relu/items/e882e23a9bd07243211b Instance Select Ubuntu from Quick Start. For the instance type, I recommend t2.medium or higher. Errors occurred with smaller instances. ...

March 27, 2023 · Updated: March 27, 2023 · 2 min · Nakamura

Comparison of Nuxt.js and Next.js

Nuxt.js and Next.js are both JavaScript frameworks built on top of Vue.js and React.js, respectively. Each framework has its own advantages, but here are some points where Nuxt.js is considered superior to Next.js: 1. Advantages of Vue.js: Nuxt.js is based on Vue.js, so it inherits the advantages of Vue.js. Vue.js is appreciated for its simple component structure and gentle learning curve. 2. Directory-based routing: Nuxt.js automatically generates routing based on the directory structure. This eliminates the need for developers to manually configure routing, improving development efficiency. 3. Vuex integration: In Nuxt.js, Vuex (Vue.js’s state management library) is integrated by default. This makes state management easier. 4. Middleware support: In Nuxt.js, middleware can be used to add custom logic to routes and pages. This allows developers to easily customize application behavior. 5. Module system: Nuxt.js has a module system that makes it easy to add community-developed features. This allows developers to improve the extensibility of their applications. However, which framework is better depends on the project requirements, the developer’s skill set, and preferences. Next.js also has features such as the React.js ecosystem, server-side rendering (SSR), and static site generation (SSG), and is supported by many developers. Ultimately, it is important to carefully consider which framework is best suited for your project. ...

March 18, 2023 · 1 min · Nakamura

What Is a Canonical URL? (canonicalUrl)

A canonical URL is the practice of choosing one “canonical” URL from among different URLs that point to the same content. This is used so that search engines can prevent content duplication and accurately evaluate the importance of web pages without negatively affecting their search rankings. For example, suppose you have the following URLs: 1. http://example.com/page 2. http://www.example.com/page 3. https://example.com/page 4. https://www.example.com/page Even though all of these URLs point to the same content, search engines may treat them as different pages. The canonical URL uses the HTML <link rel="canonical"> tag to tell search engines which URL is the preferred one. ...

March 18, 2023 · 1 min · Nakamura

Implementing Exact Non-Match Search with Fuse.js (Explained by GPT-4)

Introduction I previously wrote the following article, but GPT-4’s explanation was more useful, so I am sharing it here. How to Implement Exact Non-Match Search in JavaScript Fuse.js is a lightweight fuzzy search library that operates on the client side. However, it is not suitable for the purpose of exact non-match search. Instead, you can easily implement it using JavaScript’s Array methods. Exact Non-Match Search Example The following example uses the filter method to perform an exact non-match search. ...

March 17, 2023 · Updated: March 17, 2023 · 2 min · Nakamura

How to Extract respStmt name Values from TEI/XML Files (Explained by GPT-4)

How to Extract respStmt name Values from TEI/XML Files: Approaches Using BeautifulSoup and ElementTree in Python This article introduces how to extract respStmt name values from TEI/XML files using Python’s BeautifulSoup and ElementTree. Method 1: Using ElementTree First, we extract the respStmt name value using Python’s standard library xml.etree.ElementTree. import xml.etree.ElementTree as ET # Load the XML file tree = ET.parse('your_file.xml') root = tree.getroot() # Define the namespace ns = {'tei': 'http://www.tei-c.org/ns/1.0'} # Extract the respStmt name value name = root.find('.//tei:respStmt/tei:name', ns) # Display the name text if name is not None: print(name.text) else: print("The name tag was not found.") Method 2: Using BeautifulSoup Next, we extract the respStmt name value using BeautifulSoup. First, make sure the beautifulsoup4 and lxml libraries are installed. If they are not installed, you can install them with the following command. ...

March 17, 2023 · Updated: March 17, 2023 · 2 min · Nakamura

Updating Vocabularies Created with Omeka S Custom Ontology

Overview Custom Ontology is a module that allows you to add custom vocabularies when standard ontologies such as LOV, schema.org, and W3C are not available. Its usage is introduced below. https://nakamura196.hatenablog.com/entry/2021/07/24/235050 The above article covers vocabulary creation, but does not address how to update existing vocabularies. This article explains how to update existing vocabularies. Creating a Vocabulary As an example, we will create the following vocabulary. https://omekas.aws.ldas.jp/omeka4/ns/myprefix/ Accessing the above URL will download the following TTL file. Here, we have added a custom property called myprefix:mySpecificProperty. ...

March 16, 2023 · Updated: March 16, 2023 · 2 min · Nakamura

Trying Leaflet Marker Cluster with Nuxt 3

I had the opportunity to try Leaflet Marker Cluster with Nuxt 3. The implementation example is as follows. https://nuxt3-demo-nine.vercel.app/map-cluster For this implementation, I referenced the following page. https://codesandbox.io/s/ns238 The source code is at the following URL. https://github.com/nakamura196/nuxt3-demo As of March 2023, it appears to be at the POC (Proof of Concept) stage. I hope this serves as a useful reference.

March 16, 2023 · Updated: March 16, 2023 · 1 min · Nakamura

Memo on Using nbdev

Overview When creating Python packages, I use nbdev. https://nbdev.fast.ai/ nbdev is described as follows: Write, test, document, and distribute software packages and technical articles — all in one place, your notebook. This article serves as a memo when using nbdev. Installation The following tutorial page is a helpful reference. https://nbdev.fast.ai/tutorials/tutorial.html Below is a brief overview of the workflow. After installing the related tools, create a GitHub repository, clone it, and then execute the following in the cloned directory. ...

March 15, 2023 · Updated: March 15, 2023 · 2 min · Nakamura

Partially Implementing Exact Non-Match Search with Fuse.js

Overview Fuse.js is a search engine written in JavaScript. https://fusejs.io/ It is very useful as a search engine when building frontend-only applications. This time, when implementing exact non-match search using Fuse.js, I needed to craft the query carefully, so here are my notes. Advanced Search Fuse.js supports various types of searches, including exact/partial match and partial non-match. These are described on the following page. https://fusejs.io/examples.html#extended-search A Japanese translation is also available in the following article: ...

March 14, 2023 · Updated: March 14, 2023 · 1 min · Nakamura

Running NDL Classical Text OCR Using Amazon SageMaker Studio

Overview Previously, I created tutorials for NDL OCR and NDL Classical Text OCR using Google Cloud Platform and Google Colab. This time, I will explain how to run NDL Classical Text OCR using Amazon SageMaker Studio. Please note that this method incurs costs during execution. The description of Amazon SageMaker Studio is available at the following link: https://aws.amazon.com/jp/sagemaker/studio/ Domain Setup and Other Configuration For domain setup and other configuration, please refer to articles such as the following: ...

February 27, 2023 · Updated: February 27, 2023 · 2 min · Nakamura

[Babylon.js x Vue] Passing Click Events to Vue

Overview I investigated how to get the name of a mesh clicked in Babylon.js, as shown below. I referenced the following tutorial. https://doc.babylonjs.com/communityExtensions/Babylon.js+ExternalLibraries/BabylonJS_and_Vue/BabylonJS_and_Vue_2#passing-data-from-babylonjs-to-vue-using-callbacks The demo page is as follows. https://nakamura196.github.io/nuxt3-babylonjs/8/ The source code for the page is as follows. https://github.com/nakamura196/nuxt3-babylonjs/blob/main/pages/8/index.vue Implementation In the following section, a callback variable is passed to createScene. The name fpsCallback might need to be revised. https://github.com/nakamura196/nuxt3-babylonjs/blob/5c33d2e6bcd1681df17f3f12fea3cd68fc645157/components/Scene8.vue#L10-L13 Then, in the createScene function, the result of onPointerDown is passed. ...

February 17, 2023 · Updated: February 17, 2023 · 1 min · Nakamura

Trying the Babylon.js Vue Tutorial with Nuxt 3

Overview Previously, I created a repository combining Babylon.js and Nuxt 3. Meanwhile, a tutorial for using Vue with Babylon.js has been published at the following link. https://doc.babylonjs.com/communityExtensions/Babylon.js+ExternalLibraries/BabylonJS_and_Vue This time, I implemented the following tutorial from the above site using Nuxt 3. https://doc.babylonjs.com/communityExtensions/Babylon.js+ExternalLibraries/BabylonJS_and_Vue/BabylonJS_and_Vue_2 The demo site is as follows. https://nakamura196.github.io/nuxt3-babylonjs/ The source code is as follows. https://github.com/nakamura196/nuxt3-babylonjs Tutorial Passing data from BabylonJS to Vue using callbacks This is the most verbose, but the safest, most extensible, and most reusable approach. Basically, you create methods in the BabylonJS scene code and export them accordingly, allowing you to import them in Vue components and call each one. ...

February 17, 2023 · Updated: February 17, 2023 · 2 min · Nakamura

Setting Up ArchivesSpace on Amazon Lightsail

Overview ArchivesSpace is an open-source archival information management application for managing archives, manuscripts, and digital objects, and providing web access. https://archivesspace.org/ I had the opportunity to set up ArchivesSpace on Amazon Lightsail, so this is a memo of the process. Installation instructions are described on the following page. https://archivesspace.github.io/tech-docs/readme_implement.html Instance I selected Ubuntu 20.04 LTS. The documentation states the following, but since performance was sluggish with 2GB of memory, I selected 4GB. ...

February 10, 2023 · Updated: February 10, 2023 · 2 min · Nakamura

Using Japan Search Web Parts with Next.js

Overview Japan Search provides Web Parts, a feature that allows UI components used within Japan Search to be used as parts on websites outside of Japan Search. https://jpsearch.go.jp/static/developer/webparts/ja.html I had the opportunity to use this feature with Next.js, so here are my notes. Usage Example You can see it on the following page. https://jps-2023-next.vercel.app/jps Source Code It is published at the following URL. https://github.com/nakamura196/jps_2023_next By loading the JS file using the Script tag as shown below, I was able to display it successfully. ...

February 9, 2023 · Updated: February 9, 2023 · 1 min · Nakamura

Trying the Archivematica API (Storage Service API)

Overview The Archivematica Storage Service API is documented on the following page. I tried using some of these APIs, and this is a memo of my experience. https://www.archivematica.org/en/docs/archivematica-1.13/dev-manual/api/api-reference-storage-service/ If basic authentication is required, please use the following credentials: Username: demo Password: Nd4Ev3XJ PACKAGE A package is a bundle of one or more files transferred from an external service; for example, a package may be an AIP, a backlogged transfer, or a DIP. Each package is stored in a location. ...

February 8, 2023 · Updated: February 8, 2023 · 2 min · Nakamura

Hosting Nuxt 3 SSR on Vercel (+ Enabling CORS)

I had the opportunity to host Nuxt 3 SSR on Vercel, so this is a note for reference. For the build settings, I needed to set the Output Directory to .output/server as follows. For enabling CORS, the following article was helpful. https://vercel.com/guides/how-to-enable-cors Specifically, I was able to handle this by placing the following file at the root of the project. { "headers": [ { "source": "/api/(.*)", "headers": [ { "key": "Access-Control-Allow-Credentials", "value": "true" }, { "key": "Access-Control-Allow-Origin", "value": "*" }, { "key": "Access-Control-Allow-Methods", "value": "GET,OPTIONS,PATCH,DELETE,POST,PUT" }, { "key": "Access-Control-Allow-Headers", "value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" } ] } ] } There may be incorrect descriptions, but I hope this is helpful. ...

February 3, 2023 · Updated: February 3, 2023 · 1 min · Nakamura