Linuxシステムで特定のグループに所属しているユーザーを確認する

概要 ! ChatGPT 4による回答です。 Linuxシステムで特定のグループに所属しているユーザーを確認するには、いくつかの方法があります。ここでは、コマンドラインを使用して、特定のグループ(この場合は「group1」と「group2」)に所属するユーザーをリストする方法を説明します。 方法1: /etc/group ファイルを確認する Linuxでは、/etc/group ファイルにシステム上のすべてのグループとそれに所属するユーザーの情報が格納されています。このファイルを確認することで、特定のグループに含まれるユーザーを確認することができます。 コマンド: grep '^group1:' /etc/group grep '^group2:' /etc/group これらのコマンドは、group1 と group2 グループについての情報を /etc/group ファイルから検索し、出力します。出力例は以下のようになります: group1:x:1001:user1,user2 group2:x:1002:user3,user4 ここで、user1 と user2 は group1 グループのメンバーで、user3 と user4 は group2 グループのメンバーです。 方法2: getent コマンドを使用する getent コマンドを使用しても、グループに所属するユーザーを調べることができます。このコマンドは /etc/group ファイルから直接情報を取得します。 コマンド: getent group group1 getent group group2 出力は /etc/group を grep した時と同様のフォーマットです。 方法3: members コマンドを使用する members コマンドは、特定のグループに属するすべてのユーザーの名前をリストアップするために使われます。ただし、このコマンドはすべてのLinuxディストリビューションにはデフォルトでインストールされていないため、インストールが必要な場合があります。 コマンド: sudo apt install members # Debian系の場合 members group1 members group2 これらの方法を使用して、group1 および group2 グループに含まれるユーザーを確認できます。どの方法を選択するかは、使用しているシステムやインストールされているプログラムによります。 ...

2024年4月18日 · 1 分 · Nakamura

Omeka SのAdvanced Searchモジュールでの部分一致検索

概要 Advanced Searchモジュールを使って、追加したフィルタで部分一致検索を行う方法について説明します。 上記では、「とる」という文字列をクエリとして、タイトルが「abc タイトル」のアイテムがヒットしています。 背景 Advanced Searchモジュールを使用すると、検索条件やファセットなどを柔軟に設定することができます。 https://omeka.org/s/modules/AdvancedSearch/ 特に、「Reference」モジュールと組み合わせることで、以下のようなファセット検索を実現できます。 フィルタの追加もできます。ただし、フィルタを用いた部分一致検索を行う場合には、設定が必要です。 上記の例では、「とる」という文字列をクエリとした際、タイトルが「abc タイトル」のアイテムがヒットしていません。 設定方法 フィルタの追加は、以下の設定画面のFiltersで行います。(slugの部分は必要に応じて読み替えてください。) /admin/search-manager/config/1/configure 上記の例では、titleとsubjectをフィルタとして以下のように追加しています。 title = Title subject = Subject advanced = Filters = Advanced = このままでは、titleおよびsubjectに対する完全一致になります。 これに対して、以下のように、Textを追加します。 title = Title = Text subject = Subject advanced = Filters = Advanced = これにより、titleについては部分一致、subjectについては完全一致、を実現することができます。 まとめ Omeka SのAdvanced Searchモジュールの利用にあたり、参考になりましたら幸いです。

2024年4月17日 · 1 分 · Nakamura

Omeka Sで独自の検索ページを作成する

概要 Omeka Sで以下のような独自の検索ページを作成する方法について紹介します。 背景 Omeka Sでの検索ページの作成にあたり、詳細検索画面で絞り込み項目を限定する方法を紹介しました。 一方、概要で紹介したように、指定した項目だけを列挙した検索画面を作成したい場合もあります。このような検索ページの作成にあたり、「Advanced Search」モジュールを使うことができます。 https://omeka.org/s/modules/AdvancedSearch/ 以下のページで使い方を説明しています。以下ではApache Solrとの連携を行っていますが、Referenceモジュールなどと組み合わせて、Omeka S単体で使用することもできます。 ただし、「Advanced Search」モジュールは機能が豊富なゆえに、使いこなすのが難しい面があります。そこで、今回は簡単に上記のようなカスタム検索ページを作成する方法について紹介します。 作成方法 具体的には、検索用の独自ページを作成します。 以下のように、特定のサイトで、ページを作成します。 「HTML」ブロックを追加します。 「ソース」ボタンをクリックして、以下のHTMLをコピペします。 <div id="dynamic-fields"></div> <button id="submit" class="btn btn-primary">検索</button> <script> const params = [ { label: "キーワード検索", type: "in", placeholder: "すべてのフィールドに対して検索します。", help: "部分一致", }, { label: "タイトル", property: 1, type: "in", help: "部分一致" }, { label: "資料番号", property: 10, type: "eq", help: "完全一致" }, { label: "主題", property: 3, type: "in", help: "部分一致" }, ]; // 以下はそのまま document.addEventListener("DOMContentLoaded", () => { initializeSearchForm(); setupFormSubmission(); }); function initializeSearchForm() { const container = document.getElementById("dynamic-fields"); params.forEach((param, index) => { container.appendChild(createFormGroup(param, index)); }); } function createFormGroup(param, index) { const formGroup = document.createElement("div"); formGroup.className = "form-group mb-4"; formGroup.appendChild(createLabel(param.label)); formGroup.appendChild( createInput( `property[${index}][text]`, "form-control", param.placeholder ) ); formGroup.appendChild(createHelpText(param.help)); formGroup.appendChild( createHiddenInput(`property[${index}][type]`, param.type) ); if (param.property) { formGroup.appendChild( createHiddenInput(`property[${index}][property][]`, param.property) ); } formGroup.appendChild( createHiddenInput(`property[${index}][joiner]`, "and") ); return formGroup; } function createLabel(text) { const label = document.createElement("label"); label.className = "mb-1"; label.textContent = text; return label; } function createInput(name, className, placeholder) { const input = document.createElement("input"); input.type = "text"; input.name = name; input.className = className; input.placeholder = placeholder || ""; // set value const urlParams = new URLSearchParams(window.location.search); const value = urlParams.get(name); if (value) { input.value = value; } return input; } function createHelpText(text) { const small = document.createElement("small"); small.className = "form-text text-muted"; small.textContent = text; return small; } function createHiddenInput(name, value) { const input = document.createElement("input"); input.type = "hidden"; input.name = name; input.value = value; return input; } function setupFormSubmission() { document.getElementById("submit").addEventListener("click", () => { const form = document.createElement("form"); form.method = "GET"; form.action = "../item"; form.style.display = "none"; Array.from( document.querySelectorAll("#dynamic-fields input") ).forEach((input) => { form.appendChild(input.cloneNode(true)); }); document.body.appendChild(form); form.submit(); }); } </script> 結果、以下のように、ボタンのみが表示されます。 ...

