File size: 1,691 Bytes
e67043b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Wikidata Query

Contributor: [Yuzhang Zhu](https://github.com/Zhu-Yuzhang)

# Search in Wikidata Tool

This Markdown document provides an introduction to the `Search in Wikidata` function implemented in the given code. The function allows users to search for factual information in Wikidata by querying entities, relations, and performing SPARQL queries.

## Function Summary

The `Search in Wikidata` function is a tool that enables users to search for factual information in Wikidata. It provides functionality for finding entities, retrieving entity details, searching for relations, and performing SPARQL queries.

## Usage

To use the `Search in Wikidata` function, follow the steps below:

1. Call the desired endpoint with appropriate parameters to perform the specific search or query operation.
2. The function returns a markdown-formatted table containing the results.

## Endpoints

The `Search in Wikidata` tool provides the following endpoints:

### `/find_entity`

- **Method**: GET
- **Parameters**:
  - `input`: The input entity to find relations and properties for.

### `/find_entity_by_tail`

- **Method**: GET
- **Parameters**:
  - `input`: The input tail to find head entities and relations for.

### `/get_entity_id`

- **Method**: GET
- **Parameters**:
  - `input`: The surface form to search for entities.

### `/get_relation_id`

- **Method**: GET
- **Parameters**:
  - `input`: The surface form to search for relations.

### `/search_by_code`

- **Method**: GET
- **Parameters**:
  - `query`: The SPARQL query to perform.

## Error Handling

If any invalid options or exceptions occur during the execution of the function, appropriate error messages are printed.