Semantic Search through the Complete Wikipedia with Weaviate’s GraphQL API

Rate this content
Bookmark

Weaviate uses GraphQL to provide user-friendly data interaction. Weaviate is an open-source vector search engine, and all searches (e.g. semantic, contextual) are done via its GraphQL API. We’ve put a lot of thought into the design of the GraphQL API, which results in good user and developer experience. In this talk, I will take you along in the journey of how our GraphQL implementation was shaped according to user needs and software requirements, and show a demo of the current design for Weaviate. The demo will show how Weaviate’s GraphQL design enables semantic (vector) search in combination with scalar search through unstructured data. Machine learning models are used in the background, but with the current GraphQL design, users without a technical background can query the vector database easily.


Weaviate has a modular architecture, so users can connect various machine learning models on top of the vector database. Examples are the newly released Question Answering module and the Named Entity Recognition module. Modules can extend the GraphQL schema dynamically, to query the new features intuitively.

This presentation contains a demo where we will query the complete Wikipedia, conduct semantic search queries and more. All through Weaviate’s GraphQL API. No prior knowledge is required.

This talk has been presented at GraphQL Galaxy 2021, check out the latest edition of this Tech Conference.

FAQ

Weaviate is a vector search engine or database that utilizes a GraphQL API to manage and query data. It's designed to handle unstructured data by converting it into vector representations through machine learning models, allowing for more contextual and nuanced search capabilities beyond simple keyword matching.

Weaviate uses machine learning models to convert data objects into vector representations. Each object is processed through the model to obtain a vector that represents its information in a multi-dimensional space. These vectors allow Weaviate to perform searches based on semantic meanings rather than just matching keywords.

The GraphQL API in Weaviate is designed to facilitate complex queries on the data stored within the database. It allows users to perform operations like 'Get', 'Explore', and 'Aggregate' to retrieve, search through vector space, and summarize data, respectively, using a flexible and powerful query language.

Yes, while the demo focuses on text data, Weaviate is capable of handling various types of data including images and videos. This is facilitated by different machine learning models that can vectorize diverse data types, making it a versatile tool for many use cases.

The core functions of Weaviate's GraphQL API include 'Get', 'Explore', and 'Aggregate'. 'Get' is used to retrieve specific items from the dataset, 'Explore' helps in searching through the complete vector space, and 'Aggregate' is used for summarizing data, such as counting objects.

To start using Weaviate and its GraphQL API, you can visit the SAMI.Technology website, access the Developer section, and follow the installation guide. There are also customization options available to tailor the setup according to specific needs.

Weaviate offers benefits such as handling unstructured data, providing semantic search capabilities through vector representations, and supporting complex queries with its GraphQL API. This makes it suitable for searching and managing large datasets with nuanced and contextual search requirements.

Yes, the Wikipedia dataset used in Weaviate's demo is open source and available on GitHub. It contains over 11 million articles, 27 million paragraphs, and 125 million cross-references, and can be used for testing and exploring Weaviate's capabilities.

Bob van Luijt
Bob van Luijt
17 min
10 Dec, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Weaviate is a database and search engine that uses a GraphQL API. It supports various machine learning models for data vectorization and search. The core functions of Weaviate are get, explore, and aggregate, which allow users to query and search through the data set. Weaviate provides fast and accurate results, allowing users to find anything in the dataset. The GraphQL API in Weaviate can be used for querying specific data and establishing graph relations.

1. Introduction to Weaviate and Vector Search Engines

Short description:

We will talk about our database, search engine Weaviate, and its GraphQL API. We will use a demo data set, the complete Wikipedia, to demonstrate how to query it. We will provide context on vector search engines, discuss the design of the GraphQL API, and give a demo of the API on the data set. Lastly, we will show you how to start Weaviate with its GraphQL API.