2024年4月17日 · 2 分 · Nakamura

学習指導要領コード推薦アプリのAPIを使用する

概要 以下の記事で、学習指導要領コードの推薦アプリについて紹介しました。 今回は、GradioのAPIを使って、上記の推薦アプリを使用する方法について紹介します。 使い方 ライブラリをインストールします。 pip install gradio_client 例えば、以下のデータを使用してみます。 テキスト 学校種別 空気鉄砲や水鉄砲、ペットボトルロケットなどのしくみを調べ、空気はおし縮められ体積が小さくなるにつれて反発する力が大きくなるが、水はおし縮められないことに気づく。 小学校 JSONデータは実行結果の配列の2つ目の要素に格納されているため、result[1]で取得します。 from gradio_client import Client client = Client("nakamura196/jp-cos") result = client.predict( text="空気鉄砲や水鉄砲、ペットボトルロケットなどのしくみを調べ、空気はおし縮められ体積が小さくなるにつれて反発する力が大きくなるが、水はおし縮められないことに気づく。", courseOfStudy=["小学校"], api_name="/predict" ) json_data = result[1] 結果、以下のようなJSONデータが得られます。 [{'dcterms:identifier': '8260243111200000', 'jp-cos:courseOfStudy': '小学校', 'jp-cos:subjectArea': '理科', 'score': 0.215, 'jp-cos:sectionText': '閉じ込めた空気は圧《お》し縮められるが,水は圧《お》し縮められないこと。'}, {'dcterms:identifier': '8260243111100000', 'jp-cos:courseOfStudy': '小学校', 'jp-cos:subjectArea': '理科', 'score': 0.236, 'jp-cos:sectionText': '閉じ込めた空気を圧《お》すと,体積は小さくなるが,圧《お》し返す力は大きくなること。'}, {'dcterms:identifier': '8260243112000000', 'jp-cos:courseOfStudy': '小学校', 'jp-cos:subjectArea': '理科', 'score': 0.246, 'jp-cos:sectionText': '空気と水の性質について追究する中で,既習の内容や生活経験を基に,空気と水の体積や圧《お》し返す力の変化と圧《お》す力との関係について,根拠のある予想や仮説を発想し,表現すること。'}, {'dcterms:identifier': '8260243110000000', 'jp-cos:courseOfStudy': '小学校', 'jp-cos:subjectArea': '理科', 'score': 0.255, 'jp-cos:sectionText': '空気と水の性質 空気と水の性質について,体積や圧《お》し返す力の変化に着目して,それらと圧《お》す力とを関係付けて調べる活動を通して,次の事項を身に付けることができるよう指導する。'}] 発展 より詳細な使用方法について、フッター部分の「Use via API」から確認することができます。 パラメータや返却される値について説明されています。 まとめ 参考になりましたら幸いです。

2024年4月16日 · 1 分 · Nakamura

学習指導要領コードの推薦アプリの試作

