@prefix : <http://example.com/autosar/demo#> .
@prefix autosar: <http://example.com/ontology/autosar#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# ===== Ontology notes =====
# This TTL uses an illustrative AUTOSAR ontology (autosar:*) for demonstration.
# Classes and properties are representative; adapt to your in-house or public ontology if you have one.

# ===== Packages =====
:DemoPkg a autosar:ArPackage ;
  autosar:shortName "DemoPkg" ;
  autosar:contains :Pkg_DataTypes, :Pkg_Interfaces, :Pkg_Components, :Pkg_Composition .

:Pkg_DataTypes a autosar:ArPackage ;
  autosar:shortName "DataTypes" ;
  autosar:hasElement :UINT8, :UInt8, :SpeedType .

:Pkg_Interfaces a autosar:ArPackage ;
  autosar:shortName "Interfaces" ;
  autosar:hasElement :SpeedIf .

:Pkg_Components a autosar:ArPackage ;
  autosar:shortName "Components" ;
  autosar:hasElement :SpeedSensor, :SpeedController .

:Pkg_Composition a autosar:ArPackage ;
  autosar:shortName "Composition" ;
  autosar:hasElement :SpeedSystem, :SpeedConn .

# ===== Data Types =====
:UINT8 a autosar:SwBaseType ;
  autosar:shortName "UINT8" ;
  autosar:category "FIXED_LENGTH" ;
  autosar:size "8"^^xsd:integer ;
  autosar:encoding "NONE" ;
  autosar:nativeDeclaration "uint8" .

:UInt8 a autosar:ImplementationDataType ;
  autosar:shortName "UInt8" ;
  autosar:category "VALUE" ;
  autosar:baseTypeRef :UINT8 .

:SpeedType a autosar:ApplicationPrimitiveDataType ;
  autosar:shortName "SpeedType" ;
  autosar:category "VALUE" ;
  autosar:baseTypeRef :UINT8 .

# ===== Interface and data element =====
:SpeedIf a autosar:SenderReceiverInterface ;
  autosar:shortName "SpeedIf" ;
  autosar:isService "false"^^xsd:boolean ;
  autosar:dataElement :CurrentSpeed .

:CurrentSpeed a autosar:VariableDataPrototype ;
  autosar:shortName "CurrentSpeed" ;
  autosar:typeRef :SpeedType .

# ===== Components =====
:SpeedSensor a autosar:ApplicationSwComponentType ;
  autosar:shortName "SpeedSensor" ;
  autosar:hasPort :P_Speed .

:P_Speed a autosar:PPortPrototype ;
  autosar:shortName "P_Speed" ;
  autosar:providedInterface :SpeedIf .

:SpeedController a autosar:ApplicationSwComponentType ;
  autosar:shortName "SpeedController" ;
  autosar:hasPort :R_Speed .

:R_Speed a autosar:RPortPrototype ;
  autosar:shortName "R_Speed" ;
  autosar:requiredInterface :SpeedIf .

# ===== Composition and connectors =====
:SpeedSystem a autosar:CompositionSwComponentType ;
  autosar:shortName "SpeedSystem" ;
  autosar:hasComponent :sensor, :controller ;
  autosar:hasConnector :SpeedConn .

:sensor a autosar:SwComponentPrototype ;
  autosar:shortName "sensor" ;
  autosar:typeRef :SpeedSensor .

:controller a autosar:SwComponentPrototype ;
  autosar:shortName "controller" ;
  autosar:typeRef :SpeedController .

:SpeedConn a autosar:AssemblySwConnector ;
  autosar:shortName "SpeedConn" ;
  autosar:connectsProvider :sensor ;
  autosar:connectsRequester :controller ;
  autosar:providerPort :P_Speed ;
  autosar:requesterPort :R_Speed .
