GraphQL: Use Common Interface for Classes


I’ve just started exploring Weaviate’s GraphQL interface and it works great!

I have used GraphQL in another context and built my own schema. Our model is based on schema(dot)org and I made schema:Thing an interface that is implemented by all other classes like schema:ScholarlyArticle etc.

Is it possible to add a GraphQL interface when creating a class? And if so, would this allow for a way of querying multiple vector spaces when using Get?

So if I create a class ScholarlyArticle that implements Thing and another class Book that also implements Thing, would it be possible to query also for Thing and thereby query the combined vector spaces for ScholarlyArticle and Book? Of course, one could only query for the properties of Thing.

Thanks for your feedback,


Hi @Tobias_Schweizer ! Welcome to our community :hugs:

Happy to know that you are experimenting and liking Weaviate!

AFAIK, there isn’t a way to implement such an Interface.

While you can use cross reference to create relationships between those classes, you will need to query each class with it’s properties separately.

There is a way to do multiple queries at the same request payload by leveraging GraphQL alias, like so:

   Get {
     Q1: MyClass(tenant: "rep-1") {
     Q2: MyClass(tenant: "rep-2") {

but those queries, while in the same request, are isolated from each other.

Also, a caveat: this is not supported in our clients, so you will need to use raw() method, or call it directly.

Let me know if this helps!


Hi @DudaNogueira,

Thanks for your response.

Would the results for those queries be returned as different lists/sets of results like shown here, each with their own pagination of results?

Do you think it would make sense to create a feature request for the support of interfaces in GraphQL? If so, I’d gladly add one.

In our own GraphQL endpoint, interfaces allow for more compact queries (and consistency) as fragments can be used:

# fragment definition for interface Thing
fragment baseFields on Thing {

# fields to be returned for a query
... on Dataset {

Kind regards,