概要 学習指導要領コードの推薦アプリを作成しましたので、その紹介です。以下のhuggingfaceのspaceでお試しいただけます。学習指導要領LODを利用しました。 https://huggingface.co/spaces/nakamura196/jp-cos 使い方 テキストフォームに任意のテキストを入力します。「学校種別」は任意項目です。 結果が画面右側に表示されます。 サンプルも用意していますので、お試しください。NHK for Schoolの情報を利用しています。 仕組み 以下の記事を参考に、学習指導要領のテキストをベクトル化し、同様にベクトル化した質問文と類似する学習指導要領を返却します。 https://zenn.dev/yumefuku/articles/llm-langchain-rag 上記の記事の通り、ベクトル検索ライブラリには「FAISS」、埋め込みモデルには「multilingual-e5-large」を使用しています。 https://huggingface.co/intfloat/multilingual-e5-large 推論部分のソースコードは以下でご確認いただけます。 https://huggingface.co/spaces/nakamura196/jp-cos/blob/main/app.py 工夫点 「学校種別」などを用いたフィルタリング 「学校種別」が指定された場合、langchainのFAISS.similarity_search_with_scoreによる類似度検索において、フィルタリングを行っています。 具体的には、以下のfilterを用いています。 metadata = {} if grade: metadata["学校種別"] = grade try: docs_and_scores = index.similarity_search_with_score(input_text, filter=metadata) except Exception as e: print(f"Error during search: {e}") return [] 今後 「教科等」による絞り込み 「学校種別」による絞り込みに加えて、「教科等(理科、社会、数学など)」も追加予定です。 推薦精度の評価 学習指導要領コードがすでに付与されているNHK for Schoolのコンテンツを対象に、推薦精度の評価を行う予定です。 「学校種別」の追加 現在は、以下の7つの学校種別のみを使用しています。他の学習指導要領も今後追加予定です。 UpperSecondary/2018 UpperSecondaryDeptSNES/2019 Elementary/2017 ElementaryAndLowerSecondaryDeptSNES/2017 LowerSecondary/2017 Kindergarten/2017 KindergartenDeptSNES/2017 まとめ 学習指導要領LODの開発者の方々に感謝いたします。 ...

2024年4月16日 · 1 分 · Nakamura

researchmapのapiを使う

概要 researchmapのapiを使って、業績リストを作成する機会がありましたので、備忘録です。 researchmapのapiに対するクエリ例 researchmapのapiに対するクエリ例をいくつか紹介します。 論文の一覧を取得する https://api.researchmap.jp/nakamura.satoru/published_papers 上限を指定する(limitの使用) https://api.researchmap.jp/nakamura.satoru/published_papers?limit=5 x件以降の結果を取得する(startの使用) https://api.researchmap.jp/nakamura.satoru/published_papers?limit=5&start=6 出版年月日を指定する(from_dateとto_date) https://api.researchmap.jp/nakamura.satoru/published_papers?from_date=2023-04-01&to_date=2024-03-31 Pythonでの使用例 指定したユーザと出版年月日に基づき、published_papersとpresentationsをExcelに書き出します。 #| export import requests import pandas as pd import os class Client: def __init__(self, slug, date_start, date_end): self.slug = slug self.date_start = date_start self.date_end = date_end self.output_dir = f"data/{self.slug}/{self.date_start}_{self.date_end}" os.makedirs(self.output_dir, exist_ok=True) @staticmethod def main(slug, date_start, date_end): client = Client(slug, date_start, date_end) client.process_data() def process_data(self): self.df_paper = self.fetch_data('published_papers', self.paper_processing_logic) self.df_presentation = self.fetch_data('presentations', self.presentation_processing_logic) self.write_to_excel() def fetch_data(self, data_type, processing_function): url = f"https://api.researchmap.jp/{self.slug}/{data_type}" params = { "limit": 100, "start": 0, "from_date": self.date_start, "to_date": self.date_end, } response = requests.get(url, params=params) if response.status_code == 200: data = response.json().get("items", []) return processing_function(data) else: raise Exception(f"Error fetching {data_type}: {response.status_code}") def paper_processing_logic(self, papers): rows = [] for item in papers: rows.append(self.process_paper_item(item)) return pd.DataFrame(rows) def process_paper_item(self, item): author_list = [auth["name"] for auth in item.get('authors', {}).get("ja", [])] c1 = '''1.掲載論文のDOI (デジタルオブジェクト識別子)''' c2 = '''2.著者名''' c3 = '''3.論文標題''' c4 = '''4.雑誌名''' c5 = '''5.巻 (半角数字)''' c6 = '''6.発行年 (半角数字)''' c7 = '''7.最初と最後の頁 (半角数字)''' c8 = '''8.査読の有無 (1:有 0:無)''' c9 = '''9.国際共著 (1:有 0:無)''' c10 = '''10.オープンアクセス (1:有 0:無)''' return { c1: item.get('identifiers', {}).get('doi', [None])[0], c2: ", ".join(author_list), c3: item.get('paper_title', {}).get('ja', ''), c4: item.get('publication_name', {}).get('ja', ''), c5: item.get('volume', None), c6: item['publication_date'][:4], c7: f"{item.get('starting_page', '')}-{item.get('ending_page', '')}", c8: 1 if item.get('referee', False) else 0, c9: 1 if item.get('is_international_collaboration', False) else 0, c10: 1 if item.get('rm:is_open_access', False) else 0 } def presentation_processing_logic(self, presentations): rows = [] for item in presentations: rows.append(self.process_presentation_item(item)) return pd.DataFrame(rows) def process_presentation_item(self, item): author_list = [auth["name"] for auth in item.get('presenters', {}).get("ja", [])] c1 = '''1.発表者名''' c2 = "2.発表標題" c3 = "3.学会等名" c4 = '''4.発表年(開始) (半角数字)''' c5 = '''5.発表年(終了) (半角数字)''' c6 = '''6.招待講演 (1:有 0:無)''' c7 = '''7.国際学会 (1:有 0:無)''' return { c1: ", ".join(author_list), c2: item.get('presentation_title', {}).get('ja', ''), c3: item.get('event', {}).get('ja', ''), c4: item['publication_date'][:4], c5: item['publication_date'][:4], c6: 1 if item.get('invited', False) else 0, c7: 1 if item.get('is_international_presentation', False) else 0 } def write_to_excel(self): with pd.ExcelWriter(f'{self.output_dir}/merged.xlsx', engine='openpyxl') as writer: self.df_paper.to_excel(writer, sheet_name='Papers', index=False) self.df_presentation.to_excel(writer, sheet_name='Presentations', index=False) self.df_paper.to_csv(f"{self.output_dir}/papers.csv", index=False) self.df_presentation.to_csv(f"{self.output_dir}/presentations.csv", index=False) 使用例は以下です。dataフォルダにcsvやexcelが出力されます。 ...

