graphql4sparql 0.7.0 Released - ETi

· Johanna Maass

We’re excited to announce the release of graphql4sparql 0.7.0 — a fast, streaming GraphQL-to-SPARQL rewriting system that brings the power of GraphQL to query SPARQL endpoints and RDF data.

What is graphql4sparql?

graphql4sparql transforms GraphQL queries into SPARQL queries at runtime, enabling you to:

The system doesn’t use GraphQL-Java’s execution engine. Instead, it rewrites GraphQL documents into SPARQL queries and post-processes the result sets — a more efficient approach for RDF data.

Key Features

Declarative SPARQL Mapping with GraphQL Directives

graphql4sparql introduces a powerful set of GraphQL directives for mapping to SPARQL patterns, such as:

Apache Jena Fuseki Integration

The release includes a fully functional Fuseki plugin that adds a native GraphQL endpoint type to Apache Jena Fuseki server. You can configure it with a simple Turtle configuration file and start querying your RDF data with GraphQL immediately.

See our example setup for a complete working configuration with demo data.

Schema Generator

Generate GraphQL schemas from your RDF data with the graphql4sparql schemagen CLI tool. This removes the need to write SPARQL patterns manually and provides type-safe querying out of the box.

Example Usage

Once the Fuseki plugin is configured, you can query your RDF data with simple GraphQL syntax:

query Works @pretty @debug {
  Work {
    type
    title
    creator
  }
}

Or use the sophisticated @index directive to group data by subjects and predicates:

query spo {
  subjects @pattern(of: "SELECT DISTINCT ?s { ?s ?p ?o } ", to: "s") 
           @index(by: "?s", oneIf: "true") {
    predicates @pattern(of: "?s2 ?p2 ?o2", from: "s2", to: "o2") 
               @index(by: "?p2", oneIf: "false") {
      objects @bind(of: "?o2")
    }
  }
}

Getting Started

With Apache Jena Fuseki

  1. Download the graphql4sparql-fuseki-plugin JAR
  2. Place it in Fuseki’s run/extra directory
  3. Configure your Fuseki service with the GraphQl4Sparql endpoint
  4. Start querying at http://localhost:3030/your-service/graphql

See our example setup for a complete, working configuration.

Technical Highlights

Resources

Acknowledgments

graphql4sparql is developed and maintained by the AKSW research group at the Institute for Applied Informatics.

This work was partially supported by grants from the German Federal Ministry of Transport (BMV) under the program mFund to the MobyDex project (19F2266A).