@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix git: <https://repolex.ai/ontology/git-lex/git/> .

# =============================================================================
# GIT-LEX GIT ONTOLOGY (git:)
# =============================================================================
# RDF classes and properties for git objects as surfaced by git commands, plus
# the sync-diff machinery git-lex uses to keep an append-only knowledge graph.
# A parser namespace nested under the git-lex application.
#
# Namespace: git: = https://repolex.ai/ontology/git-lex/git/
# =============================================================================

<https://repolex.ai/ontology/git-lex/git/> a owl:Ontology ;
    rdfs:label "git-lex Git Ontology" ;
    rdfs:comment "Classes and properties for git objects translated into RDF by git-lex, plus the sync-diff annotation vocabulary." ;
    owl:versionInfo "0.3.0" .

# =============================================================================
# Classes
# =============================================================================

git:Repo a owl:Class ;
    rdfs:label "Repo" ;
    rdfs:comment "The git repository itself — the top-level node git-lex types on every sync. Identified by its genesis SHA (the hash of the very first commit), which is stable across renames and remotes." .

git:Commit a owl:Class ;
    rdfs:label "Commit" ;
    rdfs:comment "A git commit object." .

git:Actor a owl:Class ;
    rdfs:label "Actor" ;
    rdfs:comment "A person (author or committer) identified by name and email." .

git:Blob a owl:Class ;
    rdfs:label "Blob" ;
    rdfs:comment "A file entry in the git tree." .

git:Reference a owl:Class ;
    rdfs:label "Reference" ;
    rdfs:comment "A named pointer to a commit (branch or tag)." .

git:Branch a owl:Class ;
    rdfs:subClassOf git:Reference ;
    rdfs:label "Branch" ;
    rdfs:comment "A git branch reference." .

git:Tag a owl:Class ;
    rdfs:subClassOf git:Reference ;
    rdfs:label "Tag" ;
    rdfs:comment "A git tag reference." .

git:Changeset a owl:Class ;
    rdfs:label "Changeset" ;
    rdfs:comment "A file change within a commit (added, modified, deleted, renamed)." .

git:File a owl:Class ;
    rdfs:label "File" ;
    rdfs:comment "A file in the repository, identified by its content (blob hash) and location (path). The same blob at different paths is different files. The same path with different content is different versions of the same file." .

git:Annotation a owl:Class ;
    rdfs:label "Annotation" ;
    rdfs:comment "A sync-diff annotation node. Each records the fate of one asserted fact across a sync (e.g. that it was retracted), pinned to the commit that produced the change. Instances live in the per-commit sync graph." .

# =============================================================================
# Repo Properties
# =============================================================================

git:genesisSha a owl:DatatypeProperty ;
    rdfs:domain git:Repo ;
    rdfs:range xsd:string ;
    rdfs:label "genesisSha" ;
    rdfs:comment "The SHA of the repository's first (genesis) commit — a stable identifier for the repo across renames and remotes. Emitted on the git:Repo node every sync." .

# =============================================================================
# Commit Properties
# =============================================================================

git:hexsha a owl:DatatypeProperty ;
    rdfs:domain git:Commit ;
    rdfs:range xsd:string ;
    rdfs:label "hexsha" ;
    rdfs:comment "Full 40-character hex SHA of the commit." .

git:message a owl:DatatypeProperty ;
    rdfs:domain git:Commit ;
    rdfs:range xsd:string ;
    rdfs:label "message" ;
    rdfs:comment "Commit message (subject line)." .

git:author a owl:ObjectProperty ;
    rdfs:domain git:Commit ;
    rdfs:range git:Actor ;
    rdfs:label "author" ;
    rdfs:comment "The person who wrote the change." .

git:committer a owl:ObjectProperty ;
    rdfs:domain git:Commit ;
    rdfs:range git:Actor ;
    rdfs:label "committer" ;
    rdfs:comment "The person who applied the change to the repository." .

git:authoredDate a owl:DatatypeProperty ;
    rdfs:domain git:Commit ;
    rdfs:range xsd:dateTime ;
    rdfs:label "authoredDate" ;
    rdfs:comment "Timestamp when the change was authored." .

git:committedDate a owl:DatatypeProperty ;
    rdfs:domain git:Commit ;
    rdfs:range xsd:dateTime ;
    rdfs:label "committedDate" ;
    rdfs:comment "Timestamp when the change was committed." .

git:parent a owl:ObjectProperty ;
    rdfs:domain git:Commit ;
    rdfs:range git:Commit ;
    rdfs:label "parent" ;
    rdfs:comment "Parent commit(s). Merge commits have multiple parents." .

