@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 cli: <http://ggen.io/ontology/semantic-cli#> .
@prefix clap: <http://ggen.io/ontology/clap-noun-verb#> .

# Ontology definition
cli:SemanticCLIOntology a owl:Ontology ;
    rdfs:label "Semantic CLI Ontology" ;
    dc:description "RDF ontology for semantic-cli tool using clap-noun-verb pattern" ;
    dc:creator "ggen-team" ;
    owl:versionInfo "1.0.0" .

# ===== Noun Classes =====

cli:Ontology a clap:Noun, owl:Class ;
    rdfs:label "Ontology" ;
    rdfs:comment "RDF/OWL ontology operations" ;
    clap:hasVerb cli:parse, cli:validate, cli:info, cli:convert .

cli:Schema a clap:Noun, owl:Class ;
    rdfs:label "Schema" ;
    rdfs:comment "Ontology schema operations" ;
    clap:hasVerb cli:list, cli:show, cli:export .

cli:Query a clap:Noun, owl:Class ;
    rdfs:label "Query" ;
    rdfs:comment "SPARQL query operations" ;
    clap:hasVerb cli:sparql, cli:ask, cli:construct .

# ===== Verb Classes =====

# Ontology verbs
cli:parse a clap:Verb, owl:Class ;
    rdfs:label "parse" ;
    rdfs:comment "Parse RDF/OWL file and extract metadata" ;
    clap:belongsToNoun cli:Ontology ;
    clap:hasArgument cli:fileArg ;
    clap:returns cli:OntologyInfo .

cli:validate a clap:Verb, owl:Class ;
    rdfs:label "validate" ;
    rdfs:comment "Validate ontology syntax and semantics" ;
    clap:belongsToNoun cli:Ontology ;
    clap:hasArgument cli:fileArg, cli:strictFlag ;
    clap:returns cli:ValidationResult .

cli:info a clap:Verb, owl:Class ;
    rdfs:label "info" ;
    rdfs:comment "Show ontology metadata" ;
    clap:belongsToNoun cli:Ontology ;
    clap:hasArgument cli:fileArg ;
    clap:returns cli:OntologyMetadata .

cli:convert a clap:Verb, owl:Class ;
    rdfs:label "convert" ;
    rdfs:comment "Convert between RDF formats" ;
    clap:belongsToNoun cli:Ontology ;
    clap:hasArgument cli:inputFileArg, cli:outputFileArg, cli:formatArg ;
    clap:returns cli:ConversionResult .

# Schema verbs
cli:list a clap:Verb, owl:Class ;
    rdfs:label "list" ;
    rdfs:comment "List classes and properties" ;
    clap:belongsToNoun cli:Schema ;
    clap:hasArgument cli:fileArg, cli:typeFilter ;
    clap:returns cli:SchemaList .

cli:show a clap:Verb, owl:Class ;
    rdfs:label "show" ;
    rdfs:comment "Show class or property details" ;
    clap:belongsToNoun cli:Schema ;
    clap:hasArgument cli:fileArg, cli:nameArg ;
    clap:returns cli:SchemaDetails .

cli:export a clap:Verb, owl:Class ;
    rdfs:label "export" ;
    rdfs:comment "Export schema to various formats" ;
    clap:belongsToNoun cli:Schema ;
    clap:hasArgument cli:fileArg, cli:formatArg ;
    clap:returns cli:ExportResult .

# Query verbs
cli:sparql a clap:Verb, owl:Class ;
    rdfs:label "sparql" ;
    rdfs:comment "Execute SPARQL query" ;
    clap:belongsToNoun cli:Query ;
    clap:hasArgument cli:fileArg, cli:queryArg ;
    clap:returns cli:QueryResults .

cli:ask a clap:Verb, owl:Class ;
    rdfs:label "ask" ;
    rdfs:comment "Execute SPARQL ASK query" ;
    clap:belongsToNoun cli:Query ;
    clap:hasArgument cli:fileArg, cli:queryArg ;
    clap:returns cli:BooleanResult .

cli:construct a clap:Verb, owl:Class ;
    rdfs:label "construct" ;
    rdfs:comment "Execute SPARQL CONSTRUCT query" ;
    clap:belongsToNoun cli:Query ;
    clap:hasArgument cli:fileArg, cli:queryArg ;
    clap:returns cli:ConstructResult .

# ===== Argument Definitions =====

cli:fileArg a clap:Argument ;
    rdfs:label "file" ;
    clap:name "file" ;
    clap:type xsd:string ;
    clap:required true ;
    clap:help "Path to RDF/OWL ontology file" .

cli:inputFileArg a clap:Argument ;
    rdfs:label "input" ;
    clap:name "input" ;
    clap:type xsd:string ;
    clap:required true ;
    clap:help "Input ontology file" .

cli:outputFileArg a clap:Argument ;
    rdfs:label "output" ;
    clap:name "output" ;
    clap:type xsd:string ;
    clap:required true ;
    clap:help "Output file path" .