2024年4月15日 · 2 分 · Nakamura

TEI/XMLの可視化例:Leafletを用いた地図表示

概要 TEI/XMLファイルの可視化にあたり、可視化例とソースコードを公開するリポジトリを作成しました。 https://github.com/nakamura196/tei_visualize_demo 可視化例は以下のページでご確認いただけます。 https://nakamura196.github.io/tei_visualize_demo/ 今回、MarkerClusterを用いたマーカー表示の例を追加しましたので、紹介します。 前提 Leafletを使って、(MarkerClusterを使用せずに、)マーカーの表示ができていることを前提とします。まだの方は、以下の可視化例、およびソースコードを参考にしてください。 可視化例 https://nakamura196.github.io/tei_visualize_demo/01/ ソースコード https://github.com/nakamura196/tei_visualize_demo/blob/main/docs/01/index.html MarkerClusterを使った実装例 可視化例は以下です。 https://nakamura196.github.io/tei_visualize_demo/02/ ソースコードは以下です。 https://github.com/nakamura196/tei_visualize_demo/blob/main/docs/02/index.html 「TEIを用いた『渋沢栄一伝記資料』テキストデータの再構築と活用」のデータを利用しています。 ライブラリの追加 以下を追記します。 <link rel="stylesheet" href="https://leaflet.github.io/Leaflet.markercluster/dist/MarkerCluster.css" /> <link rel="stylesheet" href="https://leaflet.github.io/Leaflet.markercluster/dist/MarkerCluster.Default.css" /> <script src="https://leaflet.github.io/Leaflet.markercluster/dist/leaflet.markercluster-src.js"></script> L.markerClusterGroupの利用 markersを作成して、個々のmarkerをaddLayerメソッドを使って追加します。最後に、mapにaddLayerメソッドを使って、markersを追加します。 ... // 地図の初期化 var map = L.map("map").setView(center, zoom); ... var markers = L.markerClusterGroup(); for (var i = 0; i < places.length; i++) { var place = places[i]; const geoList = place.getElementsByTagName("geo"); for (const geo of geoList) { var [lat, lon] = geo.textContent.trim().split(" ").map(Number); // 文字列を数値の緯度経度に変換 // マーカーを作成して地図上に追加 var marker = L.marker([lat, lon]); const placeName = place.getElementsByTagName("placeName")[0].textContent; // マーカーにクリック時のポップアップを設定 marker.bindPopup(placeName); markers.addLayer(marker); } } map.addLayer(markers); まとめ TEI/XMLの可視化にあたり、参考になりましたら幸いです。 ...

2024年4月12日 · 1 分 · Nakamura

Nuxt3でサイトマップを作成する

概要 Nuxt3でサイトマップを作成する方法がいくつかありましたので、備忘録です。 [1] @nuxtjs/sitemap ドキュメント https://sitemap.nuxtjs.org/ 参考記事 https://zenn.dev/kumao/articles/3fe10078a7e9d2 インストール npm install -D @nuxtjs/sitemap リポジトリ https://github.com/nuxt-community/sitemap-module [2] sitemap 参考記事 https://zenn.dev/kakkokari_gtyih/articles/db1aed4fed6054 インストール npm install -D sitemap リポジトリ https://github.com/ekalinin/sitemap.js [3] nuxt-simple-sitemap こちらは、以下の記載がありましたので、[1]の@nuxtjs/sitemapを使うのがよさそうです。 Package has been migrated to @nuxtjs/sitemap. https://www.npmjs.com/package/nuxt-simple-sitemap ドキュメント https://nuxt.com/modules/simple-sitemap 参考記事 https://shinobiworks.com/blog/615/ インストール npm install --save-dev nuxt-simple-sitemap リポジトリ https://github.com/nuxt-modules/sitemap まとめ 他にもあるかもしれませんが、参考になりましたら幸いです。

2024年3月8日 · 1 分 · Nakamura

DrupalのSimple OAuthとPostmanを使ったOAuth認証の確認

