@prefix dms: <https://ggen.ai/ontology/document-management#> .
@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 dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

# Ontology Definition
dms: a owl:Ontology ;
    dcterms:title "Document Management System Ontology" ;
    dcterms:description "Ontology for enterprise document management with versioning, workflow, OCR, and compliance" ;
    dcterms:created "2025-01-08"^^xsd:date ;
    owl:versionInfo "1.0.0" .

# ============================================================================
# CORE CLASSES
# ============================================================================

# Document Classes
dms:Document a owl:Class ;
    rdfs:label "Document" ;
    rdfs:comment "Base class for all documents in the system" .

dms:TextDocument a owl:Class ;
    rdfs:subClassOf dms:Document ;
    rdfs:label "Text Document" ;
    rdfs:comment "Text-based documents (DOC, PDF, TXT)" .

dms:SpreadsheetDocument a owl:Class ;
    rdfs:subClassOf dms:Document ;
    rdfs:label "Spreadsheet Document" ;
    rdfs:comment "Spreadsheet documents (XLS, CSV)" .

dms:PresentationDocument a owl:Class ;
    rdfs:subClassOf dms:Document ;
    rdfs:label "Presentation Document" ;
    rdfs:comment "Presentation documents (PPT, KEY)" .

dms:ImageDocument a owl:Class ;
    rdfs:subClassOf dms:Document ;
    rdfs:label "Image Document" ;
    rdfs:comment "Image documents (PNG, JPG, TIFF)" .

dms:VideoDocument a owl:Class ;
    rdfs:subClassOf dms:Document ;
    rdfs:label "Video Document" ;
    rdfs:comment "Video documents (MP4, AVI, MOV)" .

dms:AudioDocument a owl:Class ;
    rdfs:subClassOf dms:Document ;
    rdfs:label "Audio Document" ;
    rdfs:comment "Audio documents (MP3, WAV, AAC)" .

# Version Management
dms:DocumentVersion a owl:Class ;
    rdfs:label "Document Version" ;
    rdfs:comment "A specific version of a document" .

dms:VersionHistory a owl:Class ;
    rdfs:label "Version History" ;
    rdfs:comment "Complete version history for a document" .

dms:ChangeLog a owl:Class ;
    rdfs:label "Change Log" ;
    rdfs:comment "Log of changes between versions" .

# Folder Structure
dms:Folder a owl:Class ;
    rdfs:label "Folder" ;
    rdfs:comment "Container for organizing documents" .

dms:RootFolder a owl:Class ;
    rdfs:subClassOf dms:Folder ;
    rdfs:label "Root Folder" ;
    rdfs:comment "Top-level folder in hierarchy" .

dms:SharedFolder a owl:Class ;
    rdfs:subClassOf dms:Folder ;
    rdfs:label "Shared Folder" ;
    rdfs:comment "Folder shared with multiple users" .

dms:PersonalFolder a owl:Class ;
    rdfs:subClassOf dms:Folder ;
    rdfs:label "Personal Folder" ;
    rdfs:comment "Private folder for individual user" .

# Workflow & Approval
dms:Workflow a owl:Class ;
    rdfs:label "Workflow" ;
    rdfs:comment "Document approval or review workflow" .

dms:WorkflowStep a owl:Class ;
    rdfs:label "Workflow Step" ;
    rdfs:comment "Individual step in a workflow" .

dms:ApprovalChain a owl:Class ;
    rdfs:label "Approval Chain" ;
    rdfs:comment "Chain of approvers for document review" .

dms:Approval a owl:Class ;
    rdfs:label "Approval" ;
    rdfs:comment "Approval action by a user" .

dms:Review a owl:Class ;
    rdfs:label "Review" ;
    rdfs:comment "Review action and comments" .

# Metadata & Tagging
dms:Metadata a owl:Class ;
    rdfs:label "Metadata" ;
    rdfs:comment "Document metadata and properties" .

dms:Tag a owl:Class ;
    rdfs:label "Tag" ;
    rdfs:comment "Keyword tag for classification" .

dms:Category a owl:Class ;
    rdfs:label "Category" ;
    rdfs:comment "Document category for organization" .

dms:CustomProperty a owl:Class ;
    rdfs:label "Custom Property" ;
    rdfs:comment "User-defined document property" .

# Search & OCR
dms:SearchIndex a owl:Class ;
    rdfs:label "Search Index" ;
    rdfs:comment "Full-text search index" .