git:changed a owl:ObjectProperty ;
    rdfs:domain git:Commit ;
    rdfs:range git:Changeset ;
    rdfs:label "changed" ;
    rdfs:comment "Links a commit to the files it changed." .

# =============================================================================
# Actor Properties
# =============================================================================

git:actorName a owl:DatatypeProperty ;
    rdfs:domain git:Actor ;
    rdfs:range xsd:string ;
    rdfs:label "actorName" ;
    rdfs:comment "Display name of the actor." .

git:email a owl:DatatypeProperty ;
    rdfs:domain git:Actor ;
    rdfs:range xsd:string ;
    rdfs:label "email" ;
    rdfs:comment "Email address of the actor." .

# =============================================================================
# Changeset Properties
# =============================================================================

git:changeType a owl:DatatypeProperty ;
    rdfs:domain git:Changeset ;
    rdfs:range xsd:string ;
    rdfs:label "changeType" ;
    rdfs:comment "Type of change: added, modified, deleted, or renamed." .

git:renamedTo a owl:DatatypeProperty ;
    rdfs:domain git:Changeset ;
    rdfs:range xsd:string ;
    rdfs:label "renamedTo" ;
    rdfs:comment "New file path after a rename operation." .

# =============================================================================
# Blob / File Properties
# =============================================================================

git:path a owl:DatatypeProperty ;
    rdfs:range xsd:string ;
    rdfs:label "path" ;
    rdfs:comment "File path relative to repo root. Used on File, Blob, and Changeset." .

git:blobHash a owl:DatatypeProperty ;
    rdfs:range xsd:string ;
    rdfs:label "blobHash" ;
    rdfs:comment "Content-addressed SHA hash of the file content. Used on File and Blob." .

git:blob a owl:ObjectProperty ;
    rdfs:domain git:Blob ;
    rdfs:label "blob" ;
    rdfs:comment "Links a filetree entry to its content-addressed blob URI." .

git:size a owl:DatatypeProperty ;
    rdfs:domain git:Blob ;
    rdfs:range xsd:integer ;
    rdfs:label "size" ;
    rdfs:comment "File size in bytes." .

git:type a owl:DatatypeProperty ;
    rdfs:domain git:Blob ;
    rdfs:range xsd:string ;
    rdfs:label "type" ;
    rdfs:comment "Git object type (blob, tree, etc.)." .

git:language a owl:DatatypeProperty ;
    rdfs:domain git:Blob ;
    rdfs:range xsd:string ;
    rdfs:label "language" ;
    rdfs:comment "Detected programming/markup language based on file extension." .

# =============================================================================
# Reference Properties
# =============================================================================

git:shortName a owl:DatatypeProperty ;
    rdfs:domain git:Reference ;
    rdfs:range xsd:string ;
    rdfs:label "shortName" ;
    rdfs:comment "Short name of the branch or tag." .

git:commit a owl:ObjectProperty ;
    rdfs:domain git:Reference ;
    rdfs:range git:Commit ;
    rdfs:label "commit" ;
    rdfs:comment "The commit this reference currently points to." .

# =============================================================================
# Blame Properties
# =============================================================================

git:blamedAuthor a owl:DatatypeProperty ;
    rdfs:domain git:Blob ;
    rdfs:range xsd:string ;
    rdfs:label "blamedAuthor" ;
    rdfs:comment "Author name from git blame (who has lines in this file)." .

git:blamedEmail a owl:DatatypeProperty ;
    rdfs:domain git:Blob ;
    rdfs:range xsd:string ;
    rdfs:label "blamedEmail" ;
    rdfs:comment "Author email from git blame." .

# =============================================================================
# Sync-Diff Annotation Properties
# =============================================================================
# The append-only sync engine never deletes a fact; it writes an Annotation
# recording the fact's fate. Used on git:Annotation nodes in the sync graph.
# (Previously emitted by code with NO ontology declaration — commitId and
# retracted were urn-style code-only ghosts; retracted was declared under lex:.
# Both now live here, with the git objects they describe.)

git:commitId a owl:DatatypeProperty ;
    rdfs:domain git:Annotation ;
    rdfs:range xsd:string ;
    rdfs:label "commitId" ;
    rdfs:comment "The commit SHA this annotation is pinned to — the sync in which the recorded change occurred." .

git:retracted a owl:DatatypeProperty ;
    rdfs:domain git:Annotation ;
    rdfs:range xsd:boolean ;
    rdfs:label "retracted" ;
    rdfs:comment "Marks the annotated fact as retracted — its source line or file was removed. The original triple is never deleted (append-only); this tombstone records that it is no longer asserted as of git:commitId." .
