Skip to content

Conversation

@Jurij89
Copy link
Contributor

@Jurij89 Jurij89 commented Dec 10, 2025

Added DKG SPARQL query tool to plugin-dkg-essentials, fixed the concurrency issue when running in dev mode, and made some general code cleanup in the plugin-dkg-essentials.

…ing in dev mode, and made some general code cleanup in the plugin-dkg-essentials.

// Only allow query types supported by the DKG node
const allowedQueryTypes = ["SELECT", "CONSTRUCT"];
if (!allowedQueryTypes.includes(parsed.queryType)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could normalize the case here to make sure queryTyoe is always in uppercase. So something like this:

if (!allowedQueryTypes.includes(parsed.queryType?.toUpperCase()))

}

// Use validated query type
const queryType = validation.queryType || "SELECT";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if query passes validation, queryType should always be set so this fallback might hide potential bugs

Comment on lines +199 to +208
const queryResult = await ctx.dkg.graph.query(query, queryType);

const resultText = JSON.stringify(queryResult, null, 2);

return {
content: [
{
type: "text",
text: `✅ Query executed successfully\n\n**Results:**\n\`\`\`json\n${resultText}\n\`\`\``,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use JSON.stringify when a CONSTRUCT query is called since construct returns a raw string of N-triples?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants