@prefix uko: <https://cleveragents.ai/ontology/uko#> .
@prefix uko-code: <https://cleveragents.ai/ontology/uko/code#> .
@prefix uko-oo: <https://cleveragents.ai/ontology/uko/oo#> .
@prefix uko-py: <https://cleveragents.ai/ontology/uko/py#> .
@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#> .

<https://cleveragents.ai/ontology/uko/py#> a owl:Ontology ;
    rdfs:label "UKO Python Vocabulary" ;
    rdfs:comment "Layer 3 technology vocabulary for Python." .

# ===========================================================================
# UKO Layer 3: Python-specific vocabulary (uko-py:)
#
# Extends uko-oo: (Layer 2 OO paradigm) with Python-specific classes
# and properties.  DetailLevelMap insertions:
#   - DECORATED_SIGNATURES (between SIGNATURES_WITH_DOCS and
#     VISIBILITY_ANNOTATED)
#   - TYPE_STUBS (between KEY_LOGIC and NEAR_COMPLETE)
#   - WITH_TESTS (beyond FULL_SOURCE)
#
# Based on docs/specification.md ~lines 44405-44420, 25006-25026.
# ===========================================================================

# NOTE: Properties with multiple rdfs:domain values use OWL intersection
# semantics (AND). This is intentional — the domain tuple serves as an
# informational hint for tooling, not a formal OWL restriction.
# See PR #660 review finding #18.

# -- Classes --

uko-py:PythonModule a owl:Class ;
    rdfs:subClassOf uko-code:Module ;
    rdfs:label "PythonModule" ;
    rdfs:comment "A Python module (.py file) — extends uko-code:Module." .

uko-py:PythonClass a owl:Class ;
    rdfs:subClassOf uko-oo:Class ;
    rdfs:label "PythonClass" ;
    rdfs:comment "A Python class definition — extends uko-oo:Class." .

uko-py:PythonFunction a owl:Class ;
    rdfs:subClassOf uko-oo:Method ;
    rdfs:label "PythonFunction" ;
    rdfs:comment "A Python function or method — extends uko-oo:Method. Includes decorators and type annotations." .

uko-py:PythonDecorator a owl:Class ;
    rdfs:subClassOf uko-code:TypeDefinition ;
    rdfs:label "PythonDecorator" ;
    rdfs:comment "A decorator chain entry (@property, @staticmethod, @classmethod, custom decorators)." .

uko-py:PythonTypeStub a owl:Class ;
    rdfs:subClassOf uko-code:TypeDefinition ;
    rdfs:label "PythonTypeStub" ;
    rdfs:comment "Type annotations from .pyi stub files or inline typing module usage." .

# -- Properties --

uko-py:hasDecorator a owl:ObjectProperty ;
    rdfs:domain uko-py:PythonFunction , uko-py:PythonClass ;
    rdfs:range uko-py:PythonDecorator ;
    rdfs:label "hasDecorator" ;
    rdfs:comment "Links a function/class to its decorator chain entries." .

uko-py:hasTypeStub a owl:ObjectProperty ;
    rdfs:domain uko-py:PythonModule , uko-py:PythonClass , uko-py:PythonFunction ;
    rdfs:range uko-py:PythonTypeStub ;
    rdfs:label "hasTypeStub" ;
    rdfs:comment "Links a module/class/function to its .pyi type stub." .

uko-py:hasTest a owl:ObjectProperty ;
    rdfs:domain uko-py:PythonFunction , uko-py:PythonClass ;
    rdfs:range uko-py:PythonFunction ;
    rdfs:label "hasTest" ;
    rdfs:comment "Links a callable to its associated test cases (for WITH_TESTS depth level)." .

uko-py:decoratorName a owl:DatatypeProperty ;
    rdfs:domain uko-py:PythonDecorator ;
    rdfs:range xsd:string ;
    rdfs:label "decoratorName" ;
    rdfs:comment "The string name of a decorator (e.g. 'property', 'staticmethod')." .

uko-py:stubAnnotation a owl:DatatypeProperty ;
    rdfs:domain uko-py:PythonTypeStub ;
    rdfs:range xsd:string ;
    rdfs:label "stubAnnotation" ;
    rdfs:comment "Type annotation string from a .pyi stub file." .
