## Turtle — Open Knowledge Format (OKF) Ontology (TBox)
## Canonical IRI: https://linkeddata.uriburner.com/DAV/demos/daas/okf-open-knowledge-format-ontology.ttl
## Generated: 2026-06-15 | Model: Claude Sonnet 4.6 | Env: Claude Code
## Upload target: https://linkeddata.uriburner.com/DAV/demos/daas/okf-open-knowledge-format-ontology.ttl

@prefix okf:    <https://linkeddata.uriburner.com/DAV/demos/daas/okf-open-knowledge-format-ontology.ttl#okf-> .
@prefix owl:    <http://www.w3.org/2002/07/owl#> .
@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix xsd:    <http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix skos:   <http://www.w3.org/2004/02/skos/core#> .

# ── Self-describing document entity ──────────────────────────────────────────

<> a owl:Ontology, schema:CreativeWork ;
    schema:name "Open Knowledge Format (OKF) Ontology"@en ;
    schema:description "TBox vocabulary for the Open Knowledge Format (OKF) v0.1 — defines all classes and properties used in OKF instance data. Covers document types, bundle structure, schema constructs, and row-level data record terms."@en ;
    schema:dateCreated "2026-06-15T00:00:00Z"^^xsd:dateTime ;
    schema:dateModified "2026-06-15T00:00:00Z"^^xsd:dateTime ;
    schema:about okf:KnowledgeBundle ;
    dcterms:license <https://opensource.org/licenses/Apache-2.0> ;
    owl:versionInfo "0.1"^^xsd:string .

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 1: Document Type Classes
# ══════════════════════════════════════════════════════════════════════════════

okf:KnowledgeBundle a owl:Class ;
    rdfs:label "Knowledge Bundle"@en ;
    rdfs:comment "A collection of typed OKF knowledge documents grouped under an index manifest. The top-level container for portable, interoperable knowledge."@en ;
    rdfs:isDefinedBy <> .

okf:IndexDocument a owl:Class ;
    rdfs:label "Index Document"@en ;
    rdfs:comment "An OKF document with type 'index' that serves as a manifest listing all knowledge documents within a bundle or sub-domain."@en ;
    rdfs:isDefinedBy <> .

okf:ConceptDocument a owl:Class ;
    rdfs:label "Concept Document"@en ;
    rdfs:comment "An OKF document with type 'concept' that provides narrative definitions, context, and explanations for domain concepts."@en ;
    rdfs:isDefinedBy <> .

okf:DatasetDocument a owl:Class ;
    rdfs:label "Dataset Document"@en ;
    rdfs:comment "An OKF document with type 'dataset' that describes a data source, its tables, and inter-table relationships."@en ;
    rdfs:isDefinedBy <> .

okf:TableDocument a owl:Class ;
    rdfs:label "Table Document"@en ;
    rdfs:comment "An OKF document with type 'table' that describes a relational table — its columns, primary key, foreign key relationships, and sample queries."@en ;
    rdfs:isDefinedBy <> .

okf:MetricDocument a owl:Class ;
    rdfs:label "Metric Document"@en ;
    rdfs:comment "An OKF document with type 'metric' that defines a business metric — its formula, aggregation logic, and source tables."@en ;
    rdfs:isDefinedBy <> .

okf:RunbookDocument a owl:Class ;
    rdfs:label "Runbook Document"@en ;
    rdfs:comment "An OKF document with type 'runbook' that contains operational step-by-step procedures."@en ;
    rdfs:isDefinedBy <> .

okf:ColumnDefinition a owl:Class ;
    rdfs:label "Column Definition"@en ;
    rdfs:comment "A typed column within an OKF TableDocument, with a name, data type, and optional description."@en ;
    rdfs:isDefinedBy <> .

okf:EnrichmentAgent a owl:Class ;
    rdfs:label "Enrichment Agent"@en ;
    rdfs:comment "An AI agent or automated pipeline that reads OKF knowledge bundles and produces derived artefacts — summaries, embeddings, semantic metadata, resolved FK relationships, or RDF triples."@en ;
    rdfs:isDefinedBy <> .

okf:Visualizer a owl:Class ;
    rdfs:label "Visualizer"@en ;
    rdfs:comment "A tool that converts OKF bundles into visual representations — e.g., interactive graph views or static HTML reports."@en ;
    rdfs:isDefinedBy <> .

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 2: Row-Level Data Record Classes
# ══════════════════════════════════════════════════════════════════════════════

okf:DataRecord a owl:Class ;
    rdfs:label "Data Record"@en ;
    rdfs:comment "Superclass for row-level instance data records in OKF table documents."@en ;
    rdfs:isDefinedBy <> .

