Skip to content
Back to skills

Sparql Querying

ASecurity

Use when writing, optimizing or debugging SPARQL queries and updates — SELECT, ASK, CONSTRUCT, OPTIONAL, FILTER, unbound variables, aggregates, property paths, GRAPH, SERVICE federation, pagination, SPARQL 1.2.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 13, 2026
ai-agentsexpressdebugginggitapiperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned November 13, 2026

npx -y skills add Getty/skills --skill sparql-querying --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sparql Querying?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sparql Querying
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/getty-sparql-querying/badge)](https://www.skillsdirectory.com/skills/getty-sparql-querying)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sparql-querying
description: "Use when writing, optimizing or debugging SPARQL queries and updates — SELECT, ASK, CONSTRUCT, OPTIONAL, FILTER, unbound variables, aggregates, property paths, GRAPH, SERVICE federation, pagination, SPARQL 1.2."
---

# SPARQL Querying

Use SPARQL to match RDF graph patterns, combine variable bindings, and return tables, booleans, or RDF graphs. Establish the dataset and desired result meaning before optimizing query text. Query correctness depends on graph selection, solution multiplicity, expression errors, and entailment as much as on syntax.

Use the SPARQL 1.1 Recommendations of 21 March 2013 as the portable baseline. SPARQL 1.2 is a later revision with its own publication status; read it from the specification. Select newer features only with an explicit specification/version and verified engine support. Do not assume a vendor's RDF-star extensions are identical to current SPARQL 1.2.

## Navigate the references

- [Query forms and patterns](references/query-patterns.md): query results, joins, unions, inline bindings, subqueries, and constructing RDF.
- [Multisets, missing values, and expressions](references/solutions-expressions.md): duplicate rows, OPTIONAL/FILTER placement, errors, negation, RDF term identity, and numeric comparison.
- [Paths, aggregates, and pagination](references/paths-aggregates-pagination.md): graph reachability, grouping, counting the correct unit, deterministic order, and page stability.
- [Datasets, inference, and performance](references/datasets-performance.md): default/named graphs, dataset clauses, entailment, execution plans, and safe optimization.
- [Updates and federation](references/updates-federation.md): mutation semantics, graph management, remote SERVICE calls, operational limits, and reproducibility.
- [Sources and versions](references/sources.md): primary specifications and feature-status boundaries.

These references are standalone. Choose an implementation only when the task needs executable code or a store-specific diagnostic.

## Establish the query contract

Identify the question, expected result unit, relevant predicates/classes, graph layout, and entailment regime. Inspect representative RDF terms rather than assuming that readable labels or JSON keys are predicate IRIs. Record whether values are IRIs or literals and which datatypes/languages occur.

For a table, define one row per what: entity, observation, relationship, source, or combination. For an aggregate, define the counted unit before joining optional labels or multi-valued properties. For a graph export, identify which triples and named-graph boundaries must be preserved.

State material assumptions and proceed when evidence permits. Ask only when a missing dataset policy or result definition would change the answer substantially.

## Build incrementally

1. Begin with the smallest required graph pattern and inspect several bindings.
2. Add joins while checking row counts and shared variables. Unconnected patterns create a Cartesian product.
3. Add optional fields separately; decide whether conditions restrict optional matches or remove whole result rows.
4. Add grouping and projection after the intended unit is clear. Use `DISTINCT` only where the result contract calls for deduplication.
5. Add graph clauses, paths, or federation with explicit scope.
6. Add ordering and limits for presentation; do not use a limit to disguise an incomplete or unstable result.

Use bound parameters or RDF-aware term serialization when an API supports them. Avoid inserting raw user strings into query syntax. Keep identifiers as RDF terms and escape literals according to the actual query language.

## Verify semantic edge cases

Check one missing optional value, one multi-valued property, and one datatype/language distinction when relevant. Exercise a nonmatching record and a graph outside the intended dataset. Compare expected bindings as RDF terms, including whether a variable is unbound.

For updates, preview the matching rows and exact graph targets before execution. For federation, record remote endpoint coverage and failures. For performance work, compare result multisets or the intended aggregate, not merely the first page's appearance.

Distinguish parse errors, evaluation errors, unavailable services, timeouts, access failures, and legitimate empty results. Explain whether a partial or timed-out response was returned. A successful HTTP status alone does not establish completeness.

## Deliver an assessable result

Return the query/update and explain its result unit, dataset, optional-value behavior, and ordering assumptions. Report observed execution evidence when available, including engine settings that affect meaning. For optimization, state why the rewrite preserves results and what measurement supports the improvement. For an explanation, use a compact example with explicit expected bindings rather than reciting syntax alone.

Files in this skill

  • SKILL.md4.8 KB
  • agents/openai.yaml422 B
  • assets/icon.svg1.7 KB
  • references/datasets-performance.md4 KB
  • references/paths-aggregates-pagination.md3.7 KB
  • references/query-patterns.md3.6 KB
  • references/solutions-expressions.md3.7 KB
  • references/sources.md2.4 KB
  • references/updates-federation.md3.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.