query_memory
Query a semantic memory graph using SPARQL to retrieve only formally proven facts, verifying what the system knows with certainty.
Instructions
Query the semantic memory graph using SPARQL. Returns ONLY facts that are formally proven (either explicitly added by user or inferred by SPARQL rules).
CRITICAL - Your Role as Assistant:
You can make SOFT deductions based on language understanding (e.g., 'knows → probably acquaintances')
BUT you MUST distinguish between YOUR deductions and FORMALLY PROVEN facts
Use this tool to CHECK if your soft reasoning is formally proven
If not proven, use verify_inference() to confirm, then suggest_rule() to formalize
When to use:
To verify if a fact exists in the graph
To check what the system KNOWS FOR CERTAIN (not what you deduce)
To explore relationships and connections
Query Guidelines:
ALWAYS scope queries to user namespace with ':' prefix (e.g., ':User', ':Alice')
Use LIMIT to avoid overwhelming results (max 1000 auto-injected)
Common predicates: foaf:knows, schema:worksFor, schema:colleague, rdf:type
Example workflow 1 (Simple check):
User: 'Is Alice my friend?'
You think: 'Hmm, I see :User foaf:knows :Alice, so maybe friends?'
You call: verify_inference(':User', 'foaf:friend', ':Alice')
Result: 'Not formally proven'
You tell user: 'You know Alice, but friendship is not formally established. Should I create a rule?'
Example workflow 2 (Proactive rule learning):
User asks: 'Can Gilles vote?'
You query: ASK { :Gilles :canVote ?x } → False
You think: 'Voting requires age ≥ 18. Do I know Gilles' age? No.'
You query: ASK { :Gilles :hasDrivingLicense ?x } → True
YOU IMMEDIATELY CALL: suggest_rule( rule_id='driving_license_implies_adult', description='Having a driving license implies being an adult (≥18)', sparql_pattern='CONSTRUCT { ?person :isAdult true } WHERE { ?person :hasDrivingLicense ?license }' )
After user approves, you can then infer :Gilles :isAdult true → can vote
Output format:
SELECT: Returns table of results as list of dicts
ASK: Returns boolean (True/False)
CONSTRUCT/DESCRIBE: Returns graph triples
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SPARQL query to execute. Common prefixes (rdf, rdfs, foaf, schema, owl, sem) are auto-added. | |
| output_format | No | Output format (default: table for SELECT, turtle for CONSTRUCT) |