okf:OrderRecord a owl:Class ;
    rdfs:subClassOf okf:DataRecord ;
    rdfs:label "Order Record"@en ;
    rdfs:comment "A single row in an OKF orders table document."@en ;
    rdfs:isDefinedBy <> .

okf:CustomerRecord a owl:Class ;
    rdfs:subClassOf okf:DataRecord ;
    rdfs:label "Customer Record"@en ;
    rdfs:comment "A single row in an OKF customers table document."@en ;
    rdfs:isDefinedBy <> .

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 3: Bundle & Document Structural Properties
# ══════════════════════════════════════════════════════════════════════════════

okf:documentType a owl:DatatypeProperty ;
    rdfs:label "document type"@en ;
    rdfs:comment "The producer-defined type string declared in the YAML frontmatter of an OKF document. The only mandatory field in the OKF specification. Examples: 'Index', 'BigQuery Dataset', 'BigQuery Table', 'Metric', 'Concept', 'Runbook'."@en ;
    rdfs:domain okf:IndexDocument ;
    rdfs:range xsd:string ;
    schema:domainIncludes okf:IndexDocument, okf:DatasetDocument, okf:TableDocument,
                          okf:MetricDocument, okf:ConceptDocument, okf:RunbookDocument ;
    rdfs:isDefinedBy <> .

okf:bundleVersion a owl:DatatypeProperty ;
    rdfs:label "bundle version"@en ;
    rdfs:comment "The version string of an OKF KnowledgeBundle, corresponding to the OKF specification version used."@en ;
    rdfs:domain okf:KnowledgeBundle ;
    rdfs:range xsd:string ;
    rdfs:isDefinedBy <> .

okf:isVendorNeutral a owl:DatatypeProperty ;
    rdfs:label "is vendor neutral"@en ;
    rdfs:comment "Asserts that an OKF KnowledgeBundle or specification artifact requires no proprietary vendor accounts, SDKs, or platform lock-in."@en ;
    rdfs:range xsd:boolean ;
    rdfs:isDefinedBy <> .

okf:requiresSDK a owl:DatatypeProperty ;
    rdfs:label "requires SDK"@en ;
    rdfs:comment "Asserts whether an OKF artifact requires a software development kit to produce or consume. OKF is designed to require no SDK."@en ;
    rdfs:range xsd:boolean ;
    rdfs:isDefinedBy <> .

okf:resourceURL a owl:DatatypeProperty ;
    rdfs:label "resource URL"@en ;
    rdfs:comment "The URL of the underlying data resource described by an OKF document — e.g., a BigQuery dataset or table console URL."@en ;
    rdfs:range xsd:anyURI ;
    rdfs:isDefinedBy <> .

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 4: Bundle Membership & Document Linkage Properties
# ══════════════════════════════════════════════════════════════════════════════

okf:hasIndex a owl:ObjectProperty ;
    rdfs:label "has index"@en ;
    rdfs:comment "Links a KnowledgeBundle to its root IndexDocument manifest."@en ;
    rdfs:domain okf:KnowledgeBundle ;
    rdfs:range okf:IndexDocument ;
    rdfs:isDefinedBy <> .

okf:hasDocument a owl:ObjectProperty ;
    rdfs:label "has document"@en ;
    rdfs:comment "Links a KnowledgeBundle or DatasetDocument to the OKF documents it contains."@en ;
    schema:domainIncludes okf:KnowledgeBundle, okf:DatasetDocument ;
    rdfs:isDefinedBy <> .

okf:isDocumentOf a owl:ObjectProperty ;
    rdfs:label "is document of"@en ;
    rdfs:comment "Inverse of okf:hasDocument. Links an OKF document to the KnowledgeBundle it belongs to."@en ;
    owl:inverseOf okf:hasDocument ;
    rdfs:range okf:KnowledgeBundle ;
    rdfs:isDefinedBy <> .

okf:definesMetric a owl:ObjectProperty ;
    rdfs:label "defines metric"@en ;
    rdfs:comment "Links a MetricDocument to the TableDocument that serves as its primary data source."@en ;
    rdfs:domain okf:MetricDocument ;
    rdfs:range okf:TableDocument ;
    rdfs:isDefinedBy <> .

okf:producedBy a owl:ObjectProperty ;
    rdfs:label "produced by"@en ;
    rdfs:comment "Links an OKF artifact (bundle, tool, implementation) to the organization or agent that created it."@en ;
    rdfs:range schema:Organization ;
    rdfs:isDefinedBy <> .

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 5: Table Schema Properties
# ══════════════════════════════════════════════════════════════════════════════