概要 DrupalのSimple OAuthとPostmanを使ったOAuth認証の確認を行います。 以前に以下の記事を書きましたが、もう少し掘り下げてみます。 DrupalでSimple OAuthの設定を行う 以下を参考にしてください。 https://nakamura196.pages.dev/ja/posts/e4ce978db12227/#oauthクライアントの作成 Postman グラントタイプがpasswordの場合 /oauth/token に対して、Body > x-www-form-urlencoded に以下を指定しました。 キー 値 grant_type password client_id {作成したCLIENT_ID。例:gt8UKlKltI4qs1XP5KLucIXiYw9ulGb0xS4RyO437dc} client_secret {作成したCLIENT_SECRET。例:test} username {ユーザ名。例:yamato} password {パスワード。例:yamato} 結果、以下のようなJSONが返却されました。 { "token_type": "Bearer", "expires_in": 300, "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJS...", "refresh_token": "def50200295e412f..." } jwt.ioで確認したところ、以下のようにデコードされました。 { "aud": "gt8UKlK...", "jti": "6dc1fee..", "iat": 1709386974, "nbf": 1709386974, "exp": 1709387274.122002, "sub": "2", "scope": [ "authenticated", "cj" ] } subはDrupalのユーザのIDに該当し、scopeはDrupalで設定した値が返却されました。 異なるユーザでログインした場合、異なるsubが与えられました。 ユーザ名またはパスワードをまちがえる 以下が返却されました。 { "error": "invalid_grant", "error_description": "The user credentials were incorrect.", "message": "The user credentials were incorrect." } 間違ったscopeを指定する 以下のように、間違ったscopeを指定します。 キー 値 grant_type password client_id {作成したCLIENT_ID。例:gt8UKlKltI4qs1XP5KLucIXiYw9ulGb0xS4RyO437dc} client_secret {作成したCLIENT_SECRET。例:test} username {ユーザ名。例:yamato} password {パスワード。例:yamato} scope test 以下が返却されました。 ...

2024年3月2日 · 2 分 · Nakamura

METSFlaskを試す

概要 以下のMETSFlaskを試します。 https://github.com/tw4l/METSFlask 以下のように説明されています。 A web application for human-friendly exploration of Archivematica METS files [機械翻訳] ArchivematicaのMETSファイルを人間に優しい方法で探索するためのウェブアプリケーション 使い方 以下のサイトで試すことができます。 http://bitarchivist.pythonanywhere.com/ METSファイルをアップロードした結果が以下です。今回は、1つのWordファイルのみが格納されていたため、1つのオリジナルファイルに関する情報が表示されます。 Viewボタンをクリックすると、詳細画面に遷移します。 PREMIS Eventsにおいて、METSファイルのmets:digiprovMDセクションの内容が表示されていました。このセクションは、デジタルプロビナンス(デジタルオブジェクトの起源や履歴を追跡する情報)メタデータを扱うようです。 <mets:digiprovMD ID="digiprovMD_8"> <mets:mdWrap MDTYPE="PREMIS:EVENT"> <mets:xmlData> <premis:event xmlns:premis="http://www.loc.gov/premis/v3" xsi:schemaLocation="http://www.loc.gov/premis/v3 http://www.loc.gov/standards/premis/v3/premis.xsd" version="3.0"> <premis:eventIdentifier> <premis:eventIdentifierType>UUID</premis:eventIdentifierType> <premis:eventIdentifierValue>24741142-467a-45da-936e-78e43ab68a6c</premis:eventIdentifierValue> </premis:eventIdentifier> <premis:eventType>ingestion</premis:eventType> <premis:eventDateTime>2024-02-26T03:34:19.082563+00:00</premis:eventDateTime> <premis:eventDetailInformation> <premis:eventDetail/> </premis:eventDetailInformation> <premis:eventOutcomeInformation> <premis:eventOutcome/> <premis:eventOutcomeDetail> <premis:eventOutcomeDetailNote/> </premis:eventOutcomeDetail> </premis:eventOutcomeInformation> <premis:linkingAgentIdentifier> <premis:linkingAgentIdentifierType>preservation system</premis:linkingAgentIdentifierType> <premis:linkingAgentIdentifierValue>Archivematica-1.16</premis:linkingAgentIdentifierValue> </premis:linkingAgentIdentifier> <premis:linkingAgentIdentifier> <premis:linkingAgentIdentifierType>repository code</premis:linkingAgentIdentifierType> <premis:linkingAgentIdentifierValue>test</premis:linkingAgentIdentifierValue> </premis:linkingAgentIdentifier> <premis:linkingAgentIdentifier> <premis:linkingAgentIdentifierType>Archivematica user pk</premis:linkingAgentIdentifierType> <premis:linkingAgentIdentifierValue>1</premis:linkingAgentIdentifierValue> </premis:linkingAgentIdentifier> </premis:event> </mets:xmlData> </mets:mdWrap> </mets:digiprovMD> mets:mdWrapのChatGPT 4による説明は以下のとおりです。 ...

2024年2月27日 · 2 分 · Nakamura

Access to MemoryのRESTful APIを試す

概要 Access to MemoryのRESTful APIの一例を試してみます。 以下が公式のドキュメントです。 https://www.accesstomemory.org/en/docs/2.8/dev-manual/api/api-intro/ Browse taxonomy terms https://demo.accesstomemory.org/api/taxonomies/34 [ { "name": "Collection" }, { "name": "File" }, { "name": "Fonds" }, { "name": "Item" }, { "name": "Part" }, { "name": "Record group" }, { "name": "Series" }, { "name": "Sous-fonds" }, { "name": "Subseries" } ] Browse information objects endpoint https://demo.accesstomemory.org/api/informationobjects { "total": 460, "results": [ { "reference_code": "CA ON00012 SC105", "slug": "kathleen-munn-fonds", "title": "Kathleen Munn fonds", "repository": "Art Gallery of Ontario", "level_of_description": "Fonds", "creators": [ "Munn, Kathleen Jean, 1887-1974" ], "creation_dates": [ "1912-[193-]" ] }, { "reference_code": "CA ON00012 SC069", "slug": "gallery-44-centre-for-contemporary-photography-fonds", "title": "Gallery 44 Centre for Contemporary Photography fonds", "repository": "Art Gallery of Ontario", "level_of_description": "Fonds", "creators": [ "Gallery 44 Centre for Contemporary Photography" ], "creation_dates": [ "[ca. 1979] - 2000" ], "place_access_points": [ "Toronto", "York, Regional Municipality of", "Ontario", "Canada" ] }, { "slug": "bitter-paradise-sell-out-of-east-timor-fonds", "title": "*Bitter Paradise: The Sell-Out of East Timor* fonds", "repository": "University of British Columbia Archives", "level_of_description": "Fonds", "creators": [ "Briere, Elaine" ], "creation_dates": [ "1985 - 1997" ] }, ... Read information object endpoint 以下の記事でOAIを通じて取得したレコードを、API経由で取得してみます。 ...