dms:OCRResult a owl:Class ;
    rdfs:label "OCR Result" ;
    rdfs:comment "Optical Character Recognition results" .

dms:ExtractedText a owl:Class ;
    rdfs:label "Extracted Text" ;
    rdfs:comment "Text extracted from document" .

# Permissions & Security
dms:Permission a owl:Class ;
    rdfs:label "Permission" ;
    rdfs:comment "Access permission for document or folder" .

dms:AccessControlList a owl:Class ;
    rdfs:label "Access Control List" ;
    rdfs:comment "List of permissions for a resource" .

dms:SecurityLevel a owl:Class ;
    rdfs:label "Security Level" ;
    rdfs:comment "Document security classification" .

# Compliance & Retention
dms:RetentionPolicy a owl:Class ;
    rdfs:label "Retention Policy" ;
    rdfs:comment "Policy for document retention and deletion" .

dms:ComplianceRule a owl:Class ;
    rdfs:label "Compliance Rule" ;
    rdfs:comment "Regulatory compliance rule" .

dms:AuditLog a owl:Class ;
    rdfs:label "Audit Log" ;
    rdfs:comment "Log of document access and changes" .

dms:LegalHold a owl:Class ;
    rdfs:label "Legal Hold" ;
    rdfs:comment "Legal hold preventing document deletion" .

# ============================================================================
# PROPERTIES
# ============================================================================

# Document Properties
dms:hasTitle a owl:DatatypeProperty ;
    rdfs:domain dms:Document ;
    rdfs:range xsd:string ;
    rdfs:label "has title" .

dms:hasFileName a owl:DatatypeProperty ;
    rdfs:domain dms:Document ;
    rdfs:range xsd:string ;
    rdfs:label "has file name" .

dms:hasFileSize a owl:DatatypeProperty ;
    rdfs:domain dms:Document ;
    rdfs:range xsd:long ;
    rdfs:label "has file size" .

dms:hasMimeType a owl:DatatypeProperty ;
    rdfs:domain dms:Document ;
    rdfs:range xsd:string ;
    rdfs:label "has MIME type" .

dms:hasChecksum a owl:DatatypeProperty ;
    rdfs:domain dms:Document ;
    rdfs:range xsd:string ;
    rdfs:label "has checksum" .

dms:hasContent a owl:DatatypeProperty ;
    rdfs:domain dms:Document ;
    rdfs:range xsd:string ;
    rdfs:label "has content" .

dms:createdAt a owl:DatatypeProperty ;
    rdfs:domain dms:Document ;
    rdfs:range xsd:dateTime ;
    rdfs:label "created at" .

dms:modifiedAt a owl:DatatypeProperty ;
    rdfs:domain dms:Document ;
    rdfs:range xsd:dateTime ;
    rdfs:label "modified at" .

dms:createdBy a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range foaf:Person ;
    rdfs:label "created by" .

dms:modifiedBy a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range foaf:Person ;
    rdfs:label "modified by" .

# Version Properties
dms:hasVersion a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range dms:DocumentVersion ;
    rdfs:label "has version" .

dms:versionNumber a owl:DatatypeProperty ;
    rdfs:domain dms:DocumentVersion ;
    rdfs:range xsd:decimal ;
    rdfs:label "version number" .

dms:versionComment a owl:DatatypeProperty ;
    rdfs:domain dms:DocumentVersion ;
    rdfs:range xsd:string ;
    rdfs:label "version comment" .

dms:isCurrentVersion a owl:DatatypeProperty ;
    rdfs:domain dms:DocumentVersion ;
    rdfs:range xsd:boolean ;
    rdfs:label "is current version" .

dms:previousVersion a owl:ObjectProperty ;
    rdfs:domain dms:DocumentVersion ;
    rdfs:range dms:DocumentVersion ;
    rdfs:label "previous version" .

# Folder Properties
dms:containsDocument a owl:ObjectProperty ;
    rdfs:domain dms:Folder ;
    rdfs:range dms:Document ;
    rdfs:label "contains document" .

dms:containsFolder a owl:ObjectProperty ;
    rdfs:domain dms:Folder ;
    rdfs:range dms:Folder ;
    rdfs:label "contains folder" .

dms:parentFolder a owl:ObjectProperty ;
    rdfs:domain [owl:unionOf (dms:Document dms:Folder)] ;
    rdfs:range dms:Folder ;
    rdfs:label "parent folder" .

