@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 m: <https://magnowlia.com/ontology/mapping#> .

<https://magnowlia.com/ontology/mapping> a owl:Ontology ;
    rdfs:label "Magnowlia Mapping Vocabulary" ;
    rdfs:comment "Vocabulary for mapping business concepts to physical database structures in the Magnowlia ontology framework." .

m:BusinessView a owl:Class ;
    rdfs:label "Business View" ;
    rdfs:comment "Logical business view over one or two technical tables. With one table, m:joinCondition acts as a WHERE filter (filtered BV). With two tables, m:joinCondition is the ON clause of an INNER JOIN linking them." .

m:Table a owl:Class ;
    rdfs:label "Table" ;
    rdfs:comment "Physical database table or persisted view." .

m:Column a owl:Class ;
    rdfs:label "Column" ;
    rdfs:comment "Physical database column used for mapping business attributes and metrics." .

m:mapsToTable a owl:ObjectProperty ;
    rdfs:label "maps to table" ;
    rdfs:comment "Links a business class or view to one or more underlying physical tables." ;
    rdfs:domain owl:Class ;
    rdfs:range m:Table .

m:mapsToColumn a owl:ObjectProperty ;
    rdfs:label "maps to column" ;
    rdfs:comment "Links a business attribute to the physical column(s) that realize it." ;
    rdfs:domain owl:DatatypeProperty ;
    rdfs:range m:Column .

m:belongsToTable a owl:ObjectProperty ;
    rdfs:label "belongs to table" ;
    rdfs:comment "Links a physical database column to its containing table." ;
    rdfs:domain m:Column ;
    rdfs:range m:Table .

m:joinCondition a owl:DatatypeProperty ;
    rdfs:label "join condition" ;
    rdfs:comment "For a single-table m:BusinessView, a SQL WHERE-style filter applied to that table. For a two-table m:BusinessView, the ON condition of the INNER JOIN linking the primary table to the secondary table listed in m:mapsToTable (e.g. "primary.id = secondary.fk")." ;
    rdfs:domain owl:Class ;
    rdfs:range xsd:string .

m:unionOfTables a owl:DatatypeProperty ;
    rdfs:label "union of tables" ;
    rdfs:comment "SQL-like UNION rule describing a business union view." ;
    rdfs:domain owl:Class ;
    rdfs:range xsd:string .

m:realizedBy a owl:DatatypeProperty ;
    rdfs:label "realized by" ;
    rdfs:comment "SQL join condition realizing a relationship via technical tables. Bare table.column references; SQL functions, ::casts and string literals are allowed; multi-table joins through bridge tables are supported as a single linear equality chain from the domain table to the range table." ;
    rdfs:domain owl:ObjectProperty ;
    rdfs:range xsd:string .

m:relationshipRole a owl:DatatypeProperty ;
    rdfs:label "relationship role" ;
    rdfs:comment "Semantic role of a relationship for path-enumeration filtering: Membership, Transactional, Audit, Self, Denormalized, or Polymorphic." ;
    rdfs:domain owl:ObjectProperty ;
    rdfs:range xsd:string .

m:tablePrefix a owl:DatatypeProperty ;
    rdfs:label "table prefix" ;
    rdfs:comment "Schema prefix for SQL table references. Composed with the table URI fragment to form the qualified SQL table name." ;
    rdfs:domain m:Table ;
    rdfs:range xsd:string .

m:tableName a owl:DatatypeProperty ;
    rdfs:label "table name" ;
    rdfs:comment "Raw SQL table identifier. When present on m:Table, takes precedence over the URI fragment for SQL composition. Lets disambiguated URIs (e.g. t:orders_db1) coexist with the raw SQL identifier (orders). SEE: ADR-050." ;
    rdfs:domain m:Table ;
    rdfs:range xsd:string .