2024年2月26日 · 2 分 · Nakamura

ArchivesSpaceのRESTful APIを試す

概要 ArchivesSpaceのRESTful APIの一例を試してみます。 以下が公式のドキュメントです。 https://archivesspace.github.io/archivesspace/api/#introduction List all corporate entity agents 以下に記載があります。 https://archivesspace.github.io/archivesspace/api/#list-all-corporate-entity-agents デモサイトを使用した場合、以下のURLでアクセスできます。 https://sandbox.archivesspace.org/staff/api/agents/corporate_entities?page=1 結果は以下です。 { "first_page": 1, "last_page": 3, "this_page": 1, "total": 27, "results": [ { "lock_version": 5, "publish": false, "created_by": "admin", "last_modified_by": "admin", "create_time": "2022-03-23T13:44:30Z", "system_mtime": "2024-02-25T06:02:12Z", "user_mtime": "2022-05-17T20:46:06Z", "is_slug_auto": false, "jsonmodel_type": "agent_corporate_entity", "agent_contacts": [ { "lock_version": 0, "name": "Manuscripts Repository", "created_by": "admin", "last_modified_by": "admin", "create_time": "2022-05-17T20:46:06Z", "system_mtime": "2022-05-17T20:46:06Z", "user_mtime": "2022-05-17T20:46:06Z", "is_representative": true, "jsonmodel_type": "agent_contact", "telephones": [ ], "notes": [ ] } ], "agent_record_controls": [ ], "agent_alternate_sets": [ ], "agent_conventions_declarations": [ ], "agent_other_agency_codes": [ ], "agent_maintenance_histories": [ ], "agent_record_identifiers": [ ], "agent_identifiers": [ ], "agent_sources": [ ], "agent_places": [ ], "agent_occupations": [ ], "agent_functions": [ ], "agent_topics": [ ], "agent_resources": [ ], "linked_agent_roles": [ ], "external_documents": [ ], "notes": [ ], "used_within_repositories": [ ], "used_within_published_repositories": [ ], "dates_of_existence": [ ], "used_languages": [ ], "metadata_rights_declarations": [ ], "names": [ { "lock_version": 0, "primary_name": "Allen Doe Research Center", "sort_name": "Allen Doe Research Center", "sort_name_auto_generate": true, "created_by": "admin", "last_modified_by": "admin", "create_time": "2022-05-17T20:46:06Z", "system_mtime": "2022-05-17T20:46:06Z", "user_mtime": "2022-05-17T20:46:06Z", "authorized": true, "is_display_name": true, "jurisdiction": false, "conference_meeting": false, "source": "local", "jsonmodel_type": "name_corporate_entity", "use_dates": [ ], "parallel_names": [ ] } ], "related_agents": [ ], "uri": "/agents/corporate_entities/1", "agent_type": "agent_corporate_entity", "is_linked_to_published_record": false, "display_name": { "lock_version": 0, "primary_name": "Allen Doe Research Center", "sort_name": "Allen Doe Research Center", "sort_name_auto_generate": true, "created_by": "admin", "last_modified_by": "admin", "create_time": "2022-05-17T20:46:06Z", "system_mtime": "2022-05-17T20:46:06Z", "user_mtime": "2022-05-17T20:46:06Z", "authorized": true, "is_display_name": true, "jurisdiction": false, "conference_meeting": false, "source": "local", "jsonmodel_type": "name_corporate_entity", "use_dates": [ ], "parallel_names": [ ] }, "title": "Allen Doe Research Center", "is_repo_agent": "Allen Doe Research Center" }, { ... GUIでは以下のページが該当しました。 ...

2024年2月26日 · 2 分 · Nakamura

ArchivesSpaceのOAI Repositoryを試す

