@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 sh:     <http://www.w3.org/ns/shacl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix schema: <http://schema.org/> .
@prefix foaf:   <http://xmlns.com/foaf/0.1/> .
@prefix eprel:  <../vocab#> .
@prefix common: <common.shapes.ttl#> .
@prefix supplier: <supplier.shapes.ttl#> .
@prefix concept: <concept.shapes.ttl#> .
@prefix :       <product.shapes.ttl#> .

# Entry shapes document for a product: data = product/{registrationNumber}.
#
# The fields every product group shares are here. Fields of one product group
# live in {group}.shapes.ttl and add sh:property to :ProductShape; the imports
# merge them. A product shows only the fields it has values for, so a tyre
# never shows the dishwasher group. A field that two groups share (the
# dimensions) is listed once, here, because listing it in both group files
# would show it twice.
#
# Adding a product group means adding a {group}.shapes.ttl and importing it
# below, the same way adding one to the converter means adding table rows.

<> a foaf:Document ;
    rdfs:label "Linked EPREL shapes: product"@en , "Linked-EPREL-Shapes: Produkt"@de ;
    owl:imports
        <dishwashers2019.shapes.ttl> ,
        <lightsources.shapes.ttl> ,
        <tyres.shapes.ttl> ,
        <supplier.shapes.ttl> ,
        <concept.shapes.ttl> ,
        <common.shapes.ttl> ,
        <../vocab> .

# ---- Groups -------------------------------------------------------------

:IdentificationGroup a sh:PropertyGroup ;
    rdfs:label "Identification"@en , "Identifikation"@de ;
    sh:order 1 .

:EnergyLabelGroup a sh:PropertyGroup ;
    rdfs:label "Energy label"@en , "Energielabel"@de ;
    sh:order 2 .

# Product-group groups take sh:order 3 to 9 (see the {group}.shapes.ttl files).

:DimensionsGroup a sh:PropertyGroup ;
    rdfs:label "Dimensions"@en , "Abmessungen"@de ;
    sh:order 10 .

:SupplierGroup a sh:PropertyGroup ;
    rdfs:label "Supplier"@en , "Lieferant"@de ;
    sh:order 11 .

:MarketGroup a sh:PropertyGroup ;
    rdfs:label "Market and lifecycle"@en , "Markt und Lebenszyklus"@de ;
    sh:order 12 .

:DocumentsGroup a sh:PropertyGroup ;
    rdfs:label "Documents"@en , "Dokumente"@de ;
    sh:order 13 .

:RegistrationGroup a sh:PropertyGroup ;
    rdfs:label "EPREL registration"@en , "EPREL-Registrierung"@de ;
    sh:order 14 .

# ---- Root ---------------------------------------------------------------

:ProductShape
    a sh:NodeShape ;
    sh:targetClass eprel:EnergyLabelledProduct .

# ---- Identification -----------------------------------------------------

:ProductShape sh:property [
    sh:path schema:model ;
    sh:name "Model identifier"@en , "Modellkennung"@de ;
    sh:minCount 1 ;
    sh:group :IdentificationGroup ; sh:order 1
] , [
    sh:path schema:brand ;
    sh:name "Supplier or trademark"@en , "Lieferant oder Marke"@de ;
    sh:description "The supplier name or trademark as registered in EPREL."@en ;
    sh:minCount 1 ;
    sh:group :IdentificationGroup ; sh:order 2
] , [
    sh:path eprel:registrationNumber ;
    sh:minCount 1 ;
    sh:group :IdentificationGroup ; sh:order 3
] , [
    sh:path eprel:productGroup ;
    sh:node concept:ConceptShape ;
    sh:minCount 1 ;
    sh:group :IdentificationGroup ; sh:order 4
] , [
    sh:path eprel:implementingAct ;
    sh:node concept:ConceptShape ;
    sh:group :IdentificationGroup ; sh:order 5
] , [
    sh:path schema:gtin13 ;
    sh:name "GTIN"@en , "GTIN"@de ;
    sh:group :IdentificationGroup ; sh:order 6
] , [
    sh:path eprel:gtinIdentifier ;
    sh:group :IdentificationGroup ; sh:order 7
] , [
    sh:path eprel:installationType ;
    sh:group :IdentificationGroup ; sh:order 8
] , [
    sh:path rdfs:comment ;
    sh:name "Additional information"@en , "Zusätzliche Informationen"@de ;
    sh:description "Free text the supplier entered, in one or more languages."@en ;
    sh:group :IdentificationGroup ; sh:order 9
] , [
    sh:path foaf:page ;
    sh:name "EPREL public page"@en , "Öffentliche EPREL-Seite"@de ;
    sh:group :IdentificationGroup ; sh:order 10
] , [
    sh:path schema:url ;
    sh:name "Supplier product information"@en , "Produktinformationen des Lieferanten"@de ;
    sh:description "A link the supplier registered for this model (webLinkSupplier)."@en ;
    sh:group :IdentificationGroup ; sh:order 11
] .

# ---- Energy label -------------------------------------------------------

:ProductShape sh:property [
    sh:path eprel:energyClass ;
    sh:group :EnergyLabelGroup ; sh:order 1
] , [
    sh:path eprel:energyClassCode ;
    sh:group :EnergyLabelGroup ; sh:order 2
] , [
    sh:path eprel:energyClassRange ;
    sh:group :EnergyLabelGroup ; sh:order 3
] , [
    sh:path eprel:energyClassRangeFrom ;
    sh:group :EnergyLabelGroup ; sh:order 4
] , [
    sh:path eprel:energyClassRangeTo ;
    sh:group :EnergyLabelGroup ; sh:order 5
] , [
    sh:path eprel:energyEfficiencyIndex ;
    sh:group :EnergyLabelGroup ; sh:order 6
] , [
    sh:path eprel:isEnergySmartAppliance ;
    sh:group :EnergyLabelGroup ; sh:order 7
] .

# ---- Dimensions (dishwashers2019, lightsources) -------------------------

:ProductShape sh:property [
    sh:path eprel:width ;
    sh:group :DimensionsGroup ; sh:order 1
] , [
    sh:path eprel:height ;
    sh:group :DimensionsGroup ; sh:order 2
] , [
    sh:path eprel:depth ;
    sh:group :DimensionsGroup ; sh:order 3
] , [
    sh:path eprel:diameter ;
    sh:group :DimensionsGroup ; sh:order 4
] .

# ---- Supplier -----------------------------------------------------------

:ProductShape sh:property [
    sh:path schema:manufacturer ;
    sh:name "Supplier"@en , "Lieferant"@de ;
    sh:node supplier:SupplierShape ;
    sh:group :SupplierGroup ; sh:order 1
] , [
    sh:path eprel:contactPoint ;
    sh:node common:AddressShape ;
    sh:group :SupplierGroup ; sh:order 2
] , [
    sh:path eprel:trademarkOwner ;
    sh:group :SupplierGroup ; sh:order 3
] , [
    sh:path eprel:registrantNature ;
    sh:group :SupplierGroup ; sh:order 4
] .

# ---- Market and lifecycle -----------------------------------------------

:ProductShape sh:property [
    sh:path eprel:onMarketFirstStartDate ;
    sh:group :MarketGroup ; sh:order 1
] , [
    sh:path eprel:onMarketStartDate ;
    sh:group :MarketGroup ; sh:order 2
] , [
    sh:path eprel:onMarketEndDate ;
    sh:group :MarketGroup ; sh:order 3
] , [
    sh:path eprel:guaranteeDuration ;
    sh:group :MarketGroup ; sh:order 4
] , [
    sh:path eprel:availableInAllEuEeaCountries ;
    sh:group :MarketGroup ; sh:order 5
] , [
    sh:path eprel:availableInCountry ;
    sh:group :MarketGroup ; sh:order 6
] , [
    sh:path eprel:availableInCountryCode ;
    sh:group :MarketGroup ; sh:order 7
] , [
    sh:path eprel:firstPublishedAt ;
    sh:group :MarketGroup ; sh:order 8
] , [
    sh:path dcterms:issued ;
    sh:name "Published in EPREL (this version)"@en , "In EPREL veröffentlicht (diese Version)"@de ;
    sh:group :MarketGroup ; sh:order 9
] .

# ---- Documents ----------------------------------------------------------

# No sh:node: the values are the label files themselves (PDF, SVG, PNG), not
# RDF documents, so they are shown as links.
:ProductShape sh:property [
    sh:path eprel:uploadedLabel ;
    sh:group :DocumentsGroup ; sh:order 1
] , [
    sh:path eprel:generatedLabel ;
    sh:group :DocumentsGroup ; sh:order 2
] .

# ---- EPREL registration -------------------------------------------------

:ProductShape sh:property [
    sh:path eprel:status ;
    sh:group :RegistrationGroup ; sh:order 1
] , [
    sh:path eprel:versionNumber ;
    sh:group :RegistrationGroup ; sh:order 2
] , [
    sh:path eprel:lastVersion ;
    sh:group :RegistrationGroup ; sh:order 3
] , [
    sh:path eprel:blocked ;
    sh:group :RegistrationGroup ; sh:order 4
] , [
    sh:path eprel:supplierVerificationStatus ;
    sh:group :RegistrationGroup ; sh:order 5
] , [
    sh:path eprel:trademarkVerificationStatus ;
    sh:group :RegistrationGroup ; sh:order 6
] , [
    sh:path eprel:formType ;
    sh:group :RegistrationGroup ; sh:order 7
] .