okf:hasColumn a owl:ObjectProperty ;
    rdfs:label "has column"@en ;
    rdfs:comment "Links a TableDocument to one of its ColumnDefinitions."@en ;
    rdfs:domain okf:TableDocument ;
    rdfs:range okf:ColumnDefinition ;
    rdfs:isDefinedBy <> .

okf:columnName a owl:DatatypeProperty ;
    rdfs:label "column name"@en ;
    rdfs:comment "The SQL column name as it appears in the underlying table schema."@en ;
    rdfs:domain okf:ColumnDefinition ;
    rdfs:range xsd:string ;
    rdfs:isDefinedBy <> .

okf:columnDataType a owl:DatatypeProperty ;
    rdfs:label "column data type"@en ;
    rdfs:comment "The SQL or warehouse-native data type of the column (e.g., STRING, TIMESTAMP, FLOAT64, DATE, INTEGER)."@en ;
    rdfs:domain okf:ColumnDefinition ;
    rdfs:range xsd:string ;
    rdfs:isDefinedBy <> .

okf:isForeignKeyTo a owl:ObjectProperty ;
    rdfs:label "is foreign key to"@en ;
    rdfs:comment "Asserts that a ColumnDefinition is a foreign key referencing the primary key of a target TableDocument."@en ;
    rdfs:domain okf:ColumnDefinition ;
    rdfs:range okf:TableDocument ;
    rdfs:isDefinedBy <> .

okf:joinsWith a owl:ObjectProperty ;
    rdfs:label "joins with"@en ;
    rdfs:comment "Asserts that two TableDocuments can be joined on a shared key column."@en ;
    rdfs:domain okf:TableDocument ;
    rdfs:range okf:TableDocument ;
    owl:propertyType owl:SymmetricProperty ;
    rdfs:isDefinedBy <> .

okf:joinKey a owl:DatatypeProperty ;
    rdfs:label "join key"@en ;
    rdfs:comment "The column name used as the join key between two tables related by okf:joinsWith."@en ;
    rdfs:domain okf:TableDocument ;
    rdfs:range xsd:string ;
    rdfs:isDefinedBy <> .

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 6: Row-Level Data Record Properties
# ══════════════════════════════════════════════════════════════════════════════

okf:isRowOf a owl:ObjectProperty ;
    rdfs:label "is row of"@en ;
    rdfs:comment "Links a row-level DataRecord instance to its parent TableDocument."@en ;
    rdfs:domain okf:DataRecord ;
    rdfs:isDefinedBy <> .

okf:orderId a owl:DatatypeProperty ;
    rdfs:label "order ID"@en ;
    rdfs:comment "Globally unique order identifier. Primary key of the orders table."@en ;
    rdfs:domain okf:OrderRecord ;
    rdfs:range xsd:string ;
    rdfs:isDefinedBy <> .

okf:customerId a owl:DatatypeProperty ;
    rdfs:label "customer ID"@en ;
    rdfs:comment "Unique customer identifier. Foreign key in the orders table; primary key in the customers table."@en ;
    rdfs:range xsd:string ;
    rdfs:isDefinedBy <> .

okf:orderDate a owl:DatatypeProperty ;
    rdfs:label "order date"@en ;
    rdfs:comment "UTC date when the order was placed."@en ;
    rdfs:domain okf:OrderRecord ;
    rdfs:range xsd:date ;
    rdfs:isDefinedBy <> .

okf:revenueUSD a owl:DatatypeProperty ;
    rdfs:label "revenue (USD)"@en ;
    rdfs:comment "Total order revenue in US dollars, inclusive of tax."@en ;
    rdfs:domain okf:OrderRecord ;
    rdfs:range xsd:decimal ;
    rdfs:isDefinedBy <> .

okf:customerName a owl:DatatypeProperty ;
    rdfs:label "customer name"@en ;
    rdfs:comment "Full display name of the customer."@en ;
    rdfs:domain okf:CustomerRecord ;
    rdfs:range xsd:string ;
    rdfs:isDefinedBy <> .

okf:email a owl:DatatypeProperty ;
    rdfs:label "email"@en ;
    rdfs:comment "Customer's primary contact email address."@en ;
    rdfs:domain okf:CustomerRecord ;
    rdfs:range xsd:string ;
    rdfs:isDefinedBy <> .

okf:signupDate a owl:DatatypeProperty ;
    rdfs:label "signup date"@en ;
    rdfs:comment "Calendar date on which the customer registered."@en ;
    rdfs:domain okf:CustomerRecord ;
    rdfs:range xsd:date ;
    rdfs:isDefinedBy <> .
