genai-retrieval

Introspect RDF datasets and retrieve information via SPARQL with GenAI natural language queries.

8|1|Updated Jun 7, 2026
One-click install
npx skills add https://github.com/sparq-org/sparq --skill genai-retrieval
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: genai-retrieval
Source: https://github.com/sparq-org/sparq/tree/main/skills/genai-retrieval
Command: npx skills add https://github.com/sparq-org/sparq --skill genai-retrieval

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sparq-core, sparq-introspect, sparq-nlq, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill automates the process of understanding and retrieving information from RDF datasets using SPARQL, enhanced with natural language processing capabilities provided by Generative AI.

Core Features & Use Cases

  • RDF Dataset Introspection: Generate schema cards, VoID representations, and SHACL node shapes for datasets.
  • SPARQL-based Retrieval: Build token-budgeted retrieval contexts for unknown RDF datasets using NL→SPARQL loops.
  • NLQ Integration: Utilize Natural Language Query (NLQ) for seamless querying of RDF graphs with SPARQL.
  • Use Case: Consider an RDF dataset representing a university's student records. This Skill can help you quickly generate a schema card for the dataset and allow you to ask natural language questions to retrieve relevant information like "What is the list of students majoring in Computer Science?"

Quick Start

Load an RDF dataset with 'sparq-core::Graph::load_str("data.ttl", "turtle")?;'. Use the 'sparq_introspect::Introspection::build(&graph)' to generate a schema card. To query, initialize an NLQ with 'sparq_nlq::Nlq::new(&graph, Box::new(ReplayLlm::from_file("tests/fixtures/olympics_replay.json")?));' and then call 'ask("What are the average grades of students?")?;'

Frequently Asked Questions about genai-retrieval

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query an RDF dataset using natural language instead of writing SPARQL?

You can query RDF datasets using natural language by leveraging NLQ integration, which translates natural language questions into SPARQL queries. This allows you to ask questions directly against RDF graphs without writing SPARQL manually.

What is RDF dataset introspection and how does it help with data retrieval?

RDF dataset introspection is the automated process of generating schema cards, VoID representations, and SHACL node shapes for datasets. It helps with data retrieval by providing structured summaries of unknown datasets, enabling token-budgeted retrieval contexts.

Can I use this to retrieve data from unknown RDF datasets without prior schema knowledge?

Yes, you can retrieve data from unknown RDF datasets without prior schema knowledge. The Skill builds token-budgeted retrieval contexts using NL to SPARQL loops, allowing ad-hoc querying of unfamiliar RDF graphs.

Do I need sparq-core and sparq-nlq to perform natural language queries on RDF graphs?

Yes, sparq-core, sparq-introspect, and sparq-nlq are required dependencies. You need sparq-core to load the RDF graph and sparq-nlq to initialize the natural language query interface for SPARQL-based retrieval.

What's the best way to generate a schema card for a Turtle dataset?

The best way to generate a schema card for a Turtle dataset is to load the data using a graph loader and then run an introspection build process. This automatically generates schema cards, VoID representations, and SHACL node shapes.

Why does my natural language query fail on a newly loaded RDF graph?

Natural language queries may fail if the NLQ interface is not properly initialized with the loaded graph and a language model. You must initialize the NLQ instance with the graph object and an LLM replay file before calling the ask function.