@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix mem: <http://ggen.io/ontology/memory#> .

# Ontology definition
mem:MemoryOntology a owl:Ontology ;
    rdfs:label "Memory Forge Ontology" ;
    dc:description "RDF ontology for AI agent memory systems" ;
    dc:creator "ggen-team" ;
    owl:versionInfo "1.0.0" .

# Core Classes
mem:MemorySystem a owl:Class ; rdfs:label "Memory System" ; rdfs:comment "Complete memory system" .
mem:Memory a owl:Class ; rdfs:label "Memory" ; rdfs:comment "Individual memory item" .
mem:EpisodicMemory a owl:Class ; rdfs:label "Episodic Memory" ; rdfs:comment "Event history memory" ; rdfs:subClassOf mem:Memory .
mem:SemanticMemory a owl:Class ; rdfs:label "Semantic Memory" ; rdfs:comment "Knowledge graph memory" ; rdfs:subClassOf mem:Memory .
mem:ProceduralMemory a owl:Class ; rdfs:label "Procedural Memory" ; rdfs:comment "Learned workflows" ; rdfs:subClassOf mem:Memory .
mem:WorkingMemory a owl:Class ; rdfs:label "Working Memory" ; rdfs:comment "Short-term active memory" ; rdfs:subClassOf mem:Memory .
mem:LongTermMemory a owl:Class ; rdfs:label "Long-term Memory" ; rdfs:comment "Consolidated permanent memory" ; rdfs:subClassOf mem:Memory .

# Memory Components
mem:MemoryIndex a owl:Class ; rdfs:label "Memory Index" ; rdfs:comment "Memory indexing structure" .
mem:MemoryRetrieval a owl:Class ; rdfs:label "Memory Retrieval" ; rdfs:comment "Memory retrieval mechanism" .
mem:MemoryConsolidation a owl:Class ; rdfs:label "Memory Consolidation" ; rdfs:comment "Long-term memory consolidation" .
mem:MemoryDecay a owl:Class ; rdfs:label "Memory Decay" ; rdfs:comment "Memory decay function" .
mem:ImportanceScore a owl:Class ; rdfs:label "Importance Score" ; rdfs:comment "Memory importance scoring" .

# Event Types (Episodic)
mem:Event a owl:Class ; rdfs:label "Event" ; rdfs:comment "Episodic event" .
mem:UserAction a mem:Event ; rdfs:label "User Action" ; mem:description "User-initiated action" .
mem:SystemEvent a mem:Event ; rdfs:label "System Event" ; mem:description "System-generated event" .
mem:ErrorEvent a mem:Event ; rdfs:label "Error Event" ; mem:description "Error or exception event" .
mem:SuccessEvent a mem:Event ; rdfs:label "Success Event" ; mem:description "Successful completion event" .

# Knowledge Types (Semantic)
mem:Concept a owl:Class ; rdfs:label "Concept" ; rdfs:comment "Knowledge concept" .
mem:Fact a owl:Class ; rdfs:label "Fact" ; rdfs:comment "Factual knowledge" .
mem:Relationship a owl:Class ; rdfs:label "Relationship" ; rdfs:comment "Semantic relationship" .
mem:Entity a owl:Class ; rdfs:label "Entity" ; rdfs:comment "Knowledge entity" .
mem:Attribute a owl:Class ; rdfs:label "Attribute" ; rdfs:comment "Entity attribute" .

# Workflow Types (Procedural)
mem:Procedure a owl:Class ; rdfs:label "Procedure" ; rdfs:comment "Learned procedure" .
mem:Pattern a owl:Class ; rdfs:label "Pattern" ; rdfs:comment "Behavioral pattern" .
mem:Strategy a owl:Class ; rdfs:label "Strategy" ; rdfs:comment "Problem-solving strategy" .
mem:Heuristic a owl:Class ; rdfs:label "Heuristic" ; rdfs:comment "Decision heuristic" .

# Properties
mem:hasMemory a owl:ObjectProperty ; rdfs:domain mem:MemorySystem ; rdfs:range mem:Memory .
mem:hasEvent a owl:ObjectProperty ; rdfs:domain mem:EpisodicMemory ; rdfs:range mem:Event .
mem:hasConcept a owl:ObjectProperty ; rdfs:domain mem:SemanticMemory ; rdfs:range mem:Concept .
mem:hasProcedure a owl:ObjectProperty ; rdfs:domain mem:ProceduralMemory ; rdfs:range mem:Procedure .
mem:relatesTo a owl:ObjectProperty ; rdfs:domain mem:Memory ; rdfs:range mem:Memory .
mem:strengthenedBy a owl:ObjectProperty ; rdfs:domain mem:Memory ; rdfs:range mem:Memory .

# Data Properties
mem:memoryId a owl:DatatypeProperty ; rdfs:domain mem:Memory ; rdfs:range xsd:string .
mem:createdAt a owl:DatatypeProperty ; rdfs:domain mem:Memory ; rdfs:range xsd:dateTime .
mem:lastAccessedAt a owl:DatatypeProperty ; rdfs:domain mem:Memory ; rdfs:range xsd:dateTime .
mem:accessCount a owl:DatatypeProperty ; rdfs:domain mem:Memory ; rdfs:range xsd:integer .
mem:importance a owl:DatatypeProperty ; rdfs:domain mem:Memory ; rdfs:range xsd:float .
mem:confidence a owl:DatatypeProperty ; rdfs:domain mem:Memory ; rdfs:range xsd:float .
mem:decayRate a owl:DatatypeProperty ; rdfs:domain mem:Memory ; rdfs:range xsd:float .
mem:strength a owl:DatatypeProperty ; rdfs:domain mem:Memory ; rdfs:range xsd:float .
mem:content a owl:DatatypeProperty ; rdfs:domain mem:Memory ; rdfs:range xsd:string .
mem:temporal a owl:DatatypeProperty ; rdfs:domain mem:Event ; rdfs:range xsd:dateTime .
mem:spatial a owl:DatatypeProperty ; rdfs:domain mem:Event ; rdfs:range xsd:string .
mem:contextual a owl:DatatypeProperty ; rdfs:domain mem:Event ; rdfs:range xsd:string .

# Storage Engines
mem:RDFTripleStore a owl:Class ; rdfs:label "RDF Triple Store" ; mem:description "RDF/SPARQL storage" .
mem:VectorDatabase a owl:Class ; rdfs:label "Vector Database" ; mem:description "Embedding-based storage" .
mem:RelationalDB a owl:Class ; rdfs:label "Relational Database" ; mem:description "SQL-based storage" .

# Operations
mem:Store a owl:Class ; rdfs:label "Store" ; mem:description "Store memory" .
mem:Retrieve a owl:Class ; rdfs:label "Retrieve" ; mem:description "Retrieve memory by query" .
mem:Update a owl:Class ; rdfs:label "Update" ; mem:description "Update existing memory" .
mem:Delete a owl:Class ; rdfs:label "Delete" ; mem:description "Delete memory" .
mem:Consolidate a owl:Class ; rdfs:label "Consolidate" ; mem:description "Consolidate to long-term" .
mem:Prune a owl:Class ; rdfs:label "Prune" ; mem:description "Prune low-importance memories" .
mem:Refresh a owl:Class ; rdfs:label "Refresh" ; mem:description "Refresh memory strength" .
mem:Search a owl:Class ; rdfs:label "Search" ; mem:description "Similarity-based search" .
