Low Risk

sparql_query

Execute a SPARQL SELECT query against the DanNet triplestore. This tool provides direct access to DanNet's RDF data through SPARQL queries. The query is automatically prepended with common namespace prefix declarations, so you can use short prefixes instead of full URIs in your queries. =========...

Risk signalsAccepts freeform code/query input (query)

Part of the Dannet server.

sparql_query is read-only, but an agent in a loop can still rack up calls and cost. PolicyLayer caps every call before it runs. Live in minutes.

SECURE DANNET →

Free to start. No card required.

AI agents call sparql_query to retrieve information from Dannet without modifying any data. This is common in research, monitoring, and reporting workflows where the agent needs context before taking action. Because read operations don't change state, they are generally safe to allow without restrictions -- but you may still want rate limits to control API costs.

Even though sparql_query only reads data, uncontrolled read access can leak sensitive information or rack up API costs. An agent caught in a retry loop could make thousands of calls per minute. A rate limit gives you a safety net without blocking legitimate use.

Read-only tools are safe to allow by default. No rate limit needed unless you want to control costs.

policy.json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "sparql_query": {}
  }
}

See the full Dannet policy for all 16 tools.

Get this rule live on your own Dannet server in minutes. PolicyLayer enforces it on every call, before it runs.

ENFORCE ON MY DANNET →

View all 16 tools →

These attack patterns abuse exactly the kind of access sparql_query gives an agent. Each links to the full case and the policy that stops it:

Browse the full MCP Attack Database →

Every attack above starts with a tool call. PolicyLayer checks each one against your policy first, so sparql_query only ever does what you allow.

SECURE DANNET →

Other read tools across the catalogue. The same approach applies to each: allow, with a rate cap to control cost.

What does the sparql_query tool do? +