So hello everybody. Thank you for taking the time to listen to this talk. We are going to talk about a few things. So first of all, we're going to talk about our database, our search engine, Weaviate, and we're going to use a demo data set, which is the complete Wikipedia to show how you can query it, and most importantly of course, we're going to talk about the GraphQL API that it has.

So weave is a vector search engine or database, it has a GraphQL API, and we're going to use it to demo to show you the demo data set of the complete Wikipedia. So first I will give a little bit of context about like what the vector search engine is, so that you understand what we're talking about, if it's new to you. Then we will look at the design of the GraphQL API. Then we'll go into a demo of the API on the data set. And last but not least, I'll show you how you can start it with Weaviate and its GraphQL API yourself.

So again, thanks for listening. So first of all, what is Weaviate and what is a vector search engine? So at the core, we're dealing with the problem of unstructured data. If you ever use a database or if you ever use a search engine, then you know that the data that you're storing, for example, if it is text, that you can only find it if you use keywords. So for example, in a traditional search engine, you have to, if you search for this data object for wine, for seafood, you will probably not find it because except for the key here, there's nowhere where you find the word wine in the data. The word for is not in there either and seafood is not in there either. So using a vector search engine and you would search wine for seafood, it would actually find the data object. And the reason why it's able to do that is because every data object that you add to the search engine is run through a machine learning model. The machine learning model creates factor representations and that's what you use to search to the database.

Now if this is new to you, then let me give you a little bit of context so that you know what's happening there. So, most machine learning models output vectors. And the easiest way to think about vectors are coordinates. So, for example, our first model had 300 dimensions and you had all these kinds of words in there. So the bulbs here represent words like meat, chicken, fish, etc. What you can do if you add a new data object, for example, the Chardonnay that's good with is that all these individual words that you see here highlighted in green are found in the vector space and they're placed in that same vector space. And what you can do is that you can give a unique centroid position to that data object. So, now you can say in the vector space the data object, in this case the Chardonnay, sits exactly here in the middle of where all these words sit. So now, if you search for wine related to seafood or those kind of things, you will actually be able to find that data object. It is not 100% match, but it's an approximation of what you're searching for. But in a bit, you will see what actually the value is of this. So, as you see here, we have the class Wine with property Covey run 2005 Chardonnay. It might be related to a beacon, and it might have certain vector weights.

2. Data Object Structure and GraphQL API Design

Short description:

We will discuss the data object structure in Weaviate and the database's role in storing objects for vector search and filtering. Weaviate supports various machine learning models for data vectorization and search. The architecture includes modules like text-to-vec and Q&A, running on your infrastructure. Weaviate's core contains these modules, along with a persistence layer for storing vectors and an API for data search. We will focus on the GraphQL API and its design, which we chose over other options. The design involves classes, properties, and graph-like data models with additional properties for searching.

So this is what the data object looks like when you store it in a Weaviate instance. Well, to help you work with this, we have the database which you see in the middle to store your objects to do vector search and to do filtering. But of course, there are many, many machine learning models that you can use to actually or vectorize the data or search through the data.

The demo that I'm going to give today is purely focusing on text. However, you could also do this for images or videos or any other data type. If you go a little bit deeper under the hood, you see how that works from an architectural point of view. So for example, we have text-to-vec modules or we have Q&A modules. They often run on a GPU. That's all running on your infrastructure.

These modules sit in the Weaviate core, then there's a persistence layer that's taking care of storing the vectors, being able to search through the vectors and to store the data object. But most important, there is an API on top of it. Of course, what we're going to focus on today is the GraphQL API and how you can leverage to search through your data.

