Overview

This is a continuation of the following article.

One of the features of LEAF-WRITER is described as follows:

the ability to look up and select identifiers for named entity tags (persons, organizations, places, or titles) from the following Linked Open Data authorities: DBPedia, Geonames, Getty, LGPN, VIAF, and Wikidata.

This feature uses libraries such as the following.

https://github.com/cwrc/wikidata-entity-lookup

I tried out this feature.

Usage

npm packages are published at the following locations.

https://www.npmjs.com/search?q=cwrc

Although not listed above, the target for this time is the following.

https://www.npmjs.com/package/wikidata-entity-lookup

Install it with the following command.

npm i wikidata-entity-lookup

wikidataLookup.findPerson can be executed as follows.

<script lang="ts" setup>
// @ts-ignore
import wikidataLookup from "wikidata-entity-lookup";

interface Entity {
  id: string;
  name: string;
  description: string;
  uri: string;
}

const query = ref<string>("");
const results = ref<Entity[]>([]);

const search = () => {
  wikidataLookup.findPerson(query.value).then((result: Entity[]) => {
    results.value = result;
  });
};
</script>

Demo

I prepared an implementation example with Nuxt.

https://github.com/nakamura196/nuxt3-demo/blob/main/pages/wikidata-entity-lookup/index.vue

You can try it at the following URL.

https://nakamura196.github.io/nuxt3-demo/wikidata-entity-lookup

Summary

I hope this serves as a helpful reference.