概要 ArchivesSpaceは、以下のように説明されています。 https://github.com/archivesspace/archivesspace Built for archives by archivists, ArchivesSpace is the open source archives information management application for managing and providing web access to archives, manuscripts and digital objects. (機械翻訳)アーキビストによってアーカイブのために構築されたArchivesSpaceは、アーカイブ、原稿、デジタルオブジェクトの管理とウェブアクセス提供のためのオープンソースのアーカイブ情報管理アプリケーションです。 この記事では、ArchivesSpaceが提供するOAI Repository機能を試します。 https://archivesspace.github.io/tech-docs/architecture/oai-pmh/ 設定 今回は、ArchivesSpaceのデモサイトを使用します。 以下にアクセスし、必要な設定を行います。 https://sandbox.archivesspace.org/staff/oai_config/edit メタデータフォーマットの一覧を取得する 以下により、メタデータフォーマットの一覧を取得できました。 https://sandbox.archivesspace.org/oai?verb=ListMetadataFormats 以下が結果です。oai_dc、oai_ead、oai_dcterms、oai_marc、oai_modsが利用可能なことが確認できます。 <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> <script/> <responseDate>2024-02-26T12:11:15Z</responseDate> <request verb="ListMetadataFormats">https://sandbox.archivesspace.org/</request> <ListMetadataFormats> <metadataFormat> <metadataPrefix>oai_dc</metadataPrefix> <schema>http://www.openarchives.org/OAI/2.0/oai_dc.xsd</schema> <metadataNamespace>http://www.openarchives.org/OAI/2.0/oai_dc/</metadataNamespace> </metadataFormat> <metadataFormat> <metadataPrefix>oai_ead</metadataPrefix> <schema>https://www.loc.gov/ead/ead.xsd</schema> <metadataNamespace>http://www.loc.gov/ead/</metadataNamespace> </metadataFormat> <metadataFormat> <metadataPrefix>oai_dcterms</metadataPrefix> <schema>http://dublincore.org/schemas/xmls/qdc/2008/02/11/dcterms.xsd</schema> <metadataNamespace>http://purl.org/dc/terms/</metadataNamespace> </metadataFormat> <metadataFormat> <metadataPrefix>oai_marc</metadataPrefix> <schema>https://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd</schema> <metadataNamespace>http://www.loc.gov/MARC21/slim</metadataNamespace> </metadataFormat> <metadataFormat> <metadataPrefix>oai_mods</metadataPrefix> <schema>https://www.loc.gov/standards/mods/v3/mods-3-6.xsd</schema> <metadataNamespace>http://www.loc.gov/mods/v3</metadataNamespace> </metadataFormat> </ListMetadataFormats> </OAI-PMH> セットの一覧を取得する 以下により、セットの一覧を取得できました。 ...

2024年2月26日 · 6 分 · Nakamura

Access to MemoryのOAI Repositoryを試す

概要 Access to Memoryは、以下のように説明されています。 https://github.com/artefactual/atom AtoM (short for Access to Memory) is a web-based, open source application for standards-based archival description and access. The application is multilingual and multi-repository. First commissioned by the International Council on Archives (ICA) to make it easier for archival institutions worldwide to put their holdings online using the ICA’s descriptive standards, the project has since grown into an internationally used community-driven project. (機械翻訳)AtoM(Access to Memoryの略称)は、標準に基づいたアーカイブ記述とアクセスのためのウェブベースのオープンソースアプリケーションです。このアプリケーションは、多言語かつ多リポジトリに対応しています。国際アーカイブ評議会(ICA)によって初めて委託された目的は、世界中のアーカイブ機関がICAの記述標準を使用して所蔵品をオンラインで公開しやすくすることでしたが、プロジェクトは以降、国際的に使用されるコミュニティ主導のプロジェクトへと成長しました。 ...

2024年2月26日 · 2 分 · Nakamura

sidebase/nuxt-authをproduction環境で使う際のTips

概要 sidebase/nuxt-authをproduction環境で使う際の注意点に関する備忘録です。 sidebase/nuxt-authは、Nuxt 3 アプリケーション向けの認証モジュールです。 https://github.com/sidebase/nuxt-auth 問題 VercelやAWS Amplifyにデプロイした際、以下のメッセージとともに、サーバエラーが発生しました。 AUTH_NO_ORIGIN: No `origin` - this is an error in production, see https://sidebase.io/nuxt-auth/resources/errors. You can ignore this during development 対策 以下が参考になりました。 https://github.com/sidebase/nuxt-auth/issues/613 以下のようにbaseURLを与えることで、上記のエラーを解消できました。 auth: { baseURL: process.env.AUTH_ORIGIN, }, 改めて確認すると、以下に記載がありましたが、なかなかたどり着くことができませんでした。 https://sidebase.io/nuxt-auth/configuration/nuxt-config#provider-authjs-baseurl まとめ 同様の事象でお困りの方の参考になりましたら幸いです。

2024年2月12日 · 1 分 · Nakamura

sphinxを用いた作成されたドキュメントサイトに日本語訳を追加する

概要 sphinxを用いた作成されたドキュメントサイトに日本語訳を追加することがあり、その備忘録です。 以下を対象にします。 https://github.com/artefactual/archivematica-storage-service-docs 方法 まず、対象リポジトリをForkします。 次に、Cloneします。 git clone https://github.com/nakamura196/archivematica-storage-service-docs cd atom-docs ここでは、Pythonの仮想環境を作成しておきます。 python -m venv .venv source .venv/bin/activate pip install --upgrade pip pip install -r requirements.txt ライブラリの追加 requirements.txtにsphinx-intlを追加して、インストールします。 sphinx sphinx-intl sphinx-autobuild pip install -r requirements.txt (オプション) conf.py conf.pyに言語設定が存在しない場合には、以下のように追加します。 ... # 言語設定 locale_dirs = ['locale/'] # 翻訳ファイルを格納するディレクトリ gettext_compact = False # ファイル名を短くしない language = "ja" そして、gettextビルドを実行します。 make gettext 日本語ディクレトリの作成 以下を実行すると、locale/jaにpoファイルが作成されます。 sphinx-intl update -p _build/locale -l ja 編集 locale/ja以下のpoファイルを編集することで、多言語化を行います。 ...