First, before we do that, I want to talk a little bit about the design of the GraphQL API, because you have to know when we created the database, we didn't have an interface yet. We had to choose what language will we choose to query data. Will we just have a pure RESTful API? Will we adopt some kind of query language? Will we invent something of our own? Then we decided that the best for us was actually to use GraphQL. This is, in a tiny nutshell, our design. At the top, you have a core function within UEFI 8. We'll look at that in a bit. You have a class that you can add and add your data to. A class can be anything. Whatever data you can have, for example, if you have documents, you can just have a class document. If you have products, you can have a class product. Then you have the properties. A property can be also anything. So, for example, if we stay with the class product, then you might have the property name or the property price. You can, of course, make a cross-reference. Hence, it's a graph-like data model. Then we have these underscore additional properties. Those are properties that you get as part of searching for classes. But those are baked in in the modules or into Weave8 itself.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

From GraphQL Zero to GraphQL Hero with RedwoodJS
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
From GraphQL Zero to GraphQL Hero with RedwoodJS
Top Content
Tom Pressenwurter introduces Redwood.js, a full stack app framework for building GraphQL APIs easily and maintainably. He demonstrates a Redwood.js application with a React-based front end and a Node.js API. Redwood.js offers a simplified folder structure and schema for organizing the application. It provides easy data manipulation and CRUD operations through GraphQL functions. Redwood.js allows for easy implementation of new queries and directives, including authentication and limiting access to data. It is a stable and production-ready framework that integrates well with other front-end technologies.
Local State and Server Cache: Finding a Balance
Vue.js London Live 2021Vue.js London Live 2021
24 min
Local State and Server Cache: Finding a Balance
Top Content
This Talk discusses handling local state in software development, particularly when dealing with asynchronous behavior and API requests. It explores the challenges of managing global state and the need for actions when handling server data. The Talk also highlights the issue of fetching data not in Vuex and the challenges of keeping data up-to-date in Vuex. It mentions alternative tools like Apollo Client and React Query for handling local state. The Talk concludes with a discussion on GitLab going public and the celebration that followed.
A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top Content
Today's Talk discusses the importance of managing technical debt through refactoring practices, prioritization, and planning. Successful refactoring requires establishing guidelines, maintaining an inventory, and implementing a process. Celebrating success and ensuring resilience are key to building a strong refactoring culture. Visibility, support, and transparent communication are crucial for addressing technical debt effectively. The team's responsibilities, operating style, and availability should be transparent to product managers.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
Watch video: Debugging JS
Debugging JavaScript is a crucial skill that is often overlooked in the industry. It is important to understand the problem, reproduce the issue, and identify the root cause. Having a variety of debugging tools and techniques, such as console methods and graphical debuggers, is beneficial. Replay is a time-traveling debugger for JavaScript that allows users to record and inspect bugs. It works with Redux, plain React, and even minified code with the help of source maps.
Building a Voice-Enabled AI Assistant With Javascript
JSNation 2023JSNation 2023
21 min
Building a Voice-Enabled AI Assistant With Javascript
Top Content
This Talk discusses building a voice-activated AI assistant using web APIs and JavaScript. It covers using the Web Speech API for speech recognition and the speech synthesis API for text to speech. The speaker demonstrates how to communicate with the Open AI API and handle the response. The Talk also explores enabling speech recognition and addressing the user. The speaker concludes by mentioning the possibility of creating a product out of the project and using Tauri for native desktop-like experiences.
Power Fixing React Performance Woes
React Advanced Conference 2023React Advanced Conference 2023
22 min
Power Fixing React Performance Woes
Top Content
Watch video: Power Fixing React Performance Woes
This Talk discusses various strategies to improve React performance, including lazy loading iframes, analyzing and optimizing bundles, fixing barrel exports and tree shaking, removing dead code, and caching expensive computations. The speaker shares their experience in identifying and addressing performance issues in a real-world application. They also highlight the importance of regularly auditing webpack and bundle analyzers, using tools like Knip to find unused code, and contributing improvements to open source libraries.

Workshops on related topic