dms:folderPath a owl:DatatypeProperty ;
    rdfs:domain dms:Folder ;
    rdfs:range xsd:string ;
    rdfs:label "folder path" .

# Workflow Properties
dms:hasWorkflow a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range dms:Workflow ;
    rdfs:label "has workflow" .

dms:workflowStatus a owl:DatatypeProperty ;
    rdfs:domain dms:Workflow ;
    rdfs:range xsd:string ;
    rdfs:label "workflow status" .

dms:hasStep a owl:ObjectProperty ;
    rdfs:domain dms:Workflow ;
    rdfs:range dms:WorkflowStep ;
    rdfs:label "has step" .

dms:stepOrder a owl:DatatypeProperty ;
    rdfs:domain dms:WorkflowStep ;
    rdfs:range xsd:integer ;
    rdfs:label "step order" .

dms:assignedTo a owl:ObjectProperty ;
    rdfs:domain dms:WorkflowStep ;
    rdfs:range foaf:Person ;
    rdfs:label "assigned to" .

dms:approvedBy a owl:ObjectProperty ;
    rdfs:domain dms:Approval ;
    rdfs:range foaf:Person ;
    rdfs:label "approved by" .

dms:approvalDate a owl:DatatypeProperty ;
    rdfs:domain dms:Approval ;
    rdfs:range xsd:dateTime ;
    rdfs:label "approval date" .

# Metadata Properties
dms:hasMetadata a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range dms:Metadata ;
    rdfs:label "has metadata" .

dms:hasTag a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range dms:Tag ;
    rdfs:label "has tag" .

dms:hasCategory a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range dms:Category ;
    rdfs:label "has category" .

dms:tagName a owl:DatatypeProperty ;
    rdfs:domain dms:Tag ;
    rdfs:range xsd:string ;
    rdfs:label "tag name" .

# Search Properties
dms:hasSearchIndex a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range dms:SearchIndex ;
    rdfs:label "has search index" .

dms:hasOCRResult a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range dms:OCRResult ;
    rdfs:label "has OCR result" .

dms:extractedText a owl:DatatypeProperty ;
    rdfs:domain dms:OCRResult ;
    rdfs:range xsd:string ;
    rdfs:label "extracted text" .

dms:ocrConfidence a owl:DatatypeProperty ;
    rdfs:domain dms:OCRResult ;
    rdfs:range xsd:decimal ;
    rdfs:label "OCR confidence" .

# Permission Properties
dms:hasPermission a owl:ObjectProperty ;
    rdfs:domain [owl:unionOf (dms:Document dms:Folder)] ;
    rdfs:range dms:Permission ;
    rdfs:label "has permission" .

dms:canRead a owl:DatatypeProperty ;
    rdfs:domain dms:Permission ;
    rdfs:range xsd:boolean ;
    rdfs:label "can read" .

dms:canWrite a owl:DatatypeProperty ;
    rdfs:domain dms:Permission ;
    rdfs:range xsd:boolean ;
    rdfs:label "can write" .

dms:canDelete a owl:DatatypeProperty ;
    rdfs:domain dms:Permission ;
    rdfs:range xsd:boolean ;
    rdfs:label "can delete" .

dms:canShare a owl:DatatypeProperty ;
    rdfs:domain dms:Permission ;
    rdfs:range xsd:boolean ;
    rdfs:label "can share" .

# Retention & Compliance Properties
dms:hasRetentionPolicy a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range dms:RetentionPolicy ;
    rdfs:label "has retention policy" .

dms:retentionPeriod a owl:DatatypeProperty ;
    rdfs:domain dms:RetentionPolicy ;
    rdfs:range xsd:duration ;
    rdfs:label "retention period" .

dms:dispositionDate a owl:DatatypeProperty ;
    rdfs:domain dms:Document ;
    rdfs:range xsd:dateTime ;
    rdfs:label "disposition date" .

dms:hasLegalHold a owl:ObjectProperty ;
    rdfs:domain dms:Document ;
    rdfs:range dms:LegalHold ;
    rdfs:label "has legal hold" .

dms:auditAction a owl:DatatypeProperty ;
    rdfs:domain dms:AuditLog ;
    rdfs:range xsd:string ;
    rdfs:label "audit action" .

dms:auditTimestamp a owl:DatatypeProperty ;
    rdfs:domain dms:AuditLog ;
    rdfs:range xsd:dateTime ;
    rdfs:label "audit timestamp" .