cli:formatArg a clap:Argument ;
    rdfs:label "format" ;
    clap:name "format" ;
    clap:short "f" ;
    clap:type xsd:string ;
    clap:default "turtle" ;
    clap:help "Output format (turtle, xml, json-ld, n-triples)" .

cli:strictFlag a clap:Argument ;
    rdfs:label "strict" ;
    clap:name "strict" ;
    clap:type xsd:boolean ;
    clap:default false ;
    clap:help "Enable strict validation mode" .

cli:typeFilter a clap:Argument ;
    rdfs:label "type" ;
    clap:name "type" ;
    clap:short "t" ;
    clap:type xsd:string ;
    clap:required false ;
    clap:help "Filter by type (class, property, all)" .

cli:nameArg a clap:Argument ;
    rdfs:label "name" ;
    clap:name "name" ;
    clap:type xsd:string ;
    clap:required true ;
    clap:help "Class or property name" .

cli:queryArg a clap:Argument ;
    rdfs:label "query" ;
    clap:name "query" ;
    clap:short "q" ;
    clap:type xsd:string ;
    clap:required true ;
    clap:help "SPARQL query string" .

# ===== Return Types =====

cli:OntologyInfo a owl:Class ;
    rdfs:label "OntologyInfo" ;
    clap:hasField cli:triplesField, cli:classesField, cli:propertiesField, cli:individualsField .

cli:ValidationResult a owl:Class ;
    rdfs:label "ValidationResult" ;
    clap:hasField cli:validField, cli:errorsField, cli:warningsField .

cli:OntologyMetadata a owl:Class ;
    rdfs:label "OntologyMetadata" ;
    clap:hasField cli:nameField, cli:versionField, cli:authorField, cli:descriptionField .

cli:ConversionResult a owl:Class ;
    rdfs:label "ConversionResult" ;
    clap:hasField cli:successField, cli:inputFormatField, cli:outputFormatField .

cli:SchemaList a owl:Class ;
    rdfs:label "SchemaList" ;
    clap:hasField cli:classesField, cli:propertiesField .

cli:SchemaDetails a owl:Class ;
    rdfs:label "SchemaDetails" ;
    clap:hasField cli:nameField, cli:typeField, cli:descriptionField, cli:attributesField .

cli:ExportResult a owl:Class ;
    rdfs:label "ExportResult" ;
    clap:hasField cli:successField, cli:formatField, cli:outputField .

cli:QueryResults a owl:Class ;
    rdfs:label "QueryResults" ;
    clap:hasField cli:bindingsField, cli:countField .

cli:BooleanResult a owl:Class ;
    rdfs:label "BooleanResult" ;
    clap:hasField cli:resultField .

cli:ConstructResult a owl:Class ;
    rdfs:label "ConstructResult" ;
    clap:hasField cli:triplesField, cli:graphField .

# ===== Field Definitions =====

cli:triplesField a clap:Field ; clap:name "triples" ; clap:type xsd:integer .
cli:classesField a clap:Field ; clap:name "classes" ; clap:type xsd:integer .
cli:propertiesField a clap:Field ; clap:name "properties" ; clap:type xsd:integer .
cli:individualsField a clap:Field ; clap:name "individuals" ; clap:type xsd:integer .
cli:validField a clap:Field ; clap:name "valid" ; clap:type xsd:boolean .
cli:errorsField a clap:Field ; clap:name "errors" ; clap:type "Vec<String>" .
cli:warningsField a clap:Field ; clap:name "warnings" ; clap:type "Vec<String>" .
cli:nameField a clap:Field ; clap:name "name" ; clap:type xsd:string .
cli:versionField a clap:Field ; clap:name "version" ; clap:type xsd:string .
cli:authorField a clap:Field ; clap:name "author" ; clap:type xsd:string .
cli:descriptionField a clap:Field ; clap:name "description" ; clap:type xsd:string .
cli:successField a clap:Field ; clap:name "success" ; clap:type xsd:boolean .
cli:inputFormatField a clap:Field ; clap:name "input_format" ; clap:type xsd:string .
cli:outputFormatField a clap:Field ; clap:name "output_format" ; clap:type xsd:string .
cli:typeField a clap:Field ; clap:name "type" ; clap:type xsd:string .
cli:attributesField a clap:Field ; clap:name "attributes" ; clap:type "Vec<Attribute>" .
cli:formatField a clap:Field ; clap:name "format" ; clap:type xsd:string .
cli:outputField a clap:Field ; clap:name "output" ; clap:type xsd:string .
cli:bindingsField a clap:Field ; clap:name "bindings" ; clap:type "Vec<Binding>" .
cli:countField a clap:Field ; clap:name "count" ; clap:type xsd:integer .
cli:resultField a clap:Field ; clap:name "result" ; clap:type xsd:boolean .
cli:graphField a clap:Field ; clap:name "graph" ; clap:type xsd:string .