2024年2月12日 · 2 分 · Nakamura

GitHub ActionsとSCPを使って、さくらのレンタルサーバにビルド結果をコピーする

概要 GitHub ActionsとSCPを使って、さくらのレンタルサーバにビルド結果をコピーする機会がありましたので、その備忘録です。 以下のGitHub Actionsを使用しました。 https://github.com/appleboy/scp-action つまづいた点 以下の記法で試みたところ、ローカル環境でactを使った際にはうまく動作しましたが、GitHub Actionsで実行した際にはうまくいきませんでした。 name: scp files on: [push] jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: copy file via ssh password uses: appleboy/scp-action@master with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} password: ${{ secrets.PASSWORD }} port: ${{ secrets.PORT }} source: "tests/a.txt,tests/b.txt" target: your_server_target_folder_path 具体的には、以下のエラーが発生しました。 GitHub actions workflow error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain こちらについて以下が参考になりました。 ...

2024年2月8日 · 1 分 · Nakamura

MariaDBでのmysqldump: not foundへの対応

MariaDBを使用している際、例えば以下のようにバックアップを試みたところ、mysqldump: not foundのエラーが生じました。 mysqldump -uomeka -pomeka omeka > test.sql この対応として、以下の記事を参考にして、mariadb-dumpを使うと回避できました。 https://mariadb.com/kb/en/mysqldump/ 具体的には、以下のようにすることで、無事にバックアップできました。 mariadb-dump -uomeka -pomeka omeka > test.sql 同様の事象でお困りの方の参考になりましたら幸いです。

2024年2月7日 · 1 分 · Nakamura

Mirador 3でPresentation API v2のマニフェストが表示できない時の対処例

概要 以下のようなPresentation API v2のマニフェストファイルをMirador 3にロードした際、表示エラーが生じました。 https://gist.githubusercontent.com/nakamura196/42fb6bca6a9fa137234c334cb313fc58/raw/4188ebccb7406ff5132331a4fecc4ace8bdd7ebc/ng.json 以下、Mirador 3での表示です。 この原因と対処法について調べたので、共有します。 原因 以下のエラーメッセージが表示されていました。IIIF v2を入力しているにもかかわらず、v3と判断されているようでした。 Error: A IIIF v3 localized property value must have an array as the value for a given language. at PropertyValue.ts:126:20 at Array.map (<anonymous>) at t.parse (PropertyValue.ts:123:29) at t.getLabel (ManifestResource.ts:35:28) at canvases.js:162:12 at index.js:67:25 at h (defaultMemoize.js:123:20) at index.js:81:40 at h (defaultMemoize.js:123:20) at Function.mapToProps (OpenSeadragonViewer.js:39:12) これは、以下のように、canvasのlabelがオブジェクトの形で記述されている際に発生するようでした。 canvases": [ { "@id": "https://islamic-architecture.aa-ken.jp/omekas/iiif/2/monument1/canvas/p1", "@type": "sc:Canvas", "label": { "type": "literal", "property_id": 1, "property_label": "Title", "is_public": true, "@value": "0001-01" }, ... } ] なお、上記の記述方法は、Presentation API ValidatorではOKでした。 ...

2024年2月6日 · 1 分 · Nakamura

Omeka SのモジュールIIIF Viewersの更新

概要 IIIF ViewersはOmeka Sのモジュールの一つです。 https://github.com/omeka-j/Omeka-S-module-IiifViewers 最新版のリリースは以下です。 https://github.com/omeka-j/Omeka-S-module-IiifViewers/releases/latest 今回、いくつかの更新を行いましたので、備忘録です。 Universal Viewerのバージョン更新 Universal Viewerのバージョンをv4.0.25に更新しました。 合わせて、READEME.mdの以下の箇所に、Universal Viewerの更新方法を記載しました。 https://github.com/omeka-j/Omeka-S-module-IiifViewers?tab=readme-ov-file#compilation-of-universal-viewer これは、以下のモジュールの記載を参考にしています。 https://github.com/Daniel-KM/Omeka-S-module-UniversalViewer また、Miradorの更新方法も記載しましたが、既に最新版が導入されていたので、更新は行われていません。 バグ修正 以下に加えて、細かなバグを修正しました。 Module.php 以下のエラーが生じていました。 Deprecated: Creation of dynamic property IiifViewers\Module::$dependencies is deprecated in /var/www/html/modules/IiifViewers/Module.php on line 147 以下のように修正しました。 namespace IiifViewers; use Omeka\Module\AbstractModule; use IiifViewers\Form\ConfigForm; use Laminas\Mvc\Controller\AbstractController; use Laminas\EventManager\Event; use Laminas\EventManager\SharedEventManagerInterface; use Laminas\Mvc\MvcEvent; use Laminas\View\Renderer\PhpRenderer; use Laminas\ServiceManager\ServiceLocatorInterface; use Omeka\Module\Exception\ModuleCannotInstallException; use Omeka\Stdlib\Message; class Module extends AbstractModule { protected $dependencies = []; // Define the property at the beginning // Rest of your code... iiif-viewers.phtml 以下のWarningが生じていたので、いずれも修正しました。 ...

2024年2月5日 · 1 分 · Nakamura