How to use facets with slash?

Was wondering how i can get and set facet values using slash’s graphql api. Thank you

1 Like

As far I can tell, GraphQL in general don’t support facets. The concept of extra information on edges doesn’t exist in GraphQL Specs. But there are plans to make it possible. You can also try to use it via custom DQL in the GraphQL Schema.

I would like to be able to set and query weights on facets via graphQL. Allow for built in network analysis (eigenvector centrality, spanning trees, etc…) would be great too.

I’d also like to be able to use facets with slash.

I think there are two decent options to implement this:

  1. access facets as fields on their connected nodes using a @facet directive
  2. Relationship types, similar to neo4j-graphql-js
1 Like

Slash now supports Lambdas. So you can use it to do DQL queries and mutations on the fly based on your GraphQL schema. It is in master, but I believe it is already on Slash. See https://dgraph.io/docs/master/graphql/lambda/overview/

1 Like

It is possible to query facets using Custom DQL and remote data types.
Example Custom DQL query:


type UserTweet @remote {
    screen_name: String
}

query {
 queryUserTweet: [UserTweet] @custom(dql: """
	query {
		queryUserTweet(func: type(User)) {
			screen_name: screen @facets(name)
		}
	}
	""")
}

It is however not possible to mutate facets using custom DQL as custom DQL does not support mutations.

We are working on adding support for Facets with GraphQL.
Related RFC and discussion: Facets in GraphQL