For those of you that don't know, TerminusDB is a document graph database with Git-like superpowers. It stores data as JSON documents and the schema language connects these into a graph. You get the best of both worlds, the convenience of JSON with the query power of Graph.
The latest version of TerminusDB has been released which means TerminusDB now comes with GraphQL to improve the developer experience. Your data product schemas are automatically loaded in GraphQL for speed and convenience. GraphQL means you can now use any programming language to work with TerminusDB.
Enhancements include –
- GraphQL endpoint at localhost:6363/api/graphql/ORG/DB
- GraphiQL endpoint for testing available at localhost:6363/graphiql/ORG/DB
- GraphQL automatic loading of Schema in GraphQL schema
- GraphQL search and retrieval
Head on over to GitHub for a full list of enhancements and bug fixes.
If you want to learn more, take a look at our GraphQL docs or install the latest version of TerminusDB to experiment and play.
Excitingly, this release is a big step toward our TerminusDB becoming a headless CMS and connecting content in a knowledge graph. You can read more about our plans for headless CMS here.
Here’s a quick example of how GraphQL works in TerminusDB –
Using the following TerminusDB schema:
{ "@type" : "Class",
"@id" : "Person",
"name" : "xsd:string",
"dob" : "xsd:dateTime",
"friend" : {"@type" : "Set", "@class" : "Person" }}
TerminusDB will generate the following GraphQL class.
type Query {
Person(
id: ID
"""skip N elements"""
offset: Int
"""limit results to N elements"""
limit: Int
filter: Person_Filter
"""order by the given fields"""
orderBy: Person_Ordering
): [Person!]!
}
type Person {
dob: DateTime!
friend(
id: ID
"""skip N elements"""
offset: Int
"""limit results to N elements"""
limit: Int
filter: Person_Filter
"""order by the given fields"""
orderBy: Person_Ordering
): [Person!]!
name: String!
id: ID!
}
You can then query this using the GraphQL endpoint.
We’ve got more planned
TerminusDB automatically generates fields in GraphQL based on classes and their properties in the data product schema. Here you can use arguments such as id, offset, limit, and order by, as well as filters such as time comparisons and for strings, and, or, not. All the filter options are also automatically generated for you.
We’re not stopping here though, we are working to integrate WOQL into GraphQL so that you can use GraphQL for complex path queries to make building graph-based applications even easier.
Our goal is to be the smoothest and most powerful GraphQL experience around.
We hope you join us on this journey.
Other resources that you might like
RDF & GraphQL Bridge using a Star Wars Dataset
How we implemented GraphQL in 14 days
Tutorial – Build a blog-focused CMS with TerminusDB & GraphQL
Top comments (0)