Execute a SPARQL SELECT query against the DanNet triplestore. This tool provides direct access to DanNet's RDF data through SPARQL queries. The query is automatically prepended with common namespace prefix declarations, so you can use short prefixes instead of full URIs in your queries. ============================================================ CRITICAL PERFORMANCE RULES (read before writing any query): ============================================================ 1. ALWAYS start from a known entity URI or a word lookup — never scan the whole graph. FAST: dn:synset-3047 wn:hypernym ?x . SLOW: ?x wn:hypernym ?y . (scans every synset) 2. ALWAYS use DISTINCT for SELECT queries to avoid duplicate rows. 3. NEVER use FILTER(CONTAINS(...)) on labels across the whole graph. SLOW: ?s rdfs:label ?l . FILTER(CONTAINS(?l, "hund")) FAST: Use get_word_synsets("hund") first, then query specific synset URIs. 4. NEVER create cartesian products — every triple pattern must share a variable with at least one other pattern. SLOW: ?x a ontolex:LexicalConcept . ?y a ontolex:LexicalEntry . (cross join!) 5. ALWAYS add LIMIT (even if max_results caps it server-side, explicit LIMIT lets the query engine optimize). 6. Use property paths for multi-hop traversals: FAST: dn:synset-3047 wn:hypernym+ ?ancestor . (transitive closure) FAST: ?entry ontolex:canonicalForm/ontolex:writtenRep "hund"@da . (path) 7. Prefer VALUES over FILTER for matching multiple known entities: FAST: VALUES ?synset { dn:synset-3047 dn:synset-3048 } ?synset rdfs:label ?l . SLOW: ?synset rdfs:label ?l . FILTER(?synset = dn:synset-3047 || ?synset = dn:synset-3048) 8. The triplestore contains BOTH DanNet (Danish, dn: namespace) AND the Open English WordNet (en: namespace). Unanchored queries will scan both. To restrict to Danish data, anchor on dn: URIs or use @da language tags. ============================================ FAST QUERY TEMPLATES (copy and adapt these): ============================================ TEMPLATE 1: Find synsets for a Danish word (via word lookup) SELECT DISTINCT ?synset ?label ?def WHERE { ?entry ontolex:canonicalForm/ontolex:writtenRep "WORD"@da . ?entry ontolex:sense/ontolex:isLexicalizedSenseOf ?synset . ?synset rdfs:label ?label . OPTIONAL { ?synset skos:definition ?def } } TEMPLATE 2: Get all properties of a known synset SELECT ?p ?o WHERE { dn:synset-NNNN ?p ?o . } LIMIT 50 TEMPLATE 3: Find hypernyms (broader concepts) of a known synset SELECT DISTINCT ?hypernym ?label WHERE { dn:synset-NNNN wn:hypernym ?hypernym . ?hypernym rdfs:label ?label . } TEMPLATE 4: Find hyponyms (narrower concepts) of a known synset SELECT DISTINCT ?hyponym ?label WHERE { ?hyponym wn:hypernym dn:synset-NNNN . ?hyponym rdfs:label ?label . } TEMPLATE 5: Trace full hypernym chain (taxonomic ancestors) SELECT DISTINCT ?ancestor ?label WHERE { dn:synset-NNNN wn:hypernym+ ?ancestor . ?ancestor rdfs:label ?label . } TEMPLATE 6: Find all relationships OF a known synset SELECT DISTINCT ?rel ?target ?targetLabel WHERE { dn:synset-NNNN ?rel ?target . ?target rdfs:label ?targetLabel . FILTER(isURI(?target)) } LIMIT 50 TEMPLATE 7: Find all relationships TO a known synset SELECT DISTINCT ?source ?rel ?sourceLabel WHERE { ?source ?rel dn:synset-NNNN . ?source rdfs:label ?sourceLabel . FILTER(isURI(?source)) } LIMIT 50 TEMPLATE 8: Query multiple known synsets at once SELECT DISTINCT ?synset ?label ?def WHERE { VALUES ?synset { dn:synset-3047 dn:synset-3048 dn:synset-6524 } ?synset rdfs:label ?label . OPTIONAL { ?synset skos:definition ?def } } TEMPLATE 9: Find functional relations for a specific synset SELECT DISTINCT ?rel ?target ?targetLabel WHERE { dn:synset-NNNN ?rel ?target . ?target rdfs:label ?targetLabel . VALUES ?rel { dns:usedFor dns:usedForObject wn:agent wn:instrument wn:causes } } TEMPLATE 10: Find ontological type of a synset (stored as RDF Bag) SELECT ?type WHERE { dn:synset-NNNN dns:ontologicalType ?bag . ?bag ?pos ?type . FILTER(STRSTARTS(STR(?pos), STR(rdf:_))) } ============================================ KNOWN PREFIXES (automatically declared): ============================================ dn: (DanNet data), dns: (DanNet schema), dnc: (DanNet concepts), wn: (WordNet relations), ontolex: (lexical model), skos: (definitions), rdfs: (labels), rdf: (types), owl: (ontology), lexinfo: (morphology), marl: (sentiment), dc: (metadata), ili: (interlingual index), en: (English WordNet), enl: (English lemmas), cor: (Danish register) Args: query: SPARQL SELECT query string (prefixes will be automatically added) timeout: Query timeout in milliseconds (default: 8000, max: 15000) max_results: Maximum number of results to return (default: 100, max: 100) distinct: Auto-apply DISTINCT to SELECT queries (default: True). Set to False when you need duplicate rows, e.g. for frequency counts. inference: Control model selection for query execution (default: None). None = auto-detect: tries base model first, retries with inference if SELECT results are empty (best for most queries). True = force inference model: needed for inverse relations like wn:hyponym, wn:holonym, etc. that are derived by OWL reasoning. False = force base model only, no retry. Returns: Dict containing SPARQL results in standard JSON format: - head: Query metadata with variable names - results: Bindings array with variable-value mappings Each value includes type (uri/literal) and language information when applicable Note: Only SELECT queries are supported. The query is validated before execution.. It is categorised as a Read tool in the Dannet MCP Server, which means it retrieves data without modifying state.

How do I enforce a policy on sparql_query? +

Register the Dannet MCP server in PolicyLayer and add a rule for sparql_query: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Dannet. Nothing to install.

What risk level is sparql_query? +

sparql_query is a Read tool with low risk. Read-only tools are generally safe to allow by default.

Can I rate-limit sparql_query? +

Yes. Add a rate_limit block to the sparql_query rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.

How do I block sparql_query completely? +

Set action: deny in the PolicyLayer policy for sparql_query. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.

What MCP server provides sparql_query? +

sparql_query is provided by the Dannet MCP server (https://wordnet.dk/mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.

Enforce policy on every Dannet tool call.

Deterministic rules across all 16 Dannet tools. Per-identity grants. Full audit log. Live in minutes. Nothing to install.

Free to start. No card required.

4,600+ MCP servers and 31,000+ tools scanned and risk-classified.

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.