Build with SvelteKit and GraphQL
GraphQL Galaxy 2021GraphQL Galaxy 2021
140 min
Build with SvelteKit and GraphQL
Top Content
Featured WorkshopFree
Scott Spence
Scott Spence
Have you ever thought about building something that doesn't require a lot of boilerplate with a tiny bundle size? In this workshop, Scott Spence will go from hello world to covering routing and using endpoints in SvelteKit. You'll set up a backend GraphQL API then use GraphQL queries with SvelteKit to display the GraphQL API data. You'll build a fast secure project that uses SvelteKit's features, then deploy it as a fully static site. This course is for the Svelte curious who haven't had extensive experience with SvelteKit and want a deeper understanding of how to use it in practical applications.

Table of contents:
- Kick-off and Svelte introduction
- Initialise frontend project
- Tour of the SvelteKit skeleton project
- Configure backend project
- Query Data with GraphQL
- Fetching data to the frontend with GraphQL
- Styling
- Svelte directives
- Routing in SvelteKit
- Endpoints in SvelteKit
- Deploying to Netlify
- Navigation
- Mutations in GraphCMS
- Sending GraphQL Mutations via SvelteKit
- Q&A
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
End-To-End Type Safety with React, GraphQL & Prisma
React Advanced Conference 2022React Advanced Conference 2022
95 min
End-To-End Type Safety with React, GraphQL & Prisma
Featured WorkshopFree
Sabin Adams
Sabin Adams
In this workshop, you will get a first-hand look at what end-to-end type safety is and why it is important. To accomplish this, you’ll be building a GraphQL API using modern, relevant tools which will be consumed by a React client.
Prerequisites: - Node.js installed on your machine (12.2.X / 14.X)- It is recommended (but not required) to use VS Code for the practical tasks- An IDE installed (VSCode recommended)- (Good to have)*A basic understanding of Node.js, React, and TypeScript
GraphQL for React Developers
GraphQL Galaxy 2022GraphQL Galaxy 2022
112 min
GraphQL for React Developers
Featured Workshop
Roy Derks
Roy Derks
There are many advantages to using GraphQL as a datasource for frontend development, compared to REST APIs. We developers in example need to write a lot of imperative code to retrieve data to display in our applications and handle state. With GraphQL you cannot only decrease the amount of code needed around data fetching and state-management you'll also get increased flexibility, better performance and most of all an improved developer experience. In this workshop you'll learn how GraphQL can improve your work as a frontend developer and how to handle GraphQL in your frontend React application.
Build a Headless WordPress App with Next.js and WPGraphQL
React Summit 2022React Summit 2022
173 min
Build a Headless WordPress App with Next.js and WPGraphQL
Top Content
WorkshopFree
Kellen Mace
Kellen Mace
In this workshop, you’ll learn how to build a Next.js app that uses Apollo Client to fetch data from a headless WordPress backend and use it to render the pages of your app. You’ll learn when you should consider a headless WordPress architecture, how to turn a WordPress backend into a GraphQL server, how to compose queries using the GraphiQL IDE, how to colocate GraphQL fragments with your components, and more.
Relational Database Modeling for GraphQL
GraphQL Galaxy 2020GraphQL Galaxy 2020
106 min
Relational Database Modeling for GraphQL
Top Content
WorkshopFree
Adron Hall
Adron Hall
In this workshop we'll dig deeper into data modeling. We'll start with a discussion about various database types and how they map to GraphQL. Once that groundwork is laid out, the focus will shift to specific types of databases and how to build data models that work best for GraphQL within various scenarios.
Table of contentsPart 1 - Hour 1      a. Relational Database Data Modeling      b. Comparing Relational and NoSQL Databases      c. GraphQL with the Database in mindPart 2 - Hour 2      a. Designing Relational Data Models      b. Relationship, Building MultijoinsTables      c. GraphQL & Relational Data Modeling Query Complexities
Prerequisites      a. Data modeling tool. The trainer will be using dbdiagram      b. Postgres, albeit no need to install this locally, as I'll be using a Postgres Dicker image, from Docker Hub for all examples      c. Hasura