Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
A comprehensive collection of Agent Skills for context engineering, multi-agent architectures, and production agent systems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
skills/bdi-mental-states/references/sparql-competency.md
1# SPARQL Competency Queries23Validation queries for BDI ontology implementations based on competency questions.45## Mental Entity Queries67### CQ1: What are all mental entities?89```sparql10PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>11PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>12PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>1314SELECT DISTINCT ?entity ?type WHERE {15?entity rdf:type ?type .16?type rdfs:subClassOf* bdi:MentalEntity .17}18```1920### CQ2: What beliefs does an agent hold?2122```sparql23PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>2425SELECT ?belief ?label WHERE {26?agent bdi:hasMentalState ?belief .27?belief a bdi:Belief .28OPTIONAL { ?belief rdfs:label ?label }29}30```3132### CQ3: What desires does an agent have?3334```sparql35PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>3637SELECT ?desire ?label WHERE {38?agent bdi:hasDesire ?desire .39?desire a bdi:Desire .40OPTIONAL { ?desire rdfs:label ?label }41}42```4344### CQ4: What intentions has an agent committed to?4546```sparql47PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>4849SELECT ?intention ?label WHERE {50?agent bdi:hasIntention ?intention .51?intention a bdi:Intention .52OPTIONAL { ?intention rdfs:label ?label }53}54```5556## Motivational Chain Queries5758### CQ5: What beliefs motivated formation of a given desire?5960```sparql61PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>6263SELECT ?belief ?beliefLabel WHERE {64?desire bdi:isMotivatedBy ?belief .65?belief a bdi:Belief .66OPTIONAL { ?belief rdfs:label ?beliefLabel }67}68```6970### CQ6: Which desire does a particular intention fulfill?7172```sparql73PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>7475SELECT ?desire ?desireLabel WHERE {76?intention bdi:fulfils ?desire .77?desire a bdi:Desire .78OPTIONAL { ?desire rdfs:label ?desireLabel }79}80```8182### CQ7: What beliefs support a given intention?8384```sparql85PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>8687SELECT ?belief ?label WHERE {88?intention bdi:isSupportedBy ?belief .89?belief a bdi:Belief .90OPTIONAL { ?belief rdfs:label ?label }91}92```9394### CQ8: Trace complete cognitive chain for an intention9596```sparql97PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>9899SELECT ?intention ?desire ?belief ?worldState WHERE {100?intention a bdi:Intention ;101bdi:fulfils ?desire ;102bdi:isSupportedBy ?belief .103?desire bdi:isMotivatedBy ?belief .104?belief bdi:refersTo ?worldState .105}106```107108## Mental Process Queries109110### CQ9: Which mental process generated a belief?111112```sparql113PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>114115SELECT ?process ?processType WHERE {116?process bdi:generates ?belief .117?belief a bdi:Belief .118?process a ?processType .119FILTER(?processType != owl:NamedIndividual)120}121```122123### CQ10: What triggered a mental process?124125```sparql126PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>127128SELECT ?process ?trigger ?triggerType WHERE {129?process a bdi:MentalProcess ;130bdi:isTriggeredBy ?trigger .131?trigger a ?triggerType .132}133```134135### CQ11: What did a mental process reason upon?136137```sparql138PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>139140SELECT ?process ?input WHERE {141?process a bdi:MentalProcess ;142bdi:reasonsUpon ?input .143}144```145146## Plan and Goal Queries147148### CQ12: What plan does an intention specify?149150```sparql151PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>152153SELECT ?intention ?plan ?goal WHERE {154?intention bdi:specifies ?plan .155?plan a bdi:Plan ;156bdi:addresses ?goal .157}158```159160### CQ13: What is the ordered sequence of tasks in a plan?161162```sparql163PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>164165SELECT ?plan ?task ?nextTask WHERE {166?plan a bdi:Plan ;167bdi:hasComponent ?task .168OPTIONAL { ?task bdi:precedes ?nextTask }169}170ORDER BY ?task171```172173### CQ14: What is the first and last task of a plan?174175```sparql176PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>177178SELECT ?plan ?firstTask ?lastTask WHERE {179?plan a bdi:Plan ;180bdi:beginsWith ?firstTask ;181bdi:endsWith ?lastTask .182}183```184185### CQ15: Which actions executed which tasks?186187```sparql188PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>189190SELECT ?action ?task ?time WHERE {191?action bdi:isExecutionOf ?task ;192bdi:atTime ?time .193}194ORDER BY ?time195```196197## Temporal Queries198199### CQ16: What mental states are valid at a specific time?200201```sparql202PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>203PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>204205SELECT ?mentalState ?type WHERE {206?mentalState bdi:hasValidity ?interval .207?interval bdi:hasStartTime ?start ;208bdi:hasEndTime ?end .209?mentalState a ?type .210FILTER(?start <= "2026-01-04T10:00:00"^^xsd:dateTime &&211?end >= "2026-01-04T10:00:00"^^xsd:dateTime)212}213```214215### CQ17: When was a belief formed?216217```sparql218PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>219220SELECT ?belief ?formationTime WHERE {221?process bdi:generates ?belief ;222bdi:atTime ?formationTime .223?belief a bdi:Belief .224}225```226227### CQ18: What is the temporal validity of an intention?228229```sparql230PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>231232SELECT ?intention ?start ?end WHERE {233?intention a bdi:Intention ;234bdi:hasValidity ?interval .235?interval bdi:hasStartTime ?start ;236bdi:hasEndTime ?end .237}238```239240## Justification Queries241242### CQ19: What justifies a belief?243244```sparql245PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>246247SELECT ?belief ?justification ?justLabel WHERE {248?belief a bdi:Belief ;249bdi:isJustifiedBy ?justification .250OPTIONAL { ?justification rdfs:label ?justLabel }251}252```253254### CQ20: What justifies an intention?255256```sparql257PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>258259SELECT ?intention ?justification ?justLabel WHERE {260?intention a bdi:Intention ;261bdi:isJustifiedBy ?justification .262OPTIONAL { ?justification rdfs:label ?justLabel }263}264```265266## Compositional Queries267268### CQ21: What parts comprise a complex belief?269270```sparql271PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>272273SELECT ?belief ?part ?partLabel WHERE {274?belief a bdi:Belief ;275bdi:hasPart ?part .276OPTIONAL { ?part rdfs:label ?partLabel }277}278```279280### CQ22: Find composite mental entities281282```sparql283PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>284285SELECT ?composite (COUNT(?part) AS ?partCount) WHERE {286?composite bdi:hasPart ?part .287}288GROUP BY ?composite289HAVING (COUNT(?part) > 1)290```291292## World State Queries293294### CQ23: What world state does a belief refer to?295296```sparql297PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>298299SELECT ?belief ?worldState ?wsComment WHERE {300?belief a bdi:Belief ;301bdi:refersTo ?worldState .302OPTIONAL { ?worldState rdfs:comment ?wsComment }303}304```305306### CQ24: What actions brought about a world state?307308```sparql309PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>310311SELECT ?action ?worldState WHERE {312?action bdi:bringsAbout ?worldState .313?worldState a bdi:WorldState .314}315```316317### CQ25: What world states has an agent perceived?318319```sparql320PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>321322SELECT ?agent ?worldState ?time WHERE {323?agent bdi:perceives ?worldState .324OPTIONAL { ?worldState bdi:atTime ?time }325}326```327328## Validation Queries (OWLUnit Style)329330### V1: Every intention must fulfill exactly one desire331332```sparql333PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>334335SELECT ?intention WHERE {336?intention a bdi:Intention .337FILTER NOT EXISTS { ?intention bdi:fulfils ?desire }338}339# Expected: Empty result set340```341342### V2: Every belief must reference a world state343344```sparql345PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>346347SELECT ?belief WHERE {348?belief a bdi:Belief .349FILTER NOT EXISTS { ?belief bdi:refersTo ?worldState }350}351# Expected: Empty result set (or only abstract beliefs)352```353354### V3: Mental processes must reason upon something355356```sparql357PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>358359SELECT ?process WHERE {360?process a bdi:MentalProcess .361FILTER NOT EXISTS { ?process bdi:reasonsUpon ?input }362}363# Expected: Empty result set364```365366### V4: BeliefProcess must generate only Beliefs367368```sparql369PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>370371SELECT ?process ?generated WHERE {372?process a bdi:BeliefProcess ;373bdi:generates ?generated .374FILTER NOT EXISTS { ?generated a bdi:Belief }375}376# Expected: Empty result set377```378379### V5: Plans must have begin and end tasks380381```sparql382PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>383384SELECT ?plan WHERE {385?plan a bdi:Plan .386FILTER NOT EXISTS {387?plan bdi:beginsWith ?first ;388bdi:endsWith ?last389}390}391# Expected: Empty result set392```393394## Multi-Agent Queries395396### CQ26: What beliefs are shared across agents?397398```sparql399PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>400401SELECT ?belief (COUNT(DISTINCT ?agent) AS ?agentCount) WHERE {402?agent bdi:hasMentalState ?belief .403?belief a bdi:Belief .404}405GROUP BY ?belief406HAVING (COUNT(DISTINCT ?agent) > 1)407```408409### CQ27: Which agents share the same desire?410411```sparql412PREFIX bdi: <https://w3id.org/fossr/ontology/bdi/>413414SELECT ?desire ?agent1 ?agent2 WHERE {415?agent1 bdi:hasDesire ?desire .416?agent2 bdi:hasDesire ?desire .417FILTER(?agent1 != ?agent2)418}419```420421